fireartist has asked for the wisdom of the Perl Monks concerning the following question:
Below is an extract from the module to show exactly what I've done, and an explanation of what I'd like to achieve.
The module is used like so,package SQL::Builder::Select; use strict; use warnings; use Exporter; use Carp; use vars qw / $VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS /; $VERSION = 1.00; @ISA = qw/ Exporter /; @EXPORT_OK = qw / new column table /; sub new { my $proto = shift; my $class = ref($proto) || $proto; my $self = {}; bless ($self, $class); return $self; } sub column { my $self = shift; my $count = @_; for (@_) { push @{$self->{column}}, $_; } return $count; } sub table { my $self = shift; for (@_) { push @{$self->{table}}, $_; } } 1;
my $select = new SQL::Builder::Select; $select->column( @cols ); $select->table( @tables );
I'd prefer if it didn't require changes in the use, as I'm already using this module in my code, but if it's worth it, then ok.
Any suggestions or help at all would be most appreciated, thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: abstraction - reusing OO module subs
by dws (Chancellor) on Nov 21, 2002 at 09:39 UTC | |
|
Re: abstraction - reusing OO module subs
by djantzen (Priest) on Nov 21, 2002 at 09:33 UTC | |
by fireartist (Chaplain) on Nov 21, 2002 at 09:57 UTC | |
by djantzen (Priest) on Nov 21, 2002 at 10:12 UTC | |
|
Re: abstraction - reusing OO module subs
by tomhukins (Curate) on Nov 21, 2002 at 10:28 UTC | |
|
Re: abstraction - reusing OO module subs
by UnderMine (Friar) on Nov 21, 2002 at 10:26 UTC | |
by chromatic (Archbishop) on Nov 21, 2002 at 20:20 UTC |