Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^5: Device::USB gives "Use of uninitialized value in concatenation" error

by Eliya (Vicar)
on Dec 11, 2013 at 01:07 UTC ( #1066534=note: print w/replies, xml ) Need Help??


in reply to Re^4: Device::USB gives "Use of uninitialized value in concatenation" error
in thread Device::USB gives "Use of uninitialized value in concatenation" error

I'll need to determine what they are supposed to be.

I don't think they have to be set to anything. The idea presumably is that in case they are set they should be appended to whatever CCFLAGS / LDDLFLAGS options have been determined via %Config...

IMHO, the code should either test if those vars are defined before interpolating them, or disable warnings :)

As for your update:

from what I can tell, every ENV variable is assigned something, Why are there still 3 concatenation errors?

If you set them within the Perl source, you'll need to set them in a BEGIN { } block, because due to the use Inine (...) statement, they're being evaluated at compile time of the Perl code.

... BEGIN { $ENV{CFLAGS} = ''; $ENV{CPPFLAGS} = ''; $ENV{LDFLAGS} = ''; } use Inline ( ... ... ); ...

Replies are listed 'Best First'.
Re^6: Device::USB gives "Use of uninitialized value in concatenation" error
by holandes777 (Beadle) on Dec 11, 2013 at 01:20 UTC

    I don't know if the warnings have anything to do with it, but this code:

    1 use Device::USB; 2 3 $usb = Device::USB->new(); 4 $dev = $usb->find_device('0403', '6001'); 5 printf("Device: %04X:%04X\n", $dev->idVendor(), $dev->idProduct( +)); 6 $dev->open(); 7 print "Manufactured by: $dev->manufacturer()\n"; 8 print "Product: $dev->product()\n";

    gives the concatenation warnings plus:

    Can't call method "idVendor" on an undefined value at kk.pl line 5, <D +ATA> line 1.

    Here is the part of dmesg that applies

    [349416.436284] usb 4-2: new full-speed USB device number 3 using uhci +_hcd [349416.634282] usb 4-2: New USB device found, idVendor=0403, idProduc +t=6001 [349416.634294] usb 4-2: New USB device strings: Mfr=1, Product=2, Ser +ialNumber=3 [349416.634302] usb 4-2: Product: FT232R USB UART [349416.634309] usb 4-2: Manufacturer: FTDI [349416.634316] usb 4-2: SerialNumber: A100X16Z [349416.642482] ftdi_sio 4-2:1.0: FTDI USB Serial Device converter det +ected [349416.642595] usb 4-2: Detected FT232RL [349416.642603] usb 4-2: Number of endpoints 2 [349416.642610] usb 4-2: Endpoint 1 MaxPacketSize 64 [349416.642618] usb 4-2: Endpoint 2 MaxPacketSize 64 [349416.642624] usb 4-2: Setting MaxPacketSize 64 [349416.644397] usb 4-2: FTDI USB Serial Device converter now attached + to ttyUSB0

    OK, SLAM ON THE BRAKES: I jumped onto my Ubuntu 13.04 box and ran the same code. It asked for Device::USB. I installed it correcly by using apt-get install libdevice-usb-perl. The warnings went away and all I still have left is the error: "Can't call method "idVendor" on an undefined value at kk.pl line 5, <DATA> line 1." which is probably due to my lack of knowledge so I have to go study this. Thanks for your help and the lesson here is: IF YOU'RE USING UBUNTU, AVOID CPAN!!"

      In fact, the main lesson is "Leave to Caesar what belongs to Caesar".

      The version of Perl distributed by your vendor should always only be changed through the package manager of the vendor. That is, on Ubuntu, only install Ubuntu packages into the Ubuntu Perl. If you've compiled your own Perl, use whatever CPAN client you like, of course.

      On Ubuntu 13.10 with libdevice-usb-perl via apt the problem still presists. Perhaps when you installed the package via apt you got an older version of the module that worked.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1066534]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2018-01-17 13:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (200 votes). Check out past polls.

    Notices?