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

Re: The Very::Long::Class::Name problem

by broquaint (Abbot)
on Oct 14, 2003 at 00:37 UTC ( #298987=note: print w/replies, xml ) Need Help??


in reply to The Very::Long::Class::Name problem

For something a little closer to python's import Class as Alias set up the import() routine to create an alias e.g
sub import { my($pkg, %args) = @_; return unless exists $args{as} and length $args{as}; croak "Glob '$args{as}' already exists" if defined *{$args{as}}; *{"$args{as}\::"} = *{"$pkg\::"}; } ## usage use Very::Long::Class::Name ( as => 'Name' ); my $obj = Name->new;
Or, you could take the modular approach and use Package::Alias e.g
use Very::Long::Class::Name; use Package::Alias ( Name => 'Very::Long::Class::Name' );
HTH

_________
broquaint

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://298987]
help
Chatterbox?
[holli]: instant cat fame
[virtualsue]: nice photo
[holli]: the fricking beast will only eat dry food
[holli]: nothing else, not even minced meat or fish
[Discipulus]: see you nuns and monks!
[KurtZ]: mice?
[Discipulus]: your cat is dryarian holli

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2017-11-21 12:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (300 votes). Check out past polls.

    Notices?