Hello Monks,
I am unable to figure out the issue with my code.
I am passing an object to a subroutine - '_predecessors_complete' below, however, I get the following error in a certain case, marked below in the code with '--this line --' -
Can't use an undefined value as a HASH reference at Steps.pm line 264, <OEM2015FLAG> line 1.
The case occurs when I pass in a 'job' value that doesn't exist in the hash of all jobs. So, I tried checking if the job exists in the hash, using the 'if' exists' code.
Question is, which value exactly would be undefined for me to get this error message? I am printing $p here, and it is definitely defined.
OUTPUT -
p : JOBNAME1
Can't use an undefined value as a HASH reference at Steps.pm line 264, <OEM2015FLAG> line 1.
CODE -
my $rv = $self->_predecessors_complete( $self->predecessors ); ##$self +->predecessors is a reference to a hash sub _predecessors_complete { my ( $self, $predecessors ) = @_; while ( my $p = shift @{ $predecessors } ) { print "\np : $p\n"; --this line -- if ( ! exists $self->steps->{$p} ) { print "\nThe job $p has not been defined in the Scheduler!\n +"; return(100); } else {
In reply to Unable to figure out - undefined value as a HASH reference by Audar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |