[email protected]
Posts: 5
Joined: Thu Jun 21, 2012 10:34 am

Perl: Use of uninitialized value $path

Tue Jul 17, 2012 4:35 pm

Hi

I have been stuck on this for days and cannot figure out what is wrong. Whenever I try to install any Perl module I get multiple errors. I am doing the following:
sudo perl -MCPAN -e shell
install XML::Parser

Everything is retrieved from the web fine and then it starts the build process. Then I get hundreds of these messages, two lines repeated:

Code: Select all

Use of uninitialized value $_[0] in join or string at /usr/share/perl/5.10/File/Spec/Unix.pm line 41.
Use of uninitialized value $path in pattern match (m//) at /usr/share/perl/5.10/File/Spec/Unix.pm line 121.
Eventually it shows:

Code: Select all

CPAN: File::Temp loaded ok (v0.22)

  CPAN.pm: Going to build T/TO/TODDR/XML-Parser-2.41.tar.gz

Warning: No success on command[/usr/bin/perl Makefile.PL INSTALLDIRS=site]
Warning (usually harmless): 'YAML' not installed, will not store persistent state
  TODDR/XML-Parser-2.41.tar.gz
  /usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK
Running make test
  Make had some problems, won't test
Running make install
  Make had some problems, won't install
Could not read '/root/.cpan/build/XML-Parser-2.41-c8FOyX/META.yml'. Falling back to other methods to determine prerequisites
Failed during this command:
 TODDR/XML-Parser-2.41.tar.gz                 : writemakefile NO '/usr/bin/perl Makefile.PL INSTALLDIRS=site' returned status -1
My Pi is built from the standard Debian image and fully updated. I have tried updating CPAN and installing YAML and I get the same errors. Just simply using 'cpan' results in the same errors.

I am using a user account that I added to the Pi, but using the default 'pi' account produces the same messages.

I thought maybe it has to do with the path variable. This is mine:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Any ideas? I am surprised no one else has mentioned this already.

Mark

Gibble
Posts: 56
Joined: Wed May 09, 2012 9:52 am

Re: Perl: Use of uninitialized value $path

Tue Jul 17, 2012 7:46 pm

I had problems with cpan, too many to persist with, some relating to memory and it locking up. I ended up using cpanminus which seemed to work a lot better anyway than normal for me...I'm not at a Pi atm, but this is what I did on my lappy to get it going, and I think commands will be similar...

sudo apt-get install curl
sudo curl -L http://cpanmin.us | perl - --sudo App::cpanminus
sudo cpanm XML::Parser

Once the first two commands are sorted, you can just use cpanm <package>
The first line just installs curl which allows you to get files remote easy.

[email protected]
Posts: 5
Joined: Thu Jun 21, 2012 10:34 am

Re: Perl: Use of uninitialized value $path

Tue Jul 17, 2012 9:26 pm

Hi,

Thanks for that. I had seen the answer given elsewhere. The install took a very long time to complete, the process must have asked for my password 25 times!

I am afraid to say I get similar errors. After I try: sudo cpanm XML::Parser, I get this:

Code: Select all

--> Working on XML::Parser
Fetching http://www.cpan.org/authors/id/T/TO/TODDR/XML-Parser-2.41.tar.gz ... OK
Configuring XML-Parser-2.41 ... OK
Building and testing XML-Parser-2.41 ... FAIL
! Installing XML::Parser failed. See /root/.cpanm/build.log for details
The last few lines of that log file are, that log file is very long btw:

Code: Select all

make[1]: *** [Expat.o] Error 1
make[1]: Leaving directory `/root/.cpanm/work/1342559674.6738/XML-Parser-2.41/Expat'
make: *** [subdirs] Error 2
-> FAIL Installing XML::Parser failed. See /root/.cpanm/build.log for details.
A 'sudo ls -l /root/.cpanm/' shows:

Code: Select all

-rw-r--r-- 1 root root 55520 Jul 17 22:15 build.log
lrwxrwxrwx 1 root root    33 Jul 17 22:14 latest-build -> /root/.cpanm/work/1342559674.6738
drwxr-xr-x 4 root root  4096 Jul 17 22:14 work
The '/root/.cpanm/work' folder contains many folders with source code.

At the moment I am still looking for an answer.

Mark

Gibble
Posts: 56
Joined: Wed May 09, 2012 9:52 am

Re: Perl: Use of uninitialized value $path

Wed Jul 18, 2012 11:58 am

make sure you have the expat headers...

sudo apt-get install libexpat1-dev

If it still doesn't work, assuming you have the above, you can
wget http://search.cpan.org/CPAN/authors/id/ ... .36.tar.gz
tar zxvf XML-Parser-2.36.tar.gz
cd XML-Parser-2.36
perl Makefile.PL
make
make install

or something like that

User avatar
jojopi
Posts: 3146
Joined: Tue Oct 11, 2011 8:38 pm

Re: Perl: Use of uninitialized value $path

Wed Jul 18, 2012 2:59 pm

[email protected] wrote:Use of uninitialized value $_[0] in join or string at /usr/share/perl/5.10/File/Spec/Unix.pm line 41.
Use of uninitialized value $path in pattern match (m//) at /usr/share/perl/5.10/File/Spec/Unix.pm line 121.
These errors go away if you "sudo swapon /dev/mmcblk0p3" before the cpan. So it seems somehow related to running out of memory (and not giving a proper diagnostic).

Is not the best way to install XML::Parser on Debian: "sudo apt-get install libxml-parser-perl" ?

[email protected]
Posts: 5
Joined: Thu Jun 21, 2012 10:34 am

Re: Perl: Use of uninitialized value $path

Wed Jul 18, 2012 3:03 pm

Ah, that is interesting.

I accidentally deleted the swap partition when I was resizing the root partition. I will give your suggestions a try later today.

davesedar
Posts: 31
Joined: Mon Mar 05, 2012 3:41 pm

Re: Perl: Use of uninitialized value $path

Fri Jul 20, 2012 7:58 am

Successfully installed cpanm on Raspberry Pi using clean install of raspbian,
but 'sudo cpanm XML::Parser'
fails to Configure.
/root/.cpanm/build.log contains the line 'Couldn't find your C compiler'
does it actually have one?

davesedar
Posts: 31
Joined: Mon Mar 05, 2012 3:41 pm

Re: Perl: Use of uninitialized value $path

Fri Jul 20, 2012 8:29 am

ploughing on regardless..
cpanm Math::Trig worked fine
cpanm Time::HiRies failed to find the C compiler
cpanm Device::SerialPort --verbose failed with:
  • checking definition of B2500000... found
    checking definition of B3000000... found
    checking definition of B3500000... found
    checking definition of B4000000... found
    checking serial control via ioctl... yes
    checking read/write of RTS signal... yes
    checking read/write of DTR signal... yes
    checking read access to modem lines... yes
    checking read access to buffer status... yes
    checking read access to serial line status... yes
    checking normal CTS/RTS flow control... yes
    configure: creating ./config.status
    config.status: creating config.h
    Checking if your kit is complete...
    Looks good
    Writing Makefile for Device::SerialPort
    Writing MYMETA.yml

    You're ready to run 'make' now...
    OK
    Checking dependencies from MYMETA.yml ...
    Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.57_05)
    Checking if you have Test::More 0 ... Yes (0.98)
    Building and testing Device-SerialPort-1.04 ... cp SerialPort.pm blib/lib/Device/SerialPort.pm
    /usr/bin/perl /usr/share/perl/5.14/ExtUtils/xsubpp -typemap /usr/share/perl/5.14/ExtUtils/typemap SerialPort.xs > SerialPort.xsc && mv SerialPort.xsc SerialPort.c
    gcc-4.7 -c -I. -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fstack-protector -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -DVERSION=\"1.04\" -DXS_VERSION=\"1.04\" -fPIC "-I/usr/lib/perl/5.14/CORE" SerialPort.c
    /bin/sh: 1: gcc-4.7: not found
    make: *** [SerialPort.o] Error 127
    FAIL
    ! Installing Device::SerialPort failed. See /home/pi/.cpanm/build.log for details.
Any help appreciated

subogero
Posts: 8
Joined: Wed Dec 19, 2012 12:03 pm
Location: Budapest
Contact: Website

Re: Perl: Use of uninitialized value $path

Wed Dec 19, 2012 12:35 pm

Don't use CPAN at all. Most known Perl modules are packaged by Raspbian, so install them with apt-get.
The challenge: find out which deb package your module belongs to.
Your module is called XML::Parser, so it's stored as a /usr/.../XML/Parser.pm file.

Code: Select all

apt-get install apt-file
apt-file update
apt-file search XML/Parser.pm
And voilá:
libxml-parser-perl: /usr/lib/perl5/XML/Parser.pm
And then:

Code: Select all

apt-get install libxml-parser-perl
You're done.

Return to “Other programming languages”