Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: copying files through modules

by peeeeeeeeeeete (Initiate)
on May 19, 2005 at 01:58 UTC ( [id://458484]=note: print w/replies, xml ) Need Help??


in reply to Re: copying files through modules
in thread copying files through modules

hi Guys, Sorry abt my previous post. basically what i want to do is write a module that contains a function that returns an open filehandle at the begining of a file which i want to copy to a location specified in my local script. i'm not sure how to return a filehandle. i also dont know how i can accept a filehandle in the script. i tried this but it wouldn't work coz i use strict. copy.txt is the filename which i want to save it as. open OUTF, '>copy.txt; OUTF = MyModule::Myfunction; thanks for the help

Replies are listed 'Best First'.
Re^3: copying files through modules
by davido (Cardinal) on May 19, 2005 at 02:29 UTC

    Would it be possible to, instead of describing a problem, actually demonstrate the code you're having trouble with? Not all 1000 lines, mind you. Create a 20-line (or less) snippet that isolates and illustrates your question. I'm starting to see what you're asking, but when you start saying things like "i also don't know how i can accept a filehandle in the script", that could have several meanings.


    Dave

      hey, heres some code... MyMopule.pm .... .... copyFile { ... ... return aFilehandle } 1; script.pl use MyModule; my $FILE = MyModule::copyfile; $file is a handle to the file i'm copying how do i save it? thanks

        You've got me. I have no idea, since you didn't post anything close to resembling code. I cannot guess what MyModule.pm contains, and I cannot guess how it works. You cannot just save a filehandle; I can tell you that much. A filehandle is a sort of link to a file or data stream that has been opened, either for input, for output, for append, or one of several other operations. If you've been handed a filehandle, my guess is that you would first open an output filehandle too, and then from the filehandle you've been handed by MyModule you would start reading from it using the diamond operator. Then as you read each line from it, you would start writing each line to your output filehandle.

        You haven't posted any code to help me give you additional guidance, and thus, I don't have any context for which I would be able to provide any code examples either. Sorry. Try perlopentut and open for starters.


        Dave

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2025-02-18 05:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found