Yo!
Say I have a base class, which I want another class to extend.
In that base class, I'd like to propagate a use'd lib into the class which is extending it... how would I do this?
Sorry, for some reason I"m really having a tough time figuring out how to word this to make sense...
Here's a really terse example which will hopefully make things clearer:
package Base; #use base qw( Carp ); # don't want to do that... use Carp; sub new { # do stuff, blah - you know the routine } package Foo; use base qw( Base ); # ... no good, don't wanna do '$self->carp' #sub some_method { my $self = shift; $self->carp("died") } # would rather just call it normaly, as if it were # use'd directly from within this package: sub some_method { my $self = shift; carp "died" }
Thanks!
Also, while I'm here - one other oop perl thing that's had me stumped for awhile.
So, I'm use'ing a really long-ass class path:
#!/usr/bin/perl use strict; use MyLibs::ForSome::Particular::Thing; # ugh! #my $fubar = MyLibs::ForSome::Particular::Thing->new() # how about: my $fubar = Thing->new(); # ???
Is it convieniently possible to do such a thing? It's a pet peeve of mine.
Beers!
Corey
In reply to seamlessly use an extended class's use'd libs by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |