1Object::Deadly(3) User Contributed Perl Documentation Object::Deadly(3)
2
3
4
6 Object::Deadly - An object that dies whenever examined
7
9 use Object::Deadly;
10 use Test::Exception 'lives_ok';
11
12 # Test that a few functions inspect their parameters safely
13 lives_ok { some_function( Object::Deadly->new ) } 'some_function';
14 lives_ok { Dumper( Object::Deadly->new ) } 'Data::Dumper';
15
17 This object is meant to be used in testing. All possible overloading
18 and method calls die. You can pass this object into methods which are
19 not supposed to accidentally trigger any potentially overloading.
20
21 This problem arose when testing Data::Dump::Streamer and Carp. The
22 former was triggering overloaded object methods instead of just dumping
23 their data. Data::Dump::Streamer is now safe for overloaded objects but
24 it wouldn't have been unless it hadn't have been tested with a deadly,
25 overloaded object.
26
28 TODO
29
31 "Object::Deadly->new()"
32 "Object::Deadly->new( MESSAGE )"
33 The class method "Object::Deadly->new" returns an "Object::Deadly"
34 object. Dies with a stack trace and a message when evaluated in any
35 context. The default message contains a stack trace from where the
36 object is created.
37
38 "Object::Deadly->new_with( REFERENCE )"
39 The class method "Object::Deadly->new_with" returns an
40 "Object::Deadly" object. Dies with a stack trace and a message when
41 evaluated in any context. The default message contains a stack
42 trace from where the object is created.
43
44 "Object::Deadly->kill_function( FUNCTION NAME )"
45 "Object::Deadly->kill_function( FUNCTION NAME, DEATH CODE REF )"
46 The class method kill_function accepts a function name like "isa",
47 "can", or similar and creates a function in the
48 "Object::Deadly::_unsafe" class of the same name.
49
50 An optional second argument is a code reference to die with. This
51 defaults to "Object::Deadly->can( '_death' )".
52
53 "Object::Deadly->kill_UNIVERSAL"
54 This class method kills all currently known UNIVERSAL functions so
55 they can't be called on a "Object::Deadly" object. This includes a
56 list of methods known to the author and then an inspection of
57 UNIVERSAL::.
58
59 "Object::Deadly->get_death"
60 Returns the function "Object::Deadly::_death".
61
63 The following functions are all private and not meant for public
64 consumption.
65
66 "_death( $obj )"
67 This function temporarilly reblesses the object into
68 "Object::Deadly::_safe", extracts the message from inside of it,
69 and "confess"'s with it.
70
72 Joshua ben Jore, "<jjore at cpan.org>"
73
75 Please report any bugs or feature requests to "bug-object-deadly at
76 rt.cpan.org", or through the web interface at
77 http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Object-Deadly
78 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Object-Deadly>. I will
79 be notified, and then you'll automatically be notified of progress on
80 your bug as I make changes.
81
83 You can find documentation for this module with the perldoc command.
84
85 perldoc Object::Deadly
86
87 You can also look for information at:
88
89 · AnnoCPAN: Annotated CPAN documentation
90
91 http://annocpan.org/dist/Object-Deadly
92 <http://annocpan.org/dist/Object-Deadly>
93
94 · CPAN Ratings
95
96 http://cpanratings.perl.org/d/Object-Deadly
97 <http://cpanratings.perl.org/d/Object-Deadly>
98
99 · RT: CPAN's request tracker
100
101 http://rt.cpan.org/NoAuth/Bugs.html?Dist=Object-Deadly
102 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Object-Deadly>
103
104 · Search CPAN
105
106 http://search.cpan.org/dist/Object-Deadly
107 <http://search.cpan.org/dist/Object-Deadly>
108
110 Yves Orton and Yitzchak Scott-Thoennes.
111
113 Copyright 2006 Joshua ben Jore, all rights reserved.
114
115 This program is free software; you can redistribute it and/or modify it
116 under the same terms as Perl itself.
117
118
119
120perl v5.12.0 2006-09-25 Object::Deadly(3)