more useful options | |
PerlMonks |
Re: Using URI::URL to determine resources within a siteby Gilimanjaro (Hermit) |
on Aug 04, 2004 at 11:00 UTC ( [id://379954]=note: print w/replies, xml ) | Need Help?? |
A regular expression can do this, and can handle the case for you: $match = $url =~ /^$base/i;That's case insensitive... But there really is no solution; whether or not the case matters depends on the webserver implementation, and so you can't be sure if you should check for it.
Other tricky stuff can be a double slash after the host part, or anywhere in the url. Most webservers when mapping requests directly to files on the filesystem will find a file with superfluos slashes, but if everything under a certain location is passed to for instance to a custom mod_perl handler, it's completely up to the handler to decide whether the request is ok... It sort of depends on your exact definition of 'site' and thus 'part of the site' I suppose...
In Section
Seekers of Perl Wisdom
|
|