Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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 imbibing at the Monastery: (7)
As of 2015-07-06 05:45 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 (70 votes), past polls