Object::Deadly(3)

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

πŸ’€ Object::Deadly β€” the manual page, bestie edition

okay so picture this: a Perl module called Object::Deadly, and it lives in the User Contributed Perl Documentation corner of your man pages. It's giving chaos gremlin, but in the most useful way possible. Let's get into it πŸ’…


✨ NAME ✨

Object::Deadly β€” an object that literally dies whenever you examine it. no cap. look at it wrong and it's over πŸ’€


🌸 SYNOPSIS 🌸

use Object::Deadly;
use Test::Exception 'lives_ok';

# Test that a few functions inspect their parameters safely
lives_ok { some_function( Object::Deadly->new ) } 'some_function';
lives_ok { Dumper( Object::Deadly->new ) } 'Data::Dumper';

see what we're doing? we're handing a cursed object to a function and checking that the function survives the interaction. if it dies, that function was being messy and poking at stuff it had no business poking at 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so this object? it exists for testing. that's the whole gig. every possible overloading and every method call on it dies. periodt.

the point is you can yeet this object into methods that are not supposed to accidentally trigger any potentially overloading. if they do trigger it, they die immediately, and now you know who the culprit is. it's a vibe check for your code πŸ’…

the tea on where this came from: it all started when testing Data::Dump::Streamer and Carp. Data::Dump::Streamer was triggering overloaded object methods instead of just dumping their data (rude, honestly). Data::Dump::Streamer is now safe for overloaded objects, but it wouldn't have been unless it hadn't have been tested with a deadly, overloaded object. so like… this module is the reason that's fixed. iconic behavior tbh πŸ‘‘


πŸ’€ DEALING WITH DEATH πŸ’€

TODO

bestie. that's it. that's the whole section. it's a TODO. we move on. 😭

πŸ”₯ METHODS πŸ”₯

  • Object::Deadly->new()
  • Object::Deadly->new( MESSAGE )

the class method Object::Deadly->new returns an Object::Deadly object. it dies with a stack trace and a message when evaluated in any context. the default message contains a stack trace from where the object is created. so like, it snitches on its own birth location. savage.

  • Object::Deadly->new_with( REFERENCE )

the class method Object::Deadly->new_with returns an Object::Deadly object. it dies with a stack trace and a message when evaluated in any context. the default message contains a stack trace from where the object is created. (yes, same energy as new, it just takes a REFERENCE.)

  • Object::Deadly->kill_function( FUNCTION NAME )
  • Object::Deadly->kill_function( FUNCTION NAME, DEATH CODE REF )

the class method kill_function accepts a function name like isa, can, or similar, and creates a function in the Object::Deadly::_unsafe class of the same name. yes bestie, it's literally killing that function name. πŸ’…

an optional second argument is a code reference to die with. this defaults to Object::Deadly->can( '_death' ).

  • Object::Deadly->kill_UNIVERSAL

this class method kills all currently known UNIVERSAL functions so they can't be called on a Object::Deadly object. this includes a list of methods known to the author and then an inspection of UNIVERSAL::. double homicide, honestly πŸ”₯

  • Object::Deadly->get_death

returns the function Object::Deadly::_death.


πŸ™ˆ PRIVATE FUNCTIONS πŸ™ˆ

the following functions are all private and not meant for public consumption. stay out of their business, bestie. respect the boundaries 🫢

  • _death( $obj )

this function temporarilly reblesses the object into Object::Deadly::_safe, extracts the message from inside of it, and confess's with it. it sneaks in, grabs the message, and rats everything out. no notes. πŸ’€


πŸ‘‘ AUTHOR πŸ‘‘

Joshua ben Jore, <jjore at cpan.org>


πŸ“ BUGS πŸ“

please report any bugs or feature requests to bug-object-deadly at rt.cpan.org, or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Object-Deadly>. the author will be notified, and then you'll automatically be notified of progress on your bug as changes are made. it's a whole notification chain, mutuals supporting mutuals ✨


🌈 SUPPORT 🌈

you can find documentation for this module with the perldoc command.

perldoc Object::Deadly

you can also look for information at:

  • AnnoCPAN: Annotated CPAN documentation

<http://annocpan.org/dist/Object-Deadly>

  • CPAN Ratings

<http://cpanratings.perl.org/d/Object-Deadly>

  • RT: CPAN's request tracker

<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Object-Deadly>

  • Search CPAN

<http://search.cpan.org/dist/Object-Deadly>


🧚 ACKNOWLEDGEMENTS 🧚

Yves Orton and Yitzchak Scott-Thoennes. shoutout to the legends 🫢


Copyright 2006 Joshua ben Jore, all rights reserved.

this program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


and that's the whole page bestie πŸ’– this was perl v5.42.0, dated 2025-07-25, and it's filed under Object::Deadly(3) β€” the manual page that will absolutely die if you look at it too hard. obsessed. slay. periodt. πŸŽ€βœ¨

πŸ“¦ where this page comes from