in reply to Re^3: Strip part of url
in thread Strip part of url
"Mac OS" ne "OS X". Mac OS has ":" as path delimiter, OS X is derived from Unix and thus has a "/" as path delimiter.
File::Basename can change its idea of the operating system, so you can see the problem on every operating system:
use File::Basename; my $url = "http://google.com/folder/1234.html"; print "Native: ",basename($url,'.html') +,"\n"; fileparse_set_fstype('Unix'); print "Unix: ", basename($url,'.html') +,"\n"; fileparse_set_fstype('MacOS'); print "MacOS: ", basename($url,'.html') +,"\n";
Output on Windows:
Native: 1234 Unix: 1234 MacOS: //google.com/folder/1234
Abusing that feature to force Unix semantics doesn't really help:
use File::Basename; my $url = "http://google.com/folder/1234.html?session=4247110815"; print "Native: ",basename($url,'.html') +,"\n"; fileparse_set_fstype('Unix'); print "Unix: ", basename($url,'.html') +,"\n"; fileparse_set_fstype('MacOS'); print "MacOS: ", basename($url,'.html') +,"\n";
Output:
Native: 1234.html?session=4247110815 Unix: 1234.html?session=4247110815 MacOS: //google.com/folder/1234.html?session=4247110815
Alexander
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Strip part of url
by Your Mother (Archbishop) on Feb 13, 2011 at 16:33 UTC |