CSS::DOM::Array(3pm)

πŸ“¦
version 0.17 Β· 5 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– CSS::DOM::Array πŸ’–

okay bestie, so this is the CSS::DOM::Array page from the CSS::DOM corner of the Perl universe, and it's honestly giving "tiny but crucial" energy. it's an array class. that's it. that's the vibe. but she slays at it ✨

🌈 VERSION 🌈

Version 0.17 β€” yes, she's been around, she's stable, she's iconic πŸ‘‘


✨ SYNOPSIS ✨

okay so here's how you actually use her:

use CSS::DOM::Array;

$array = new CSS::DOM::Array 'this', 'that';

@$array;
$array->[0];
# etc.

$array->length;
$array->item(0);

see? you just... make one, and then you use it like a normal array. @$array dereferences the whole thing, $array->[0] grabs the first element, and # etc. is literally in the original so we're keeping it, no cap 🫢


🌸 DESCRIPTION 🌸

so like, what is this? This module serves as a base class for array-like objects required by CSS::DOM. basically she's the blueprint, the mother, the template πŸ’… other CSS::DOM classes inherit from her because they also need to be array-shaped.

and here's the part that makes her so easy to love: a CSS::DOM::Array object is simply a blessed array reference. that's it. that's the whole trick. no magic, no layers, no ✨abstraction✨. you can use it as an array directly, OR you can use the methods below. both. either. your choice, main character πŸ¦‹


πŸŽ€ METHODS πŸŽ€

🧚 Constructor

$array = new CSS::DOM::Array;

Creates a new blessed array. one line, does exactly what it says, no drama, we love a low-maintenance queen πŸ’œ

πŸ’… Object Methods

  • length β€” Returns the length of the array. that's the count, the number, the how-many-things-are-in-here. πŸ“
  • item ( $index) β€” Returns the array element at the given $index. you hand her a position, she hands you back the thing sitting there. iconic behaviour, honestly πŸ“
ngl the whole method list is two items long and she still ate. periodt.

🌟 SEE ALSO 🌟

her besties, her crew, the whole friend group:

  • CSS::DOM
  • CSS::DOM::RuleList
  • CSS::DOM::StyleSheetList
  • CSS::DOM::MediaList

mwah πŸ’– that's the whole page. go forth and bless some arrays.

~ perl v5.36.0 Β· 2023-08-02 Β· CSS::DOM::Array(3pm) ~ ok that's the source, the version and the date bestie, we're done here, drink water, use strict, bye πŸ‘‘πŸ’…πŸŒΈ

πŸ“¦ where this page comes from