package Static::Link; use strict; use warnings; use vars '$type'; $type = 'cgi'; # default use overload '""' => sub { $_[0]->$type }; # '/cgi-bin/static.pl' => # http://server.example/cgi-bin/static.pl?rm=foo my $script = "/cgi-bin/static.cgi"; # 'html/' => # http://server.example/html/rm_foo.html my $htdocs = ""; sub cgi { "$script?".${$_[0]} } sub offline { my $link = ${$_[0]}; $link =~ tr/=/_/; # fit to your needs "$htdocs$link.html"; }