|
strict subs error when using annonymous array: msg#00157web.mason.user
Hello everyone, I'm trying to strip out some arguments from %ARGS for use in a component that passes them to the dbi_save_from_hash in the MHQ::DBI module. Here's my code: # Tried to do it as one line here...same error #my %updateflds = map { $_ => $ARGS{$_} } qw(freq class serviceco store); my @flds = qw(freq class serviceco store); my %updateflds = map { $_ => $ARGS{$_} } @flds; my $rv = dbi_save_from_hash($dbh, "stores", "store", %updateflds); Here's the error I'm getting from Mason: error: Can't use string ("serviceco") as a HASH ref while "strict refs" in use at /var/www/html/mason/lib/KO/DBI.pm line 168. context: ... 164: } 165: 166: sub dbi_save_from_hash { 167: my ($dbh, $table, $primaryKey, $rowRef) = @_; 168: my %row = %$rowRef; 169: if (exists($row{$primaryKey}) and dbi_exists($dbh, "select $primaryKey from $table where $primaryKey = ?", $row{$primaryKey})) { 170: my $primaryValue = $row{$primaryKey}; 171: delete($row{$primaryKey}); 172: dbi_update_from_hash($dbh, $table, $rowRef, "$primaryKey = ?", $primaryValue); ... code stack: /var/www/html/mason/lib/KO/DBI.pm:168 /var/www/html/mason/riteaidivr/update.mhtml:12 /var/www/html/mason/riteaidivr/autohandler:19 I did a "perldoc strict refs" and didn't get any examples of either anonymous arrays or just a plain old array. I'm aware of the <%args> tag, but I'd still have to place the data in an array and do it like this (I think, haven't tried it yet - kinda bankin' on doing it the other way): <%args> $freq $store $serviceco $class </%args> my %updateflds = ( freq => $freq, store => $store, serviceco => $serviceco, class => $class ); Any ideas what I can do? Thanks, Kevin -- K Old <kold@xxxxxxxxxxxxxxxxxx> ------------------------------------------------------- This SF.net email is sponsored by Dice.com. Did you know that Dice has over 25,000 tech jobs available today? From careers in IT to Engineering to Tech Sales, Dice has tech jobs from the best hiring companies. http://www.dice.com/index.epl?rel_code=104 |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: A "catch-all" component?: 00157, Marc Logghe |
|---|---|
| Next by Date: | Re: strict subs error when using annonymous array: 00157, Ken Williams |
| Previous by Thread: | A "catch-all" component?i: 00157, Egor Shipovalov |
| Next by Thread: | Re: strict subs error when using annonymous array: 00157, Ken Williams |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |