in reply to Perl OO: switch package context.

You could create a package named Class.pm under a directory hierarchy like this: My/Package (My/Package/Class.pm) and then use the class like this:

#!/usr/bin/perl -w # ./test_class.pl use strict; use My::Package::Class; my $c = Class->new("arg"); print ref($c)."\n";

The package should be named Class instead of My::Package::Class.
# ./My/Package/Class.pm package Class; use strict; sub new { my $class = shift; my $self = { data => shift, }; return(bless($self,$class)); } 1;

I don't really know if this is what you are looking for but i hope you find this useful.


ignorance, the plague is everywhere
--guttermouth

Replies are listed 'Best First'.
Re^2: Perl OO: switch package context.
by water (Deacon) on May 14, 2005 at 20:30 UTC
    ...which would befuddle the heck out of anyone used to conventions. Yuck!

    water