The 2001 Perl Advent Calendar
[about] | [archives] | [contact] | [home]

On the 4th day of Advent my True Language brought to me..
File::Spec

File::Spec ships with perl and is therefore available to use pretty much wherever perl is. Its main job is to provide an abstract interface to file system operations so that programs are portable from one file system (e.g. Unix) to another (e.g. Windows.) But this isn't the reason I chose it - it's because it makes doing these things easy

I love using catfile - the function to cat directories together to form a path - as I don't have to think about it (did I remember to include all the slashes?) and it just works.

I hope you're starting to see a pattern in my modules choice. I like modules that simply work, do their job, and make my life easier. File::Spec certainly fits in this description.

  • File::Spec::Unix for a full list of functions
  • File::Spec::Functions for the procedural interface