Chas Owens wrote:
> On 3/21/07, Mathew Snyder <[EMAIL PROTECTED]> wrote:
> snip
>>         my %customer = ${customer};
> snip
> 
> Hashes cannot be created with only one value, they must always be in
> pairs: key and value.  If  $customer has a type of HASH (you can put
> 
> print ref($customer), "\n";
> 
> in the code to check this) then you need to say
> 
> my %customer = %$customer;
> 
> to dereference the hashref
I'm under the impression that by assigning a single value to a hash it becomes
the key with the value being null.
.
> 
> snip
>>                 my %env = $transaction->Creator;
>>                 my %env = ${env};
> snip
>
> I have no idea why you are declaring %env twice.  I also don't know
> why you aren't getting an error due to the fact that $env is never
> declared.  I must assume this is not a direct copy of what you are
> working with.  If $transaction->Creator returns a list of key-value
> pairs then that line is fine; if it returns a hashref instead then you
> need to wrap it in %{} like this
>
Actually, the double declaration was a mistake that I had seen immediately after
posting last time. I took it out but the error didn't go away.


> my %env = %{$transaction->Creator};
> 
> snip
>>  $env{$user} = $transaction->TimeTaken;
> snip
> 
> Again, unless $transaction->TimeTaken returns a list of key-value
> pairs you have a problem here.
> 
> You should check your documentation to see what the return values of
> these methods are.
> 
I did as you said and dereferenced each of those methods.  Now, instead of
getting "5" in the error, I'm getting "72".  These numbers correspond to user
IDs.  I don't know why it is telling me "Can't use string ("72") as a HASH ref
while "strict refs" in use at ./user_timesheet_new.pl line 27."

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to