in reply to Can't use undefined value as an ARRAY reference

There are at least three places in the code you demonstrated where that module is treating a scalar like an array reference. In the code you posted, that happens twice on line 8, and once on line 18. We don't know if what you posted is line 995, or line 1017 from the module... and I don't really feel like pulling the module into an editor to find out.... that's your job. ;)

I do know that the source code for that module currently on CPAN looks slightly different from what you posted, which indicates to me that you may not be using the most up-to-date version. The first difference I noticed is that the current version doesn't have the commented-out section of code that starts with # OLD PERL WINXP

So you're probably not running the most recent (v0.35, from 2008!) version of the module. Either that, or you have, or someone has modified the source of the version you are using.

We also know nothing about the context in which you're getting this error. What code is calling this module? And how was the module installed? Is it possible that some components are missing? What is different between your old Win system and your new one?

It's a very difficult question to answer because of the absence of information provided to us. But I would be asking myself why the version of the module I'm using looks different (even if just superficially) than the six year old (newest) version on CPAN.


Dave

Replies are listed 'Best First'.
Re^2: Can't use undefined value as an ARRAY reference
by PilotinControl (Pilgrim) on Mar 15, 2014 at 17:15 UTC

    Below are the particulars:
    Computer 1: WinXP, Perl 5.10.0 Activestate, PDF-Reuse v35
    Computer 2: Win7, Perl 5.16.3 Activestate, PDF-Reuse v35
    Modules were installed using a mixture of PPM and CPAN

    WINXP REUSE PM UN EDITED $stream = ''; my $tSida = $sida + 1; if ((@annots) || (defined @{$links{'-1'}}) || (defined @{$links{$tSida}})) { $sidObjekt .= '/Annots ' . mergeLinks() . ' 0 R'; } if (defined $AAPageSaved) { $sidObjekt .= "/AA $AAPageSaved"; undef $AAPageSaved; } $sidObjekt .= ">>endobj\n"; $objekt[$sidObjNr] = $pos; $pos += syswrite UTFIL, $sidObjekt; push @{$kids[0]}, $sidObjNr; $sida++; $counts[0]++; if ($counts[0] > 9) { ordnaNoder(8); } } sub prEnd { if (! $pos) { return; } if ($stream) { skrivSida(); } skrivUtNoder(); if($docProxy) { $docProxy->write_objects; undef $docProxy; # Break circular refs }

    Windows 7 code edited using a suggestion from a fellow monk which fixed the error regarding a symbol reference.

    $stream = ''; my $tSida = $sida + 1; #if ((@annots) #|| (defined @{$links{'-1'}}) #|| (defined @{$links{$tSida}})) if(@annots || @{$links{'-1'}} || @{links{$tSida}} ) # LINE 995 { $sidObjekt .= '/Annots ' . mergeLinks() . ' 0 R'; } if (defined $AAPageSaved) { $sidObjekt .= "/AA $AAPageSaved"; undef $AAPageSaved; } $sidObjekt .= ">>endobj\n"; $objekt[$sidObjNr] = $pos; $pos += syswrite UTFIL, $sidObjekt; push @{$kids[0]}, $sidObjNr; $sida++; $counts[0]++; if ($counts[0] > 9) { ordnaNoder(8); } } sub prEnd { if (! $pos) { return; } if ($stream) # LINE 1017 { skrivSida(); } skrivUtNoder(); if($docProxy) { $docProxy->write_objects; undef $docProxy; # Break circular refs }

    And here is the code that is used to callback to the Reuse.pm in the script:

    prEnd;

      So your Perl version is different, for one thing. And you're installing it using a combination of PPM and cpan... seems odd. And you've modified the source code of the module, possibly without fully understanding what the modification is for. Those are at least three opportunities for trouble to creep in, without even considering the potential for bugs within the module itself.

      Speaking of which, I found this: RT#77800, which deals specifically with a problem that turns up under Perl 5.16.x and newer, relating to deprecation warnings... not the same type of warning you're getting, but definitely within the same code segment.

      I don't know the answer to the question I'm about to ask, because I do my best to avoid working with PDF's: Is it possible that there is a newer, better maintained module on CPAN that can be of use to you, that doesn't have bugs in its queue that are --in some cases-- several years old?

      Anyway, try rolling your Perl version back to an earlier version -- preferably the same version you're using on the old Windows machine -- and see if it works then. If so, you've found another bug to report, though I don't think anyone is monitoring the reports at this point.

      It sounds like you're using ActiveState. It appears that Perl-5.10.x is available from ActiveState for a fee. You might, instead, download the Strawberry Perl Perl v5.10.1 in a sandboxed dev environment and see if the module works under that Perl. If so, and if you still are required to use ActivePerl in production, you'll at least know whether or not its worthwhile investigating what ActiveState charges for 5.10.


      Dave

        I may have no choice than to backdate to Perl v5.10.0 as that version and everything works fine on WinXP. I had to use a mixture of PPM, CPAN, and Bribes as v5.10.0 gives that Authorization failed from Activestate with older versions of Perl when trying to download packages via PPM.