Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: how to debug an 'undef' that cannot be?

by greengaroo (Hermit)
on Mar 05, 2013 at 15:02 UTC ( #1021839=note: print w/ replies, xml ) Need Help??


in reply to how to debug an 'undef' that cannot be?

Just to re-phrase what my fellow monks already pointed out, your problem is that you have two different $dev variable. When you use "my" in front of a variable, its scope becomes the current block. In the main program it's not a problem but in a while loop like you did, or any other kind of blocks, the variable will cease to exists at the end of said block, and will be recreated for each iteration, and it will never alter the content of the original variable defined outside of this block.

In clear: remove the "my" besides your $dev variable inside your while loop because it creates a separate variable, not related to the one you think you are using.

Good luck!

Testing never proves the absence of faults, it only shows their presence.


Comment on Re: how to debug an 'undef' that cannot be?
Download Code
Re^2: how to debug an 'undef' that cannot be?
by perl-diddler (Hermit) on Mar 05, 2013 at 20:39 UTC
    *Bingo*

    Data: smugbatch-006-2.1.3.x86_64.rpm smugbatch-006-2.4.1.x86_64.rpm Error: cannot stat, already deleted?) path=/Share/suse/distribution/12.1/repo +/oss/suse/test2/smugbatch-6-2.1.3.x86_64.rpm, dev=(undef)

    of course 'V' == "006"

    *sigh*...thanks all!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1021839]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (13)
As of 2014-10-30 18:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (208 votes), past polls