Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 chanting in the Monastery: (10)
As of 2014-09-16 21:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (48 votes), past polls