SPUG: Long module names and perl "classes"?

Neko tgy at chocobo.org
Fri Sep 3 20:40:17 CDT 1999


On Fri, 3 Sep 1999, Andrew Sweger wrote:

> 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
> factory.
> 
> my $factory = new MyTopDir::MySubDir::MySubSubDir::MyObject;
> my $newobj = $factory->new;

'use strict' doesn't care.  The name of the class isn't being used as a
symbolic reference. 

#!/usr/bin/perl -w

use strict;

my $class = 'MyTopDir::MySubDir::MySubSubDir::MyObject';
$class->new->foo;

package MyTopDir::MySubDir::MySubSubDir::MyObject;

sub new { bless [], shift }
sub foo { print "FOO\n" }

__END__
FOO


-- 
perl -MLWP::IO -pe1 'data:text/signature,
%57%69%6c%6c%20%68%61%63%6b%20%50%65%72%6c%20%66%6f%72%20%61%20
%6d%6f%6f%67%6c%65%20%73%74%75%66%66%79%21%20%3d%5e%2e%5e%3d%0a'



 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    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 mailing list