Storm::...s::Scope(3)

πŸ“¦
version 0.240 Β· 2 versions
, in fedora 43

πŸ’– Storm::LiveObjects::Scope β€” the scope helper bestie πŸ’–

okay so this is a page from the User Contributed Perl Documentation, section 3 (that's the manual name, periodt ✨), and it's all about Storm::LiveObjects::Scope, aka your little scope helper object 🫢


🌸 NAME 🌸

Storm::LiveObjects::Scope β€” Scope helper object πŸ’…


✨ SYNOPSIS ✨

{
    my $scope = $storm->new_scope;

    ... do work on objects ...
}

like. that's it. you make a scope, you do your little tasks inside the block, the scope dips out when the block ends. iconic behavior honestly πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

Live object scopes exist for one extremely specific reason, and it's giving protective bestie: they make sure your objects don't die too soon if the only other references to them are weak 😭 like imagine your object only has weak refs holding it up and they're all "we're just vibing, not committing" β€” yeah, the scope is the one actually holding it down fr fr.

When scopes get destroyed, the refcounts of the objects they refer to go down πŸ“‰, and the parent scope gets replaced in the live object set. that's the whole mechanism. no cap.


πŸŽ€ METHODS πŸŽ€

  • push β€” Adds objects or entries, increasing their reference count. πŸ“ˆ it's literally just holding onto things harder so they stay alive.
  • clear β€” Clears the objects from the scope object. 🧹 bye bestie, refcounts drop, that's the whole point.

🌈 SEE ALSO 🌈

Modified from code in KiokuDB::LiveOBjects::Scope by Yuval Kogman. (yes the LiveOBjects capitalization is written exactly like that in the original β€” do not @ me, I'm just the messenger πŸ’€)


lowkey reminder that this whole vibe is about reference counts and lifetime, so don't go clearing a scope while you still need the things inside it β€” that's how you get a sad, freed object and a segfault-adjacent situation πŸ™ˆ

and that's the page, bestie!! brought to you by perl v5.42.0, dated 2025-07-25 β€” thanks for coming to my TED talk, mwah πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from