![]() |
![]()
| ![]() |
![]()
NAMEAcme::Damn - 'Unbless' Perl objects. SYNOPSISuse 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 ... DESCRIPTIONAcme::Damn provides a single routine, damn(), which takes a blessed reference (a Perl object), and unblesses it, to return the original reference. EXPORTBy default, Acme::Damn exports the method damn() into the current namespace. Aliases for damn() (see below) may be imported upon request. Methods
Method AliasesNot everyone likes to damn the same way or in the same language, so Acme::Damn offers the ability to specify any alias on import, provided that alias is a valid Perl subroutine name (i.e. all characters match "\w"). use Acme::Damn qw( unbless ); use Acme::Damn qw( foo ); use Acme::Damn qw( unblessthyself ); use Acme::Damn qw( recant ); Version 0.02 supported a defined list of aliases, and this has been replaced in v0.03 by the ability to import any alias for damn(). WARNINGJust as "bless" doesn't call an object's initialisation code, "damn" doesn't invoke an object's "DESTROY" method. For objects that need to be "DESTROY"ed, either don't "damn" them, or call "DESTROY" before judgement is passed. ACKNOWLEDGEMENTSThanks to Claes Jacobsson <claes@surfar.nu> for suggesting the use of aliases, and Bo Lindbergh <blgl@cpan.org> for the suggested modification of "bless". SEE ALSObless, perlboot, perltoot, perltooc, perlbot, perlobj. AUTHORIan Brayshaw, <ian@onemore.org> COPYRIGHT AND LICENSECopyright 2003-2012 Ian Brayshaw This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|