Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Short Refactoring Tip: let the object do it for you

by Ovid (Cardinal)
on May 19, 2003 at 21:31 UTC ( #259306=perlmeditation: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    if ($po->status->name eq 'Pending') {
        # po can be sent
    ...
    if ($po->status->name eq 'Pending' || $po->status->name eq 'Sent') {
        # po can be cancelled
    }
    
  2. or download this
    if ($po->can_send) {
        # po can be sent
    ...
    if ($po->can_cancel) {
        # po can be cancelled
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://259306]
Front-paged by diotalevi
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (11)
As of 2015-07-31 08:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (275 votes), past polls