package Base::Roots; use strict; use warnings FATAL => qw( all ); use base 'Exporter'; our @EXPORT = qw(get_root); my $server = $ENV{SERVER_NAME} ? $ENV{SERVER_NAME} : 'localhost'; my %hosts = ( 'localhost' => { path => q(C:/Documents and Settings//My Documents/fantasy), link => q(http://localhost), user => q(), name => q('s Domain), mail => q(@localhost), }, 'www.xecu.net' => { path => q(/ftp/pub/www/fantasy), link => q(http://www.xecu.net/fantasy), user => q(Fantasy), name => q(Fantasy's Realm), mail => q(fantasy@xecu.net), }, 'fantasy.xecu.net' => { path => q(/www/fantasy/public_html), link => q(http://fantasy.xecu.net), user => q(Fantasy), name => q(Fantasy's Realm), mail => q(fantasy@xecu.net), } ); my $root_path = $hosts{$server}{path}; for my $host (keys %hosts) { $hosts{$host}{data} = "$root_path/files/data"; for my $key qw(audio css images) { $hosts{$host}{$key} = $hosts{$host}{link}."/files/$key"; } } sub get_root { my ($host_key) = @_; return $hosts{$server}{$host_key}; } 1;