Hello all,
The following thread was part of a reply written a while back.
R. Joseph Newton <[EMAIL PROTECTED]> wrote:
:
: Gary Stainburn wrote:
:
: > sub new {
: > my $this=shift; # allow for CLASS->new()
: > my $class=ref($this) || $this; # or $obj->new();
:
: The docs that suggested this are in the process of being
: deprecated. It is not a good idea to have objects create
: other objects with new().
: I'll have more later on this, if others don't fill in the
: blanks in the meantime.
I didn't notice anyone filling in the blanks here. As a
practical exercise, I'll create an object oriented version of
File::Basename::fileparser(). I'll call the module
MyFileBasename.pm.
When writing the new constructor, do I just ignore $class
or is there some better (or more preferred) way to write it?
package MyFileBasename;
use File::Basename;
sub new {
my $class = shift;
my $self = {
file_name => undef,
base => undef,
path => undef,
type => undef,
};
bless $self;
$self->initialize( @_ ) if @_;
return $self;
}
TIA,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>