Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: OO-style modifiers for 'sub' ?

by dpuu (Chaplain)
on Jan 24, 2003 at 20:58 UTC ( #229704=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub foo
    {
      my ($self) = @_;
      croak "..." unless ref($self) && $self->isa("AnInterface")
    }
    
  2. or download this
    sub foo # requires interfaces InterfaceA, InterfaceB
    {
    ...
      InterfaceA::validate($self);
      InterfaceB::validate($self);
    }
    
  3. or download this
    sub InterfaceA::validate
    {
    ...
      error unless $candidate->can("fn1"); # implicit ISA
      error unless $candidate->can("fn2");
    }
    
  4. or download this
    sub validate_object
    {
    ...
      my ($self) = @_;
      validate_object($self, map {"Interface$_"} qw/A B D/);
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2014-10-21 10:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (100 votes), past polls