Gay, Jerry on 26 Jan 2004 21:14:36 -0000

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

RE: perl DBI question

whoa, silly me. you do have a hash reference.

have you dumped the hash reference to make sure the value for the 'some' key
is defined?

    use Data::Dumper; $Data::Dumper::Indent= 1;
    print Dumper $hash; exit;

might help.

then again... since the variable is tied, it might be the cause of the
problem. you say assigning the value to a temp variable causes the problem
to disappear, but accessing the value doesn't work.

you might be able to create an anonymous temp variable to get around it,
something like:

    my $quoted= $dbh->quote( ${ \$hash->{'some'} } );

but i'd be surprised if i'm not wrong ;)

DBI has been used so often, by so many, that if there's a bug in the quoting
function when using tied variables, i'd expect it's been discovered and
fixed already. but it's probably worth it to have a look at the source for
quote, as phil suggested.


> -----Original Message-----
> From: Malcolm []
> Sent: Monday, January 26, 2004 4:01 PM
> To:
> Subject: Re: perl DBI question
> On Monday 26 Jan 2004 3:50 pm, Gay, Jerry wrote:
> > > my $quoted = $dbh->quote($hash->{'some'});
> > here, you're using $hash as a reference to a hash. instead, try:
> > my $quoted= $dbh->quote( $hash{some} );
> That doesn't work. There's no %hash defined (as I have "use 
> strict", it 
> doesn't even compile). 
> Technically
>  my $hash = {'some'=>'data'};
> is actually closer to:
> sub get_session
> {
>   tie %session, 'Apache::Session::MySQL', $sessionId,
>   {
>      'Handle'     => $dbh,
>      'LockHandle' => $dbh,
>    };
>    return \%session;
> };
> my $session = get_session();
> but I don't think the simplification changes anything.
> -
> **Majordomo list services provided by PANIX 
> <URL:>**
> **To Unsubscribe, send "unsubscribe phl" to**

This e-mail and any files transmitted with it may contain privileged or 
confidential information. It is solely for use by the individual for whom 
it is intended, even if addressed incorrectly. If you received this e-mail 
in error, please notify the sender; do not disclose, copy, distribute, or 
take any action in reliance on the contents of this information; and delete 
it from your system. Any other use of this e-mail is prohibited. Thank you 
for your compliance.

**Majordomo list services provided by PANIX <URL:>**
**To Unsubscribe, send "unsubscribe phl" to**