Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Pragma (more) like Java's 'import'?

by adrianh (Chancellor)
on May 24, 2003 at 16:45 UTC ( #260608=note: print w/replies, xml ) Need Help??


in reply to Pragma (more) like Java's 'import'?

If all your concerned about is long class names in calling OO code nobody seems to have mentioned the simplest option - just put the class name in a constant subroutine or a variable.

sub Very::Very::Very::Very::Long::Name::hello { my $class = shift; print "$class says hello\n" }; # old school way Very::Very::Very::Very::Long::Name->hello; # compile time constant sub works fine - but can be confusing to read use constant VVVVLN => 'Very::Very::Very::Very::Long::Name'; VVVVLN->hello; # I tend to just use a variable my $VVVVLN = 'Very::Very::Very::Very::Long::Name'; $VVVVLN->hello;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://260608]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2022-09-27 02:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (118 votes). Check out past polls.

    Notices?