1Damn(3) User Contributed Perl Documentation Damn(3)
2
3
4
6 Acme::Damn - 'Unbless' Perl objects.
7
9 use Acme::Damn;
10
11 my $ref = ... some reference ...
12 my $obj = bless $ref , 'Some::Class';
13
14 ... do something with your object ...
15
16 $ref = damn $obj; # recover the original reference (unblessed)
17
18 ... neither $ref nor $obj are Some::Class objects ...
19
21 Acme::Damn provides a single routine, damn(), which takes a blessed
22 reference (a Perl object), and unblesses it, to return the original
23 reference. I can't think of any reason why you might want to do this,
24 but just because it's of no use doesn't mean that you shouldn't be able
25 to do it.
26
27 EXPORT
28
29 By default, Acme::Damn exports the method damn() into the current
30 namespace. Aliases for damn() (see below) may be imported upon request.
31
32 Methods
33
34 damn object
35 damn() accepts a single blessed reference as its argument, and
36 returns that reference unblessed. If object is not a blessed refer‐
37 ence, then damn() will "die" with an error.
38
39 Method Aliases
40
41 Not everyone likes to damn the same way or in the same language, so
42 Acme::Damn offers the ability to specify any alias on import, provided
43 that alias is a valid Perl subroutine name (i.e. all characters match
44 "\w").
45
46 use Acme::Damn qw( unbless );
47 use Acme::Damn qw( foo );
48 use Acme::Damn qw( unblessthyself );
49 use Acme::Damn qw( recant );
50
51 Version 0.02 supported a defined list of aliases, and this has been
52 replaced in v0.03 by the ability to import any alias for "damn()".
53
55 Just as "bless" doesn't call an object's initialisation code, "damn"
56 doesn't invoke an object's "DESTROY" method. For objects that need to
57 be "DESTROY"ed, either don't "damn" them, or call "DESTROY" before
58 judgement is passed.
59
61 Thanks to Claes Jacobsson <claes@surfar.nu> for suggesting the use of
62 aliases.
63
65 bless, perlboot, perltoot, perltooc, perlbot, perlobj.
66
68 Ian Brayshaw, <ian@onemore.org>
69
71 Copyright 2003-2006 Ian Brayshaw
72
73 This library is free software; you can redistribute it and/or modify it
74 under the same terms as Perl itself.
75
76
77
78perl v5.8.8 2006-02-04 Damn(3)