Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: IO::Scalar vs IO::String

by hiseldl (Priest)
on Sep 13, 2002 at 13:51 UTC ( [id://197582]=note: print w/replies, xml ) Need Help??


in reply to IO::Scalar vs IO::String

If you need to use IO::Scalar in more than one place, and you want to keep IO::String in mind for later, you could wrap the call in a subroutine, and then if IO::Scalar is deprecated, or you just want to switch to IO::String, you can just change the one instance in your subroutine wrapper.

It adds the overhead of an extra subroutine call, but if I am relying on someone else's code, I have found it to be good practice to wrap it in my own method call so that later if the 3rd party code changes, I only have to change one place. The change can be to swap out the code for another 3rd party solution, or to write it myself.

--
hiseldl
"Act better than you feel"

Replies are listed 'Best First'.
Re: Re: IO::Scalar vs IO::String
by joe++ (Friar) on Sep 13, 2002 at 14:01 UTC
    Hello hiseldl,

    Thanks for the suggestion - but I need this trick inside my own module, and just in one place, so the module itself can be considered the "wrapper" in a way.

    My consideration is which module to use right now, just hoping someone who has experience with both of them to give the right suggestion.

    This really would be a no-brainer if one of these modules was part of Perl's core distribution (or considered to become part of is for that matter).

    Cheers,
    Joe

      My recommendation is to use IO::Scalar because it is more mature and from the pod

        Note: as of version 2.x, these classes all work like their IO::Handle counterparts, so we have comparable functionality to IO::String.

      it has similar functionality to IO::String, so using IO::Scalar seems to be a win-win.

      --
      hiseldl
      "Act better than you feel"

Log In?
Username:
Password:

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

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

    No recent polls found