Class:...::Perl(3pm)

πŸ“¦
version 0.66 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble

πŸ’– Class::Meta::Types::Perl β€” Perl data types πŸ’–

okay bestie, so this is one of those User Contributed Perl Documentation pages, and honestly? it's a little gem. it's Class:...::Perl(3pm) in the wild, but we're gonna call it by its government name: Class::Meta::Types::Perl. it's giving "small module, big main character energy." 🫢


✨ NAME ✨

Class::Meta::Types::Perl β€” Perl data types. that's it. that's the whole name. short, sweet, iconic. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

here's the vibe, copy-paste ready, no notes:

package MyApp::Thingy;
use strict;
use Class::Meta;
use Class::Meta::Types::Perl;
# OR...
# use Class::Meta::Types::Perl 'affordance';
# OR...
# use Class::Meta::Types::Perl 'semi-affordance';

BEGIN {
    # Create a Class::Meta object for this class.
    my $cm = Class::Meta->new( key => 'thingy' );

    # Add an integer attribute.
    $cm->add_attribute( name => 'my_hash',
                        type => 'hash' );
    $cm->build;
}

notice the comments? those three use lines are alternatives β€” you can load it plain, or with 'affordance', or with 'semi-affordance'. pick your fighter. πŸ”₯


🌸 DESCRIPTION 🌸

so like, this module hands you Perl data types so you can use them with Class::Meta attributes. the way that you use it is so easy: just load it, then pass the name of one of its types to the add_attribute() method on a Class::Meta object. that's the whole ritual. ✨

want the deep lore on using and creating data types? that's in Class::Meta::Type. go read it, bestie, it's right there. πŸ“–

the validation checks for Class::Meta::Types::Perl come from Class::Meta::Type's support for object type validation β€” because Perl data types are understood by UNIVERSAL::isa(). no cap. 🧚

here are the data types this module creates, one by one, no skipping:

  • scalar β€” a simple scalar value. it can be anything, and it has no validation checks. zero rules, zero problems, truly living its best life. πŸ™ˆ
  • scalarref β€” a scalar reference. UNIVERSAL::isa() must return 'SCALAR'.
  • array
  • arrayref β€” a array reference. UNIVERSAL::isa() must return 'ARRAY'. (yes, both names, same energy. twins. πŸ‘―)
  • hash
  • hashref β€” a hash reference. UNIVERSAL::isa() must return 'HASH'.
  • code
  • coderef
  • closure β€” a code reference. also known as a closure. UNIVERSAL::isa() must return 'CODE'. three names for one slay. πŸ‘‘

πŸ¦‹ SUPPORT πŸ¦‹

this module lives in an open GitHub repository at <http://github.com/theory/class-meta/>. feel free to fork and contribute β€” literally, the door is open, come through. πŸ’–

got a bug? file it via GitHub Issues at <http://github.com/theory/class-meta/issues/> or send mail to <bug-Class-Meta@rt.cpan.org> (mailto: <bug-Class-Meta@rt.cpan.org>). we listen, we care, we fix. 🫢


πŸ‘‘ AUTHOR πŸ‘‘

David E. Wheeler <david@justatheory.com>. the icon, the legend, the moment. πŸ’œ


🌈 SEE ALSO 🌈

other classes of interest within the Class::Meta distribution, aka the friend group:

  • Class::Meta β€” this class contains most of the documentation you need to get started with Class::Meta. start here, bestie, fr fr.
  • Class::Meta::Type β€” this class manages the creation of data types.
  • Class::Meta::Attribute β€” this class manages Class::Meta class attributes, all of which are based on data types.

other data type modules, the extended universe:

  • Class::Meta::Types::String
  • Class::Meta::Types::Boolean
  • Class::Meta::Types::Numeric

Copyright (c) 2002-2011, David E. Wheeler. Some Rights Reserved.

this module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

periodt. no cap, that's the actual license text, don't @ me. πŸ’…

and that's the whole page, bestie! πŸŽ€ this was perl v5.34.0, dated 2022-06-11, filed under Class:...::Perl(3pm). go forth and type your data responsibly. slay. βœ¨πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from