Damn(3pm)

πŸ’… Damn(3pm) β€” the "unbless your objects" page, bestie edition

okay so. this is a manual page from the User Contributed Perl Documentation collection, and it lives at section 3pm (that's Perl module docs, iykyk). the module is called Acme::Damn and honestly? it ate. let's get into it 🫢


✨ NAME ✨

Acme::Damn β€” 'Unbless' Perl objects. that's it, that's the whole vibe. we are taking the bless out. periodt. πŸŽ€


🌸 SYNOPSIS 🌸

here's the whole serve in action:

use Acme::Damn;

my $ref = ... some reference ...
my $obj = bless $ref , 'Some::Class';

... do something with your object ...

   $ref = damn $obj;   # recover the original reference (unblessed)

... neither $ref nor $obj are Some::Class objects ...

so you got your plain $ref, you bless it into $obj of Some::Class, you do your little object things, and then β€” plot twist β€” damn $obj hands you back the original $ref, unblessed. and after that? neither $ref nor $obj are Some::Class objects anymore. the class said goodbye. πŸ’€


πŸ”₯ DESCRIPTION πŸ”₯

Acme::Damn gives you exactly one routine: damn(). you feed it a blessed reference (aka a Perl object), it unblesses it, and hands you back the original reference. it's giving minimalism, it's giving one job done well, we love that for it. πŸ‘‘

πŸ’– EXPORT πŸ’–

by default, Acme::Damn exports the method damn() straight into your current namespace. and if you want the aliases for damn() (more on those below πŸ¦‹), you can import them upon request.

🧚 Methods 🧚

  • damn object β€” damn() takes a single blessed reference as its argument and returns that reference unblessed. but listen. if object is not a blessed reference, damn() will die with an error. so don't play. 😭
  • bless reference
  • bless reference [ , package ]
  • bless reference [ , undef ] β€” optionally, Acme::Damn will modify the behaviour of bless so you can pass an explicit undef as the target package, which then invokes damn() for you:
use Acme::Damn  qw( bless );

my  $obj = ... some blessed reference ...;

# the following statements are equivalent
my  $ref = bless $obj , undef;
my  $ref = damn $obj;
NOTE: the modification of bless is lexically scoped to the current package. it is not global. no cap. 🌈

🌟 Method Aliases 🌟

not everyone likes to damn the same way, or in the same language, and honestly? respect. so Acme::Damn lets you specify any alias on import β€” as long as that alias is a valid Perl subroutine name, i.e. all characters match \w. slay.

use Acme::Damn qw( unbless );
use Acme::Damn qw( foo );
use Acme::Damn qw( unblessthyself );
use Acme::Damn qw( recant );

little lore drop: Version 0.02 supported a defined list of aliases, and that got replaced in v0.03 by the ability to import any alias for damn(). glow up fr fr. ✨


⚠️ WARNING ⚠️

big one, bestie, read carefully. just like bless doesn't call an object's initialisation code, damn does not invoke an object's DESTROY method. so if your object needs to be DESTROYed? either don't damn it, or call DESTROY before judgement is passed. that's the rule. πŸ’€


🫢 ACKNOWLEDGEMENTS 🫢

thanks to Claes Jacobsson <claes@surfar.nu> for suggesting the use of aliases, and Bo Lindbergh <blgl@cpan.org> for the suggested modification of bless. icons, both of them. πŸ‘‘


πŸ‘€ SEE ALSO πŸ‘€

bless, perlboot, perltoot, perltooc, perlbot, perlobj. go read them, they're right there, this is your sign. 🌸


πŸ’œ AUTHOR πŸ’œ

Ian Brayshaw, <ibb@cpan.org>


Copyright 2003-2016 Ian Brayshaw

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


and that's the page!! πŸ’… this was perl v5.42.3, dated 2026-08-19, delivered to you with love from the Damn(3pm) corner of the internet. go forth and unbless responsibly, bestie πŸŽ€πŸ¦‹βœ¨

πŸ“¦ where this page comes from