"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
In reply to Re^4: Strip part of url
by afoken
in thread Strip part of url
by htmanning
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |