Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Re(6): Null objects in boolean context

by Ovid (Cardinal)
on Jan 01, 2004 at 23:13 UTC ( [id://318186]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      sub total_all_orders {
        my $self  = shift;
        my $total = 0;
        $total   += $order->total foreach $self->orders;
        return $total;
      }
    
  2. or download this
    package Null::Order;
    use base 'Null::Object';
    
    sub total { 0 }
    
    1;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-03-29 14:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found