SPUG: Long module names and perl "classes"?
andy at n2h2.com
Fri Sep 3 15:11:19 CDT 1999
Or if you're using strict (strict 'refs' specifically), you could make
sure that at least one of the classes is capable of acting as an object
my $factory = new MyTopDir::MySubDir::MySubSubDir::MyObject;
# then when you want a new MyObject
my $newobj = $factory->new;
You are using strict, aren't you?
On 09/03/99 @ 12:01, the infamous Abarbanel, Robert wrote:
:} You know those class-name-strings are just that, strings.
:} You can say $s = "MyTopDir::MySubDir::MySubSubDir::MyObject"
:} and then
:} $newobj = $s->new()
:} > ----------
:} > From: Joe Slagel[SMTP:slagel at geospiza.com]
:} > Sent: Friday, September 03, 1999 10:47 AM
:} > Does anyone have a cute way of dealing using long module
:} > names when referring to them as classes. I'm tired of
:} > typing really long
:} > "MyTopDir::MySubDir::MySubSubDir::MyObject->new()" every
:} > time I want to create a new object.
Andrew Sweger <andy at n2h2.com> | N2H2, Incorporated
v=206.336.2947 f=206.336.1541 | 900 Fourth Avenue, Suite 3400
"Intelligent Technologies For | Seattle WA 98164-1059
a Safe and Productive Internet" | http://www.n2h2.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
Email to majordomo at pm.org: ACTION spug-list your_address
More information about the spug-list