10 Jun 2003 18:22:56 UTC
- Distribution: Acme-Damn
- Module version: 0.02
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (1)
- Testers (2 / 0 / 0)
- KwaliteeBus factor: 0
- License: unknown
- Activity24 month
- Download (4.84KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:1 non-PAUSE userIBB Ian Brayshaw
- SEE ALSO
- COPYRIGHT AND LICENSE
Acme::Damn - 'Unbless' Perl objects.
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 ...
Acme::Damn provides a single routine, damn(), which takes a blessed reference (a Perl object), and unblesses it, to return the original reference. I can't think of any reason why you might want to do this, but just because it's of no use doesn't mean that you shouldn't be able to do it.
By default, Acme::Damn exports the method damn() into the current namespace. Aliases for damn() (see below) may be imported upon request.
- damn object
damn() accepts a single blessed reference as its argument, and returns that reference unblessed. If object is not a blessed reference, then damn() will
diewith an error.
Not everyone likes to damn the same way, so Acme::Damn offers a list of aliases for damn() that may be imported upon request:
use Acme::Damn qw( unbless );
The following aliases are supported:
blessdoesn't call an object's initialisation code,
damndoesn't invoke an object's
DESTROYmethod. For objects that need to be
DESTROYed, either don't
damnthem, or call
DESTROYbefore judgement is passed.
Thanks to Claes Jacobsson <firstname.lastname@example.org> for suggesting the use of aliases.
Ian Brayshaw, <email@example.com>
Copyright 2003 by Ian Brayshaw
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.