Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Perl / January 2006



Tip: Looking for answers? Try searching our database.

mkpath

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andrew Brosnan - 13 Jan 2006 17:37 GMT
I'm using File::Path's mkpath() function in a script run by Apache on
Mac OS X 10.3 and Perl 5.8.1. It works fine when only creating a single
directory, but as soon as it tries to create more than one directory
level, it fails. Below is the relevant code and error. Can anyone see
anything wrong, or have others seen this before?

   my $full_path = $base_path.'/'.$new_path;
   unless (-e $full_path) {
       eval{mkpath($full_path)};
       if ($@) { warn "Couldn't create $full_path: $@";}
   }

[Fri Jan 13 12:15:51 2006] [error] [client 127.0.0.1] Couldn't create
/opt/apache/sites/newsdesk/htdocs/media/8/2/7: mkdir
/opt/apache/sites/newsdesk/htdocs/media/8/2/7: No such file or directory
at /opt/newsdesk/app/lib/perl/News/Audio.pm line 60

Thanks,
Andrew
Jeremy Mates - 13 Jan 2006 17:58 GMT
* Andrew Brosnan <andrew@broscom.com>
> I'm using File::Path's mkpath() function in a script run by Apache on
> Mac OS X 10.3 and Perl 5.8.1. It works fine when only creating a
> single directory, but as soon as it tries to create more than one
> directory level, it fails. Below is the relevant code and error. Can
> anyone see anything wrong, or have others seen this before?

Permissions problem, perhaps?

http://sial.org/howto/debug/unix/parsepath

I do not recall seeing mkpath problems on 10.3, and the following works
for me under perl 5.8.6 on 10.4:

#!/usr/bin/perl -w
use strict;

use File::Path qw(mkpath);
use File::Spec ();

my $target_path = File::Spec->catfile( '/tmp', random_numbers() );
warn "info: creating path: name=$target_path\n";

eval { mkpath($target_path); };
if ($@) {
 die "error: problem creating path: errno=$@, name=$target_path\n";
}

sub random_numbers {
 return split //, $$;
}
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.