Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Okay, so even though STDOUT is, by default, a blessed IO::Handle object, and thus possesses the methods described, perl needs to be directed to the IO::Handle module via the 'use' statement so it can find the definitions for those methods. Does that sum it up correctly?

Unfortunately, it's all wrong.

  • STDOUT isn't blessed. It's not a reference, so it can't be blessed. Globs only act as if they are blessed references.

  • Given a blessed reference or a glob, Perl knows where to look for the methods. For globs, it looks in the IO::Handle namespace.

  • Loading a module doesn't help Perl find anything. It typically loads subroutines. IO::Handle is no exception.

Perl knows where to look for the method (as indicated by the error message), but there's nothing to find (as indicated in the error message) because IO::Handle wasn't loaded (which isn't indicated in the error message).


In reply to Re^5: Regarding STDOUT and indirect object notation for print by ikegami
in thread Regarding STDOUT and indirect object notation for print by romandas

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-03-28 22:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found