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

I wasn't aware about Path::Class. I was suprised upon reading the docs that it provides two distinct objects without a base implementing public interfaces for common behaviours. I would just say,
$ perl -MFile::Spec -wle 'my $path = shift; my $last = (File::Spec->sp +litpath($path))[-1]; print $last' /etc/httpd/conf conf $ perl -MFile::Spec -wle 'my $path = shift; my $last = (File::Spec->sp +litpath($path))[-1]; print $last' /etc/httpd/conf/httpd.conf httpd.conf
I think you can just pass the object to File::Spec::splitpath() function because the class implements string overloading method. So, you don't have to care whether what you pass is ::File or ::Dir object.
$ perl -MPath::Class -wle 'my $path = shift; my $obj = file($path); pr +int +(File::Spec->splitpath($obj))[-1]' /etc/httpd/conf/httpd.conf httpd.conf $ perl -MPath::Class -wle 'my $path = shift; my $obj = dir($path); pri +nt +(File::Spec->splitpath($obj))[-1]' /etc/httpd/conf conf
Of course, you still have to know what object you want to create in the first place.

Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!