Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Nested Bless within Hash of Arrays

by hdb (Monsignor)
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.

Replies are listed 'Best First'.
Re^2: Nested Bless within Hash of Arrays
by ksublondie (Friar) 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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1045788]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2017-10-19 00:34 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (251 votes). Check out past polls.