Oct 17, 2009

Perl Error - exists argument is not a HASH or ARRAY element at test.pl line 8.

Error:
exists argument is not a HASH or ARRAY element at test.pl line 8.

Solution:
Exists is for checking elements of array and hash. should not be used on scalar



If you find this information helpful, please click the ads below

Perl Error - Can't use string ("2") as a HASH ref while "strict refs" in use

Error:
Can't use string ("2") as a HASH ref while "strict refs" in use

Solution:
Object representing class is assinged or having numeric value "2"
it will be calling like 2->method() that makes compiler yelling

Perl Error - Can't locate object method "new" via package"

Error:
Can't locate object method "new" via package"

Solution:
Check the 'package' line in your module, and make sure that it _exactly_ matches (including case) the name in the 'use' statement.
I typically run into this after I've decided to rearrange some files, or I typo on a case-insensitive file system (so it finds the module, but the name doesn't match)

Define $DB::fork_TTY

Error:
  DB<1> Debugged program terminated.  Use q to quit or R to restart,
  use O inhibit_exit to avoid stopping after program termination,
  h q, h R or h O to get additional info.
######### Forked, but do not know how to change a TTY. #########
  Define $DB::fork_TTY
       - or a function DB::get_fork_TTY() which will set $DB::fork_TTY.
  The value of $DB::fork_TTY should be the name of TTY to use.
  On UNIX-like systems one can get the name of a TTY for the given window
  by typing tty, and disconnect the shell from TTY by sleep 1000000.

Cause
when a process is forked the program does not know which tty to use

Solution:
set  $DB::fork_TTY = 0;
set the tty for child = 0 or any particular tty you want to use