in reply to unblessed reference

Am I correct in saying that this perhaps is because the object I m trying to print to string is not the correct type?
No, its because you don't have an object, observe
#!/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
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 = []; 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
    $ua = LWP::UserAgent->new; $ua->cookie_jar ($cookie_jar={}); # instead of $ua->cookie_jar ( +{} ); $request = HTTP::Request->new('GET', "$RevAddr" ); print "\$request = ", $request, "\n"; print Dumper ($request), "\n";

    $request = HTTP::Request=HASH(0x1080540) $VAR1 = bless( { '_content' => '', '_uri' => bless( do{\(my $o = 'http://www.oracle.com/ +technetwork/java/javase/downloads/jre7-downloads-1880261.html')}, 'UR +I::http' ), '_headers' => bless( {}, 'HTTP::Headers' ), '_method' => 'GET' }, 'HTTP::Request' );

    What am I doing wrong?

      Never mind. Wrong thread