Perl and recursive copying?

K

Kyle Witherspoon

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
 
T

Tore Aursand

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/.'?
 
J

James E Keenan

Kyle Witherspoon said:
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.
 
J

James Willmore

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
 
T

Tad McClellan

James Willmore said:
(e-mail address removed) (Tad McClellan) wrote in message
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
 
J

Jonathan Stowe

Tad McClellan said:
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\
 
J

James Willmore

Jonathan Stowe said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top