Data::...seLike(3pm)

🌸 Data::Perl::Collection::Array::MooseLike πŸ’…

okay bestie, welcome to the manual page for Data::Perl::Collection::Array::MooseLike β€” your friendly little array wrapper, living its best life under the Data::Perl umbrella 🫢


✨ VERSION ✨

This is version 0.001009 πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

use Data::Perl::Collection::Array::MooseLike;

my $array = Data::Perl::Collection::Array::MooseLike->new(qw/a b c d/);

my $scalar_context = $array->splice(0, 2); # removes and returns b

my @list_context = $array->splice(0, 2); # returns and removes (b, c)

Like… look at her. <pink>``newtaking a whole list,splice` doing its thing in both contexts β€” the range is giving versatile πŸ’…βœ¨


πŸ‘‘ DESCRIPTION πŸ‘‘

So <hotpink>this class</hotpink> hands you a wrapper plus a whole set of methods for messing with an array β€” reading it, poking it, all of it πŸ’–

And here's the vibe: every single method is written to emulate/match existing behavior that exists with Moose's native traits. Not "kind of similar." Not "spiritually adjacent." We're matching it, fr fr 🎯


πŸ’€ DIFFERENCES IN FUNCTIONALITY πŸ’€

ngl the section title sounds ominous but it's just one method, breathe πŸ™ˆ

splice($args, ...)

It's just like Perl's builtin splice β€” no cap, exactly like it 🌈

  • In scalar context, this returns the last element removed, or undef if no elements were removed 😭
  • In list context, this returns all the elements removed from the array πŸ’«
⚠️ heads up bestie: this method requires at least one argument. Like, it will not be negotiating with you. One argument minimum, periodt πŸ’…

πŸ”₯ SEE ALSO πŸ”₯

  • Data::Perl
  • Data::Perl::Role::Collection::Array

(go read them, iykyk, they're the whole friend group 🫢)


πŸŽ€ AUTHOR πŸŽ€

Toby Inkster <tobyink@cpan.org> β€” legend behavior, honestly πŸ‘‘


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. Go forth and share, bestie, it's free like that βœ¨πŸ’–


and that's the whole page, mwah πŸ’‹ written up for perl v5.36.0, dated 2022-10-16 β€” you're all caught up, slay πŸ¦‹β­

πŸ“¦ where this page comes from