McSvenster has asked for the wisdom of the Perl Monks concerning the following question:
Dearest wise monks
I am just starting with oo perl, read your excellent introductions on referencing, but still there's not enough light coming out of my brain :-)
I am populating an object with the attributes 'head', 'opinion', 'result' like this:
my $item = Item->new("something","another thing","the essence");When I dump the object (with Data::Dumper) I get:
$VAR1 = bless( { 'head' => 'something', 'opinion' => 'another thing', 'result' => 'the essence' }, 'Item' );
How can I get the whole contents of $item (all between the curly brackets)? I know how to get the single elements... but not the whole object.
The aim is to index it with elasticsearch:
$e->index( index => $index, type => $type, id => $id, body => { head => $head, opinion => $opinion, result => $result, } );
and I want to replace the "body" with my item
Thanks a lot in advance for any enlightenment!
MCS
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: beginner's question regarding objects
by choroba (Cardinal) on Mar 28, 2015 at 12:46 UTC | |
by McSvenster (Novice) on Mar 28, 2015 at 13:44 UTC | |
|
Re: beginner's question regarding objects
by roboticus (Chancellor) on Mar 28, 2015 at 13:42 UTC | |
|
Re: beginner's question regarding objects
by CountZero (Bishop) on Mar 28, 2015 at 20:37 UTC |