in reply to Re^2: Can I learn more about blessed data?
in thread Where can I learn more about blessed data?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Can I learn more about blessed data?
by choroba (Cardinal) on Jan 08, 2021 at 18:44 UTC | |
by LanX (Saint) on Jan 08, 2021 at 19:12 UTC |