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

Re: How do you Test that the right output got printed?

by mrborisguy (Hermit)
on Jul 27, 2005 at 18:18 UTC ( [id://478692]=note: print w/replies, xml ) Need Help??


in reply to How do you Test that the right output got printed?

Like jeffa said, you want status to return a value instead of printing. This not only makes it better for testing, but it's better OO practice in general. What if some time along the line, somebody wants to subclass your class, and wants to know the status. You're forcing them to print it out, but if you just return a value, then it's useable to them. Also it's not too much difficult, and more clear, to write:

print $status->status('good'); # instead of $status->status('good');

    -Bryan

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-19 20:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found