Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: copy directories

by thealienz1 (Pilgrim)
on Mar 17, 2001 at 00:04 UTC ( #65008=note: print w/replies, xml ) Need Help??


in reply to Re: copy directories
in thread copy directories

For the darnest reason that doesn't work... I am using $ARGV could that have anything to do with it?

"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: copy directories
by arturo (Vicar) on Mar 17, 2001 at 00:06 UTC

    Please, "doesn't work" how? The call goes through without dying? Did you print out @newdirs ?

    You need to be more verbose in your descriptions.

    (and I don't think the use of @ARGV has anything to do with it, fwiw)

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

      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."

        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

        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.

        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
Node Status?
node history
Node Type: note [id://65008]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2019-10-22 14:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?