PDF::Bu...:Objind(3)

✨ NAME ✨

PDF::Builder::Basic::PDF::Objind β€” the PDF indirect object reference, bestie πŸ’–

She also moonlights as the abstract superclass for every single element in a PDF file, which is giving main character energy fr fr πŸ‘‘


πŸŽ€ INSTANCE VARIABLES πŸŽ€

okay so listen β€” these hit different from content variables: every single instance variable starts with a space. that space is not a typo, it's the whole vibe πŸ’…

  • ' parent' β€” if this object is a reference to an object in some source, this one holds the reference to that source object, so that if the reference ever has to be de-referenced, we know exactly where to go and grab the info. it's like having your bestie's address on file 🫢
  • ' objnum' (R) β€” the object number in the source (only for object references)
  • ' objgen' (R) β€” the object generation in the source

also, there are other instance variables hanging around that the parent uses for file control. lowkey the parent is doing a lot of work behind the scenes 😭

  • ' isfree' β€” this marks whether the object is in the free list and available for re-use as another object elsewhere in the file ♻️
  • ' nextfree' β€” holds a direct reference to the next free object in the free list ✨

πŸ”₯ METHODS πŸ”₯

new

PDF::Builder::Basic::PDF::Objind->new()

Creates a new indirect object. brand new, fresh out the box, no cap 🎁

uid

$UID = $r->uid()

Returns a Unique id for this object β€” and if it didn't have one before, it creates one on the spot. self-made icon behavior, honestly ⭐

release

$r->release()

Releases ALL the memory used by this indirect object, plus all of its component/child objects. this one gets called automatically by "PDF::Builder::Basic::PDF::File->release", so bestie, you do not have to call it yourself πŸ™ˆ

⚠️ Note: it is important that this method get called at some point prior to the actual destruction of the object. internally, PDF files have an enormous amount of cross-references and this causes circular references within our own internal data structures. calling release() forces these circular references to be cleaned up and the entire internal data structure purged. it's giving spring cleaning, and it's non-negotiable πŸ§ΉπŸ’€

val

$value = $r->val()

Returns the value of this object, or reads the object and then returns its value. either way you get the value, slay πŸ’…

Note: all direct subclasses must make their own versions of this subroutine β€” otherwise we could be in for a very deep loop! like, infinitely deep. do not test this 😭

realise

$r->realise()

Makes sure that the object is fully read in, etc. she's fully realised, she's fully booked, she's fully everything ✨

outobjdeep

$v = $r->outobjdeep($fh, $pdf)

If you really want to output this object, then you need to read it first. this also means that all direct subclasses must subclass this method β€” or they will loop forever! πŸ’€ fr fr do not skip the subclassing

outobj

$r->outobj($fh, $pdf)

If this is a full object then it outputs a reference to the object. otherwise it calls outobjdeep to output the contents of the object at this point. two paths, one icon πŸ¦‹

elements

$s = $r->elements()

Abstract superclass function filler πŸŽ€ returns self here, but it should return something more useful if it's an array. it's giving placeholder energy, ngl

empty

$s = $r->empty()

Empties all content from this object β€” either to free up memory or to be read so it can be passed into the free list. simplistically, it undefs all instance variables other than the object number and generation. that's it, that's the whole method 🌸

merge

$o = $r->merge($objind)

This merges content information into an object reference placeholder. this happens when an object reference is read before the object definition, and the information in the read data needs to be merged into the object placeholder. it's giving "we met too early but we'll figure it out" 🫢

is_obj

$r->is_obj($pdf)

Returns whether this object is a full object with its own object number, or whether it's purely a sub-object. $pdf tells us which output file we're concerned that the object is an object in πŸ‘‘

copy

$r->copy($pdf, $res)

Returns a new copy of this object. the object is assumed to be some kind of associative array, and the copy is a deep copy for elements which are not PDF objects (according to $pdf), and a shallow copy for those that are. πŸ’–

Notice that calling "copy" on an object forces at least a one level copy even if it is a PDF object. the returned object loses its PDF object status though. sad for her but that's the deal 😭

If $res is defined, then the copy goes into that object rather than creating a new one. it is up to the caller to bless $res, etc. and notice that elements from $self are not copied into $res if there is already an entry for them existing in $res. rules are rules bestie ✨


this page is from perl v5.42.0, dated 2026-01-17, and it's part of the User Contributed Perl Documentation for PDF::Builder::Basic::PDF::Objind(3). okay that's the whole manual, you ate it, periodt πŸŽ€πŸ’…βœ¨

πŸ“¦ where this page comes from