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

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

by adrianh (Chancellor)
on May 24, 2003 at 16:45 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-03-29 12:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found