Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: Re: Re: copy directories

by thealienz1 (Pilgrim)
on Mar 17, 2001 at 00:13 UTC ( [id://65011]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: copy directories
in thread copy directories

What I am saying when it doesn't work is that it doens't work... i am saying your suggestions caused the program to run the same way its running... you guys are too verbose.

adding a die statement makes it reture "Died at sendfile.pl line 28"...
printing @newdirs returns NOTHING...

"The pajamas do not like to eat large carnivore toasters."
In German: "Die Pyjamas mögen nicht große Tiertoaster essen.
In Spanish: "Los pijamas no tienen gusto de comer las tostadoras grandes del carnívoro."

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: copy directories
by merlyn (Sage) on Mar 17, 2001 at 00:20 UTC
    What I am saying when it doesn't work is that it doens't work
    How do you know it "doesn't work"? By what standard are you measuring it? How are you sure it's not doing exactly what you told it to do?

    The problem is that nothing "doesn't work". It only does something. We're asking you what it is doing, and how that differs from what you wanted or expected.

    -- Randal L. Schwartz, Perl hacker

(boo) Re:x5 copy directories
by boo_radley (Parson) on Mar 17, 2001 at 00:29 UTC
    saying
    adding a die statement makes it reture "Died at sendfile.pl line 28"...
    is a little ambiguous. did you do this?
    27 : } elsif(-d "$ARGV[0]") { 28 : die; 29 : print "Copying path to $Single_User_Directory - "; 30 : mkpath([$ARGV[0], $Single_User_Directory], 1, 0711);
    or this
    27 : } elsif(-d "$ARGV[0]") { 28 : print "Copying path to $Single_User_Directory - " || d +ie; 29 : mkpath([$ARGV[0], $Single_User_Directory], 1, 0711);

    ? Although you list line 28 as the dying line that doesn't make sense with the original listing... I suppose you have
    mkpath([$ARGV[0], $Single_User_Directory], 1, 0711) or die;

    try something more verbose :
    mkpath([$ARGV[0], $Single_User_Directory], 1, 0711) or die "Unable to +mkpath!!! perl reports $! ---;
    the secret is $! -- without it, you're rendering your dies useless.
Re: Re: Re: Re: Re: copy directories
by arturo (Vicar) on Mar 17, 2001 at 00:30 UTC

    I explicitly said that the changes were to aid in debugging, to provide more information. I'm trying to help you fix a problem without knowing what kind of inputs you're feeding this program, etc. And all at a *very* reasonable price, I might add =)

    Here's some advice: go ahead and load the @ARGV variables into ones with names that reflect their purposes. That's just for the future.

    For now, let's look at the documentation for mkpath:

    `mkpath' takes three arguments:
    
           o   the name of the path to create, or a reference to a
               list of paths to create,
    

    What you're now passing it is a reference to a list of directories, one of them being $ARGV[0] and the other being $SingleUserDirectory. You're telling it to create these two paths. (From the looks of your code, you more or less cut-and-pasted the code in the manpage and changed the variable names) What I assume you want to do is to create a copy of the directory tree at $ARGV[0] underneath the user's directory. That's one path, which you get by tacking on the former to the latter (assuming the latter is fully qualified or underneath the current working directory). Why is your call failing? Well, assuming the names are correct, those directories already exist.

    so,

    mkpath("${SingleUserDirectory}$ARGV[0]", 1, 0755) or die "Couldn't create ${SingleUserDirectory}$ARGV[0]: $!\n";

    would seem to be what you want.

    Philosophy can be made out of anything. Or less -- Jerry A. Fodor

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://65011]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2024-04-25 02:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found