For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > June 2005 > Attempt to free unreferenced scalar









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Attempt to free unreferenced scalar
Ing. Branislav Gerzo

2005-06-07, 8:56 am

Hi all,

I get error:
Attempt to free unreferenced scalar: SV 0x1e166a0, Perl interpreter: 0x3417c at
D:/Perl/lib/Errno.pm line 15.
while running this script, could anybody helps me ?

use strict;
use warnings;
use DBI;
use WWW::Mechanize;

my $dbh = DBI->connect(" DBI:mysql:database=test;host=localhost;p
ort=3306", "2ge", "",
{RaiseError => 1} ) or die "Can't connect: ", $DBI::errstr;

my $mech = WWW::Mechanize->new();
mech->agent_alias('Windows IE 6');

my $sth_get_links = qq{ select id, url from links
where follow = 1
limit 1
};

my $a = $dbh->selectall_hashref($sth_get_links, 'id');
while ( my($link_id, $value) = each(%$a) ) {
print "getting $value->{url}\n";
$mech->get( $value->{url} );
}
$dbh->disconnect;
__END__

for me it seems, that DBI and W::M doesn't like each other.

Thanks for any idea how to fix this

/brano

Octavian Rasnita

2005-06-07, 8:56 am

Hi,

I had the same problem and I don't know why, but I have discovered that if I
don't use $sth->fetchall_hashref('key') but another method, the script
doesn't gives errors anymore.

So I needed to use fetchrow_hashref() for each row instead.

Teddy

----- Original Message -----
From: "Ing. Branislav Gerzo" <konfera@2ge.us>
To: <beginners@perl.org>
Sent: Tuesday, June 07, 2005 12:31 PM
Subject: Attempt to free unreferenced scalar


> Hi all,
>
> I get error:
> Attempt to free unreferenced scalar: SV 0x1e166a0, Perl interpreter:

0x3417c at
> D:/Perl/lib/Errno.pm line 15.
> while running this script, could anybody helps me ?
>
> use strict;
> use warnings;
> use DBI;
> use WWW::Mechanize;
>
> my $dbh = DBI->connect(" DBI:mysql:database=test;host=localhost;p
ort=3306",

"2ge", "",
> {RaiseError => 1} ) or die "Can't connect: ", $DBI::errstr;
>
> my $mech = WWW::Mechanize->new();
> mech->agent_alias('Windows IE 6');
>
> my $sth_get_links = qq{ select id, url from links
> where follow = 1
> limit 1
> };
>
> my $a = $dbh->selectall_hashref($sth_get_links, 'id');
> while ( my($link_id, $value) = each(%$a) ) {
> print "getting $value->{url}\n";
> $mech->get( $value->{url} );
> }
> $dbh->disconnect;
> __END__
>
> for me it seems, that DBI and W::M doesn't like each other.
>
> Thanks for any idea how to fix this
>
> /brano
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>


Ing. Branislav Gerzo

2005-06-07, 8:56 am

Octavian Rasnita [OR], on Tuesday, June 7, 2005 at 13:01 (+0300) wrote
about :

OR> I had the same problem and I don't know why, but I have discovered that if I
OR> don't use $sth->fetchall_hashref('key') but another method, the script
OR> doesn't gives errors anymore.
OR> So I needed to use fetchrow_hashref() for each row instead.

Interesting, but it tends me to the same. Should we report this
strange behaviour to DBI ?

Thanks.

--

How do you protect mail on web? I use http://www.2pu.net

[My foolish parents taught me to read and write.]


Octavian Rasnita

2005-06-07, 8:56 am

Yes, I also think it is a bug in DBI, but I don't know where to report it.

If you could do it, I think it would be helpful for all of us.

Thanks.

Teddy

----- Original Message -----
From: "Ing. Branislav Gerzo" <konfera@2ge.us>
To: <beginners@perl.org>
Sent: Tuesday, June 07, 2005 1:07 PM
Subject: Re: Attempt to free unreferenced scalar


> Octavian Rasnita [OR], on Tuesday, June 7, 2005 at 13:01 (+0300) wrote
> about :
>
> OR> I had the same problem and I don't know why, but I have discovered

that if I
> OR> don't use $sth->fetchall_hashref('key') but another method, the script
> OR> doesn't gives errors anymore.
> OR> So I needed to use fetchrow_hashref() for each row instead.
>
> Interesting, but it tends me to the same. Should we report this
> strange behaviour to DBI ?
>
> Thanks.
>
> --
>
> How do you protect mail on web? I use http://www.2pu.net
>
> [My foolish parents taught me to read and write.]
>
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com