Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

A working strategy to handle AUTOLOAD, can(), and (multiple) inheritance without touching UNIVERSAL?

by lodin (Hermit)
on Aug 29, 2009 at 16:58 UTC ( [id://792087]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    {
        package Foo;
    ...
        # autoloads foo()
        # autoloads bar()
    }
    
  2. or download this
        my $code = $obj->can('foo');
        $obj->$code(...)
    
  3. or download this
        $obj->foo(...)
    
  4. or download this
        AUTOLOAD {
            ...;
    ...
                croak("No method $method ...");
            }
        }
    
  5. or download this
        AUTOLOAD {
            ...;
    ...
                croak("No method $method ...");
            }
        }
    
  6. or download this
        AUTOLOAD {
            my $self = $_[0]; # Not shift, using goto.
    ...
                croak(...);
            }
        }
    
  7. or download this
        sub can {
            my ($self, $method) = @_; # Not shift, using goto.
    ...
    
            return $universal; # May be undefined.
        }
    
  8. or download this
        use Class::AUTOCAN sub {
            my $self = shift;
    ...
    
            return;
        };
    
  9. or download this
        Class::AUTOCAN->install(
            target => $pkg,
            code => sub { ... },
        );
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-24 01:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found