in reply to Where can I learn more about blessed data?

You are seeing objects.

"Blessed" means a reference was augmented to an object by associating a class i.e. a package. Any method ->call will be resolved in by subs in that package (or its inheritance chain)

See bless and perlobj for details.

Your question is too general to be better answered, provide examples if you want more help.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^2: Can I learn more about blessed data?
by SergioQ (Scribe) on Jan 08, 2021 at 16:05 UTC

    Your question is too general to be better answered, provide examples if you want more help.

    My apologies. What I meant was depending on what I'm doing or who's module I am using I get data with just one !VAR, or sometime many more.

    I feel like I do when I first started using Regex. Never thought I'd get there. Then I found a great book, and then the holy grail... RegEx101. Using that site I was able to figure my way around many different type of grep routines.

    So I was hoping to find something like that, that would help tutor me.

      I see perlootut hasn't been suggested yet. Start there. Then go to bless and perlobj.

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      > Then I found a great book, and then the holy grail...

      Look, imagine someone asking for a book about "Churches", because he needs to understand this "Religion" (which is probably Christianity)...

      That's how confusing your question sounds.

      Blessing is just a mechanism from Object Oriented Programming.

      you could also see it from a "typing" perspective:

      Perl has data with primitive types, like arrays, hashes and scalars (including subtypes like integer, string, etc.)

      These types have properties and methods. like length or keys

      Blessing is a way to construct new types, with new properties and methods.

      OOP is one application of that, and 99% of all objects you'll encounter in Perl are just blessed hashrefs.

      There is no definitive book which will list all blessed data, because every module can create it's own, you have to check the documentation.

      > I'm doing or who's module I am using I get data with just one !VAR,

      Sounds like you are using Data::Dumper to display some JSON data.

      JSON derives from Javascript which has an explicit "type" (sic) Boolean which doesn't exist in Perl. It's represented by "1" and ""/0 there, there is no TRUE and FALSE.

      BUT when reading JSON data you often need to distinguish between the "1" and TRUE.

      That's why JSON converters create a Perl object for boolean to represent this type

      And Dumper will show something like bless \1, "Boolean" for true (or something similar)

      HTH! :)

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

        > Dumper will show something like

        In fact,

        $ perl -MData::Dumper -MJSON -wE 'print Dumper decode_json("[true]")' $VAR1 = [ bless( do{\(my $o = 1)}, 'JSON::PP::Boolean' ) ];
        Note that it returns the PP for all of JSON::PP, JSON::XS, and Cpanel::JSON::XS.
        map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]