PDF::Bu...F::Array(3)

πŸ’– PDF::Builder::Basic::PDF::Array β€” the manual, but make it cute πŸ’–

okay so bestie, quick vibe check: this page is from the User Contributed Perl Documentation set, and the module we're stanning today is PDF::Builder::Basic::PDF::Array(3). It's literally a Perl class that corresponds to a PDF array. That's the whole personality. It's giving "container class that knows how to write itself out to a PDF file." πŸŽ€

Also important: it inherits from PDF::Builder::Basic::PDF::Objind. Family lineage, we love to see it. πŸ‘‘


✨ METHODS ✨

🌸 new

PDF::Array->new($parent, @values)

Creates an array. You hand it the storage $parent, and then optionally a list of @values to initialise the array with. That's it, that's the constructor. No drama, no cap. πŸ’…

πŸ¦‹ outobjdeep

$a->outobjdeep($fh, $pdf)

This one outputs the array as a PDF array to the given filehandle $fh. Sounds iconic, right? Well... ngl, it's unusual to need to call this method from user code. It's an internal-ish thing. So like, you can, but do you need to? Probably not, bestie. πŸ™ˆ

πŸ’œ elements

$a->elements()

Returns the contents of the array. The actual stuff inside. The whole point of the object, fr fr. ✨

πŸ“ add_elements

$a->add_elements(@elements)

Appends the given @elements to the array. But listen β€” there's a lil rule: an element is only added if it is defined. So if you're passing undef in there, it's just not gonna make it in. The array has standards. 😌

🌈 remove_element

$a->remove_element($element)

Removes all occurrences of $element from the array. Not one. Not the first one. ALL of them. It's thorough like that. πŸ’€

⭐ val

$a->val()

Returns a reference to the contents of the array. Note: a reference, not a copy. Just so we're clear. πŸ‘€

🧚 copy

$a->copy($pdf)

Copies the array β€” with deep-copy on elements which are not full PDF objects, with respect to a particular $pdf output context. So it's a smart copy: things that are full PDF objects stay referenced, things that aren't get deep-copied for that specific $pdf context. Main character energy, honestly. πŸ’–


🫢 tiny reminder bestie: everything above is exactly what the manpage says, just with more sparkle. Don't come for me if you called outobjdeep in user code and it was weird β€” I warned you. 😭

and that's a wrap on PDF::Builder::Basic::PDF::Array! this page ships as part of perl v5.42.0, dated 2026-01-17. go forth and array responsibly. slay. πŸ’…βœ¨πŸŒˆ

πŸ“¦ where this page comes from