Perl and recursive copying?

Discussion in 'Perl Misc' started by Kyle Witherspoon, Aug 14, 2003.

  1. I'm trying to write a web based perl script that writes a self
    replicating website.
    For now, I'm trying to have it copy the contents of
    /usr/apache/joe
    to /usr/apache/bill.

    So I need it to programmatically create bill and copy the entire
    contents of joe...I'm using Perl 5.6.0 and none of the File::Copy
    commands are working, or I am doing it wrong..anyone have a bone to
    throw? thanks
     
    Kyle Witherspoon, Aug 14, 2003
    #1
    1. Advertising

  2. Kyle Witherspoon

    Tore Aursand Guest

    On Thu, 14 Aug 2003 00:20:21 +0000, Kyle Witherspoon wrote:
    > For now, I'm trying to have it copy the contents of
    > /usr/apache/joe
    > to /usr/apache/bill.


    Why don't you use 'cp -R /usr/apache/joe/* /usr/apache/bill/.'?


    --
    Tore Aursand <>
     
    Tore Aursand, Aug 14, 2003
    #2
    1. Advertising

  3. Kyle Witherspoon <> wrote in message news:<9BA_a.12846$>...
    > I'm trying to write a web based perl script that writes a self
    > replicating website.
    > For now, I'm trying to have it copy the contents of
    > /usr/apache/joe
    > to /usr/apache/bill.
    >
    > So I need it to programmatically create bill and copy the entire
    > contents of joe...I'm using Perl 5.6.0 and none of the File::Copy
    > commands are working, or I am doing it wrong..anyone have a bone to
    > throw? thanks


    You'll have to show us your code in order for us to determine what's going wrong.
     
    James E Keenan, Aug 14, 2003
    #3
  4. (Tad McClellan) wrote in message news:<>...
    > James Willmore <> wrote:
    >
    > > use vars qw/$joe $bill/;

    >
    >
    > You should always prefer lexical variables over package
    > variables, except when you can't.
    >
    >
    > And you can, but you aren't, and you should:
    >
    > my( $joe, $bill );


    Okay, now you've given me a concept to read about (lexical). I seen
    it, heard about it, and, I fear greatly to say this, but don't
    understand it.

    Thanks,

    Jim
     
    James Willmore, Aug 16, 2003
    #4
  5. James Willmore <> wrote:
    > (Tad McClellan) wrote in message news:<>...



    >> You should always prefer lexical variables over package
    >> variables, except when you can't.


    > Okay, now you've given me a concept to read about (lexical). I seen
    > it, heard about it, and, I fear greatly to say this, but don't
    > understand it.



    Lexical variables are the ones that are _easy_ to understand.

    It is package variables that are harder to understand.

    Use the easy-to-understand kind whenever you can.


    See also:

    "Coping with Scoping":

    http://perl.plover.com/FAQs/Namespaces.html


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Aug 16, 2003
    #5
  6. Tad McClellan <> wrote:
    > James Willmore <> wrote:
    > > (Tad McClellan) wrote in message news:<>...

    >
    >
    > >> You should always prefer lexical variables over package
    > >> variables, except when you can't.

    >
    > > Okay, now you've given me a concept to read about (lexical). I seen
    > > it, heard about it, and, I fear greatly to say this, but don't
    > > understand it.

    >
    >
    > Lexical variables are the ones that are _easy_ to understand.
    >
    > It is package variables that are harder to understand.
    >


    Conceptually, perhaps, yes. But the term _lexical_ itself occludes
    the simplicity of the idea. The term _package_ finds expression in the
    perl syntax and is similar in its use there as it is in human languages,
    whereas the _lexical_ is an uncommon word and it appears to be used in an
    essentially metaphorical manner in describing the scope of stuff in Perl.
    The perlfaq item:

    How can I access a dynamic variable while a
    similarly named lexical is in scope?

    seems to make a further leap by assuming the reader will fill in the
    'ly scoped variable' (yes, the patch is in the post :)

    So on balance I'm not surprised that people find lexically scoped thingies
    ( and how much more difficult it is on the brain when these things aren't
    simple identifiers like variables) more difficult to understand than
    package scoped ones.

    Now what was my point again?


    /J\
    --
    Jonathan Stowe |
    <http://www.gellyfish.com> | This space for rent
    |
     
    Jonathan Stowe, Aug 18, 2003
    #6
  7. Jonathan Stowe <> wrote in message news:<ypU%a.11$>...
    > Conceptually, perhaps, yes. But the term _lexical_ itself occludes
    > the simplicity of the idea. The term _package_ finds expression in the
    > perl syntax and is similar in its use there as it is in human languages,
    > whereas the _lexical_ is an uncommon word and it appears to be used in an
    > essentially metaphorical manner in describing the scope of stuff in Perl.
    > The perlfaq item:
    >
    > How can I access a dynamic variable while a
    > similarly named lexical is in scope?
    >
    > seems to make a further leap by assuming the reader will fill in the
    > 'ly scoped variable' (yes, the patch is in the post :)
    >
    > So on balance I'm not surprised that people find lexically scoped thingies
    > ( and how much more difficult it is on the brain when these things aren't
    > simple identifiers like variables) more difficult to understand than
    > package scoped ones.
    >
    > Now what was my point again?


    LOL. I'm not sure if I should say this, but I felt, for just a
    moment, that I was part of "The Hitchhicker's Guide to the Galaxy"
    (the TV version, not the book or radio - which I have yet to hear).

    I'm hoping that you were trying to be a little humorous in your post.
    If not, my appologies in advance.

    Jim
     
    James Willmore, Aug 18, 2003
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. n00m
    Replies:
    12
    Views:
    1,141
  2. vamsi
    Replies:
    21
    Views:
    2,148
    Keith Thompson
    Mar 9, 2009
  3. Replies:
    2
    Views:
    199
    Big and Blue
    Nov 2, 2006
  4. recursive perl

    , Mar 10, 2010, in forum: Perl Misc
    Replies:
    1
    Views:
    83
    RedGrittyBrick
    Mar 10, 2010
  5. Dilbert
    Replies:
    0
    Views:
    872
    Dilbert
    Nov 10, 2011
Loading...

Share This Page