Boldra has asked for the wisdom of the Perl Monks concerning the following question:
but this would require my 'UI' package to 'use' or 'require' the class, which seems messy.my $ui = UI->new; $ui->query_dialog( { search_with => 'DB::File' } ); package UI; sub query_dialog { my( $self, $args ) =@_; print "Name? "; my $name = <STDIN>; my $search_class = $args->{search_with}; my @files = $search_class->search( { name => $name } ); ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: search methods as class methods?
by ELISHEVA (Prior) on Mar 02, 2009 at 11:48 UTC | |
by Boldra (Curate) on Mar 02, 2009 at 12:23 UTC | |
by Bloodnok (Vicar) on Mar 02, 2009 at 12:32 UTC | |
|
Re: search methods as class methods?
by moritz (Cardinal) on Mar 02, 2009 at 10:49 UTC | |
by Boldra (Curate) on Mar 02, 2009 at 11:01 UTC | |
|
Re: search methods as class methods?
by tilly (Archbishop) on Mar 02, 2009 at 14:46 UTC |