in reply to unblessed reference
If you don't know what you have, you can use Data::Dumper to find out, example#!/usr/bin/perl -- use strict; use warnings; use diagnostics; use CGI(); my $cgi = CGI->new(); my $poop = []; $cgi->header; $poop->nonsense; __END__ Can't call method "nonsense" on unblessed reference at temp.pl line 13 + (#1) (F) A method call must know in what package it's supposed to run. + It ordinarily finds this out from the object reference you supply, bu +t you didn't supply an object reference in this case. A reference isn't + an object reference until it has been blessed. See perlobj. Uncaught exception from user code: Can't call method "nonsense" on unblessed reference at temp.pl + line 13. at temp.pl line 13
#!/usr/bin/perl -- use strict; use warnings; use diagnostics; use CGI(); my $cgi = CGI->new(); my $poop = []; use Data::Dumper; print Dumper( $cgi, $poop ); __END__ $VAR1 = bless( { '.parameters' => [], 'use_tempfile' => 1, '.charset' => 'ISO-8859-1', '.fieldnames' => {}, 'param' => {}, 'escape' => 1 }, 'CGI' ); $VAR2 = [];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: unblessed reference
by Todd Chester (Scribe) on Oct 17, 2015 at 06:02 UTC | |
by Todd Chester (Scribe) on Oct 17, 2015 at 06:24 UTC |