>>>>> "David" == David Wheeler <[EMAIL PROTECTED]> writes:

David> So by shoving a constant into DBI::Shell::Base before loading  
DBI::Shell, I
David> convince it to use my subclass, instead.

And this is why you should avoid hard-coded classnames in classes you
create.  Instead of calling:

        package My::Class;

        sub mumble_method {
                my $self = shift;
                ...
                my $helper = My::Helper::Class->new(...);
                ...
        }

You should be doing:

        package My::Class;

        sub mumble_method {
                my $self = shift;
                ...
                my $helper = $self->helper_class->new(...);
                ...
        }

        sub helper_class {
                "My::Helper::Class";
        }

By factoring out the "constant", this can be overriden in
subclasses of My::Class.  Yeay.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[email protected]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Reply via email to