in reply to DBI Style Inquiry
Generally, I do a my ($this, $that, $foo, $bar) = @_; at the start of my subs, rather than to access the @_ array directly. In case we’re talking about a method — where Perl will put the object as the first argument — it would go like this:
sub foo_method { my $self = shift; my ($this_arg, $that_arg, $whatever) = @_; ...; }
Another thing about DBI, I almost never use fetchrow_array anymore, but much more commonly use fetchrow_hashref which will allow you to refer to the returned columns by their names. Make sure to alias the columns with the SQL AS column_name phrase though.
Others have touched some other issues already, so I won’t repeat those.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: DBI Style Inquiry
by Tux (Canon) on Jun 27, 2013 at 12:08 UTC | |
by Ralesk (Pilgrim) on Jun 27, 2013 at 12:20 UTC | |
by erix (Prior) on Jun 28, 2013 at 12:14 UTC | |
by Tux (Canon) on Jun 28, 2013 at 12:42 UTC |