Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Should Modules Do I/O?

by duct_tape (Hermit)
on Mar 18, 2005 at 16:33 UTC ( [id://440735]=note: print w/replies, xml ) Need Help??


in reply to Should Modules Do I/O?

I personally do not see a problem with the module doing the i/o as long as it does proper error handling. Having an interface that it easy to use will make it more useful to people.

One idea is that you routines could expect different parameters depending on how the user wants to handle the i/o. For example someone could pass you in a string with the file name if they don't care if you do the i/o. Or they could pass in existing filehandles if they want to handle it themself.

And finally one other thing that could be done is to have the method(s) return the data, but then also provide methods that will deal with reading and writing the data as well. That way they are not forced to use your i/o handling, but instead can add an extra line or two of code to use it.

Log In?
Username:
Password:

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

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

    No recent polls found