Re: Attempt to free unreferenced scalar
by jweed (Chaplain) on Feb 22, 2004 at 06:19 UTC
|
Well, the only problem I can see is your last line. Return is for subroutines, for modules you need only an expression that evaluates to one. Usually, we use just the number one. By itself.
Once I deleted the return it worked fine on my machine.
Update: seems I was wrong. see Mr. Muskrat's reply, below.
| [reply] |
|
|
| [reply] [d/l] |
|
|
Can't return outside a subroutine
perl -v:
This is perl, v5.9.0 built for i686-linux-thread-multi
5.8.3 gives me the same.
| [reply] [d/l] [select] |
|
|
Re: Attempt to free unreferenced scalar
by ambrus (Abbot) on Feb 22, 2004 at 13:30 UTC
|
Are you using threads in the program? This is actually a perl internal error which you should rarely see.
| [reply] |
Re: Attempt to free unreferenced scalar
by adrianh (Chancellor) on Feb 22, 2004 at 21:27 UTC
|
Compiles fine (once the bogus return was removed) on 5.8.3, Mac OS... don't have a win box to hand I'm afraid...
| [reply] |
|
|
| [reply] [d/l] |
|
|
From the discussion a while back on this forum, the return is no more bogus than any other return that's at the natural end anyway.
Hmmmm. When I run:
#! /usr/bin/perl
return 1;
perl tells me
Can't return outside a subroutine at return.pl line 2
So I guess the previous discussion was somewhat inaccurate.
Apologies that this is not help in solving your original problem.
| [reply] [d/l] [select] |
|
|
|
|
Re: Attempt to free unreferenced scalar
by meetraz (Hermit) on Feb 23, 2004 at 05:07 UTC
|
| [reply] |
|
|
When I save your code as 'VM_List.pm' and call it like this, it works fine:
use lib 'c:\temp';
use VM_List;
my @testarray = (1,2,3);
my $test = VM_List->create(\@testarray);
print "test=$test";
Although calling it with "-Wc" gives me:
v-string in use/require non-portable at c:\temp/VM_List.pm line 1.
So I believe that should be a 'require' instead of 'use'. And shouldn't your other use lines come after your package line? | [reply] [d/l] |
|
|
| [reply] |
Re: Attempt to free unreferenced scalar
by monachos (Initiate) on Mar 29, 2007 at 09:18 UTC
|
Hi, this is new territory for me.
I get the error “Attempt to free unreferenced scalar: SV 0x1ebc270, Perl interpreter: 0x223ff4 at lib/DBIx/Lite.pm line 277.”
The line in Lite.pm reads “$fh->print( join($args->{'column-separator'}, @FieldNames), $args->{'record-separator'});”
| [reply] |
|
|
This is an XS error and should appear if you apply
sv_2mortal to a scalar SV more then one time, like sv_2mortal(sv_2mortal(newSViv(0))).
| [reply] |