Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: File::Basename and File::MMagic for File Downloads from Website

by agent00013 (Pilgrim)
on Nov 21, 2008 at 00:53 UTC ( [id://725033]=note: print w/replies, xml ) Need Help??


in reply to Re: File::Basename and File::MMagic for File Downloads from Website
in thread File::Basename and File::MMagic for File Downloads from Website

I am not getting the same results. On my Debian machine, I get the following output using some of the examples.
> perl -MFile::Basename -le "print basename 'foo/bar'" bar > perl -MFile::Basename -le "print basename 'Z:\my_files\docs\some_kin +d_of_manual.pdf'" Z:\my_files\docs\some_kind_of_manual.pdf > perl -MFile::Basename -le "print basename '/home/someguy/file.txt'" file.txt
  • Comment on Re^2: File::Basename and File::MMagic for File Downloads from Website
  • Download Code

Replies are listed 'Best First'.
Re^3: File::Basename and File::MMagic for File Downloads from Website
by ikegami (Patriarch) on Nov 21, 2008 at 02:05 UTC

    Sorry, it had been a while. It does behave in a system-specific fashion.

    Technically, what you ask is impossible. 'foo\bar' should return 'foo\bar' if a unix path and 'bar' if a Windows path, but you don't know what kind of path your client built. That means you might as well roll out code that does what you want it to do.

    my $basename = ( split /[:\/\\]/, $_ )[-1];

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://725033]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (6)
As of 2024-04-23 12:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found