Dermot Paikkos wrote: > Hi, > > I am moving a site from once host to another. There are lots of > hardcoded fully qualified paths to the localhost (EG > http://myserver/cgi-bin/someprog.pl?name=val & > http://myserver/css/mystyle.css). > > I am pretty sure this isn't good practise but I am not a bit lost as > to what are good alternatives. I don't want to make the same mistake > and have to do all this editing again next time the hardware changes. > > Should I be trying to create a module with these paths in? Or is > there some other way? > Thanx. > Dp. > >
Relative URLs as David mentioned would be good whereever they can be used. The other option I use is to create a Setup.pm module that contains constants for these things. use constant CONFIG_URL_BASE => 'http://yoursite.com'; use constant CONFIG_URL_CGI_BASE => 'http://yoursite.com/cgi-bin'; Then you need to export those constants into the calling code. The only bummer about using constants is that they don't interpolate inside strings, but I have settled on using concatenation and prefer to have the extra overhead to have the ease of changing all URLs on a site at once. This also makes module code that generates links reusable across sites. http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>