in reply to how to create the path automatically

I don't understand why you need to create an object and call to subs/methods before actually calling mkpath. What's wrong with simply writing:
use File::Path qw(mkpath); my $path = 'path/to/create'; mkpath($path) unless -e $path;

Replies are listed 'Best First'.
Re^2: how to create the path automatically
by rovf (Priest) on Jun 18, 2009 at 12:49 UTC
    mkpath($path) unless -e $path;

    The unless clause is not necessary here. Further, this would die if the path can't be created, so unless the OP wants this exception to propagate, it's maybe better written as

    eval { mkpath($path) }; if($@) { ... }

    -- 
    Ronald Fischer <ynnor@mm.st>
Re^2: how to create the path automatically
by baxy77bax (Deacon) on Jun 18, 2009 at 12:56 UTC
    now this is a good question, and the answer is : because i didn't think this through , i just automatically copy/past/edit a peace piece (i was learning my english by VUK :) ) of my code.

    sorry (++)

      _____ .-' | '-. .' | '. / | \ ; | ; | | | of code -.- ; /|\ ; \ /` | `\ / './` | `\.' '-.__|__.-'


      holli

      When you're up to your ass in alligators, it's difficult to remember that your original purpose was to drain the swamp.