Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Nested Bless within Hash of Arrays

by hdb (Parson)
on Jul 23, 2013 at 07:17 UTC ( #1045788=note: print w/ replies, xml ) Need Help??


in reply to Nested Bless within Hash of Arrays

In Data::Dumper's output, bless signifies a blessed reference. Have a look at this example:

use strict; use warnings; use DateTime; use Data::Dumper; my $t = DateTime->now; print Dumper $t;
which creates this output:
$VAR1 = bless( { 'local_rd_secs' => 25639, 'local_rd_days' => 735072, 'rd_nanosecs' => 0, 'locale' => bless( { 'default_time_format_length' => +'medium', 'native_territory' => 'United St +ates', 'native_language' => 'English', 'native_complete_name' => 'Engli +sh United States', 'en_language' => 'English', 'id' => 'en_US', 'default_date_format_length' => +'medium', 'en_complete_name' => 'English U +nited States', 'en_territory' => 'United States +' }, 'DateTime::Locale::en_US' ), 'local_c' => { 'hour' => 7, 'second' => 19, 'month' => 7, 'quarter' => 3, 'day_of_year' => 204, 'day_of_quarter' => 23, 'minute' => 7, 'day' => 23, 'day_of_week' => 2, 'year' => 2013 }, 'utc_rd_secs' => 25639, 'formatter' => undef, 'tz' => bless( { 'name' => 'UTC' }, 'DateTime::TimeZone::UTC' ), 'utc_year' => 2014, 'utc_rd_days' => 735072, 'offset_modifier' => 0 }, 'DateTime' );

This tells you that $t is a blessed hash reference with classname DateTime. The hash itself contains all the members of the class some of which again are blessed hash references (like locale and tz) of different types (classes).

In the structure you have posted, it seems that the class BLOCK has elements that are blocks themselves, like BLOCKs of BLOCKs. In a way this is not much different from arrays of arrays.


Comment on Re: Nested Bless within Hash of Arrays
Select or Download Code
Re^2: Nested Bless within Hash of Arrays
by ksublondie (Pilgrim) on Jul 23, 2013 at 15:49 UTC
    Ok, so the "blessing" is just a specification by Dumper that the element is a BLOCK object?

      It is to tell you that the reference provided to Dumper has been blessed as a BLOCK.



Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1045788]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2014-09-01 11:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (6 votes), past polls