1Damn(3)               User Contributed Perl Documentation              Damn(3)
2
3
4

NAME

6       Acme::Damn - 'Unbless' Perl objects.
7

SYNOPSIS

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

DESCRIPTION

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.
24
25   EXPORT
26       By default, Acme::Damn exports the method damn() into the current
27       namespace. Aliases for damn() (see below) may be imported upon request.
28
29   Methods
30       damn object
31           damn() accepts a single blessed reference as its argument, and
32           returns that reference unblessed. If object is not a blessed
33           reference, then damn() will "die" with an error.
34
35       bless reference
36       bless reference [ , package ]
37       bless reference [ , undef ]
38           Optionally, Acme::Damn will modify the behaviour of "bless" to
39           allow the passing of an explicit "undef" as the target package to
40           invoke damn():
41
42               use Acme::Damn  qw( bless );
43
44               my  $obj = ... some blessed reference ...;
45
46               # the following statements are equivalent
47               my  $ref = bless $obj , undef;
48               my  $ref = damn $obj;
49
50           NOTE: The modification of "bless" is lexically scoped to the
51           current package, and is not global.
52
53   Method Aliases
54       Not everyone likes to damn the same way or in the same language, so
55       Acme::Damn offers the ability to specify any alias on import, provided
56       that alias is a valid Perl subroutine name (i.e. all characters match
57       "\w").
58
59         use Acme::Damn qw( unbless );
60         use Acme::Damn qw( foo );
61         use Acme::Damn qw( unblessthyself );
62         use Acme::Damn qw( recant );
63
64       Version 0.02 supported a defined list of aliases, and this has been
65       replaced in v0.03 by the ability to import any alias for "damn()".
66

WARNING

68       Just as "bless" doesn't call an object's initialisation code, "damn"
69       doesn't invoke an object's "DESTROY" method. For objects that need to
70       be "DESTROY"ed, either don't "damn" them, or call "DESTROY" before
71       judgement is passed.
72

ACKNOWLEDGEMENTS

74       Thanks to Claes Jacobsson <claes@surfar.nu> for suggesting the use of
75       aliases, and Bo Lindbergh <blgl@cpan.org> for the suggested
76       modification of "bless".
77

SEE ALSO

79       bless, perlboot, perltoot, perltooc, perlbot, perlobj.
80

AUTHOR

82       Ian Brayshaw, <ibb@cpan.org>
83
85       Copyright 2003-2016 Ian Brayshaw
86
87       This library is free software; you can redistribute it and/or modify it
88       under the same terms as Perl itself.
89
90
91
92perl v5.30.1                      2020-01-29                           Damn(3)
Impressum