Christopher H. Laco wrote:
Stas Bekman wrote:

 > Of course it should take the necessary precautions for when / is and
 > isn't included, etc.

What do you mean? Examples?


Well, let's go with the running sample:

  sub module2url {
     my $module = shift;
     my $scheme = shift || "http";

     Apache::TestRequest::module($module);
     my $config   = Apache::Test::config();
     my $hostport = Apache::TestRequest::hostport($config);
     my $path     = Apache::TestRequest::module2path($module);
     return "$scheme://$hostport$path";
 }

If looks as though module2path() returns the path starting with /.
If we override that with the path from the hashref module2url($url, {path => 'mypath'}) we would end up with scheme://host:portmypath instead of scheme://host:port/mypath.

You are correct. Then yes, if the $path argument is provided by the user strip the leading /.


--
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Reply via email to