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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
It only makes sense if you're already familar with the syntax hack it supports, which isn't even in common usage! Hello maintainance nightmare.

In the code I've been dealing with it seems to be about a 50/50 split between those who do or don't use the idiom. Possibly the codebases I've been dealing with are biased but in my experience the idiom is in fairly common usage.

What happens if result() fails? Nothing! Maybe you get a warning, but you certainly don't get an error. It's much, much better if mutators croak() if they can't perform their duty. Then error checking is entirely optional, yet still available via eval{}.

While I feel that tye's proposal is a little too clever for it's own good - you would get an error if the method failed.

The method would return an error object on failure. This error object would not get evaluted in a boolean context. On GC the DESTROY method would then croak.

While it's not a strategy I'd use (sorry tye - not convinced ;-) you would get an error.

If you use an exception throwing style of error handling then it's not a problem at all.


In reply to Re^2: chaining method calls by adrianh
in thread chaining method calls by perrin

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 scrutinizing the Monastery: (3)
As of 2024-04-16 05:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found