[Pdx-pm] File-Fu

Eric Wilhelm scratchcomputing at gmail.com
Mon Feb 18 01:35:07 PST 2008

Hi all,

As I mentioned last week, I'm engaging in a rethink of how we handle 
file and directory names (ultimately in a cross-platform way.)

Basically, I've never been able to force myself to use File::Spec 
because it is so wordy compared to constructing unix paths (which 
actually works most of the time on most of the platforms.)

But, unix paths as simple strings tend to have their own troubles.  For 
example, "did I get the trailing slash into that directory variable?" 
and basename()/dirname() as functions still really make you wish for an 

So, here's an object (in a slightly different way than Path::Class --  
In particular, I like to embrace the fact that perl does have error 
handling, so things like open() throw errors.)


It does need refinement, and I haven't exactly decided how to handle the 
cross-platformness (because the directory object is a list (not a 
string), so stringifying it just to call File::Spec methods seems 
awfully clunky.)  (I think it might involve dis-entangling the 
File::Spec logic from the string assumption.)

Any thoughts on what is glaringly missing?

If you want to play with it, most of what is there is probably 
api-stable so long as you're on unix.  Anybody want to hammer-through 
the windows issues with me?

Also on the todo list is creating methods for File::Find, File::Temp, 
and File::Path features.

software:  a hypothetical exercise which happens to compile.

More information about the Pdx-pm-list mailing list