Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: A Better way? (Lots of routines with similar structure)

by greywolf (Priest)
on Jun 08, 2003 at 23:00 UTC ( #264177=note: print w/replies, xml ) Need Help??


in reply to A Better way? (Lots of routines with similar structure)

Without getting into any changes to the style of your code. It seems like you could have generic sub that can do both checking and adding if you pass your name and statement as arguments.
sub workItem { my $self = shift; my %args = @_; die "Must supply value for name" unless ($args{name}); die "Must supply value for statement" unless ($args{statement}); my $retval = $self->_execute( handle => 'appfme', statement => [ $args{statement} ], bindvar => [ $args{name} ], output => 1); }

Unless I missed something in your original code this should allow to check and add actors/directors/genre etc.

mr greywolf

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://264177]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2016-12-09 00:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (148 votes). Check out past polls.