Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: get the "last part" of a Path::Class object

by mrpeabody (Friar)
on Jun 23, 2007 at 19:44 UTC ( [id://623011]=note: print w/replies, xml ) Need Help??


in reply to get the "last part" of a Path::Class object

It's absurd that these two classes don't have a method with the same name for this common operation. The obvious solution is patching Path::Class::Dir to get (pseudocode):
sub Path::Class::Dir::basename { return $self->dir_list(-1); }

Alternatively, this idiom would probably work for most cases:

file($p)->basename;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-24 02:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found