Data::Perl(3pm)
π Data::Perl β bestie edition π
okay so this is Data::Perl (that's the Data::Perl manual page you're reading rn), and it's literally base classes wrapping fundamental Perl data types. no cap. let's go π¦
β¨ VERSION β¨
version 0.002011 β yes queen, remember that number, it comes back later π
πΈ SYNOPSIS πΈ
ok bestie here's the vibe, look at this:
use Data::Perl;
my $array = array(1,2,3, qw/a b c/);
$array->count; # 6
my @elements = $array->grep(sub {/b/}); # (b)
my $hash = hash(a => 1, b => 2);
$hash->keys; # ('a', 'b');
my $number = number(5);
$number->add(10); # 15
my $string = string("foo\n");
$string->chomp; # return 1, chomps string
my $counter = counter();
$counter->inc; # counter is now 1
my $sub = code(sub { 'foo' });
$sub->execute; # returns 'foo'
my $foo
see how easy that was?? iconic. (and yes, that last little my $foo is in there fr fr, it's just vibing at the end π
)
π DESCRIPTION π
so Data::Perl is a collection of classes that wrap fundamental data types that exist in Perl. these classes and methods, as they exist today, are an attempt to mirror functionality provided by Moose's Native Traits. one important thing to note β and bestie I need you to clock this β is all classes currently do no validation on constructor input. it does not check. it just trusts you. π«Ά
Data::Perl is a container class for the following classes:
Data::Perl::Collection::HashData::Perl::Collection::ArrayData::Perl::StringData::Perl::NumberData::Perl::CounterData::Perl::BoolData::Perl::Code
β οΈ ALPHA API β οΈ
π¨ okay so listen. the API provided by these modules is as of now considered alpha and undecided. the API WILL change. if you are writing code that you will not touch again for years, do not use this until this warning is removed. that's not me being dramatic, that's the manpage. periodt. π
π PROVIDED FUNCTIONS π
Data::Perl exports helper constructor functions to interface with the above classes:
hash(key, value, ...)β returns aData::Perl::Collection::Hashobject, initialized with the optionally passed in key/value args. cute.array(@args)β returns aData::Perl::Collection::Arrayobject, initialized with the optionally passed in values.string($arg)β returns aData::Perl::Stringobject, initialized with the optionally passed in scalar arg.number($arg)β returns aData::Perl::Numberobject, initialized with the optionally passed in scalar arg.counter($arg)β returns aData::Perl::Counterobject, initialized with the optionally passed in scalar arg.bool($arg)β returns aData::Perl::Boolobject, initialized with the truth value of the passed in scalar arg. noted β¨code($arg)β returns aData::Perl::Codeobject, initialized with the optionally passed in scalar coderef as an arg.
π THANKS π
much thanks to the Moose team for their work with native traits β much of this work is based on that. we love them, we appreciate them, iconic behaviour honestly π
π SEE ALSO π
MooX::HandlesVia
π AUTHOR π
Matthew Phillips <mattp@cpan.org>
π MAINTAINER π
Toby Inkster <tobyink@cpan.org> since version 0.002010.
π«Ά CONTRIBUTORS π«Ά
- Graham Knop <haarg@haarg.org>
- Jon Portnoy <avenj@cobaltirc.org>
- kristof.pap@gmail.com <kristof.pap@gmail.com>
- Matt Phillips <mattp@cpan.org>
- Toby Inkster <tobyink@cpan.org>
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2020 by Matthew Phillips <mattp@cpan.org>.
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay π
and that's the whole page bestie, tysm for reading π₯Ή this was Data::Perl version 0.002011, brought to you by perl v5.36.0, dated 2022-10-16 β ok bye ily, go write some wrapped data types πΈβ¨π
π¦ where this page comes from
- ubuntu noble: libdata-perl-perl 0.002011-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdata-perl-perl 0.002011-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdata-perl-perl 0.002011-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms