1Object::Deadly(3)     User Contributed Perl Documentation    Object::Deadly(3)
2
3
4

NAME

6       Object::Deadly - An object that dies whenever examined
7

SYNOPSIS

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

DESCRIPTION

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

DEALING WITH DEATH

28       TODO
29

METHODS

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

PRIVATE FUNCTIONS

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

AUTHOR

72       Joshua ben Jore, "<jjore at cpan.org>"
73

BUGS

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>. I will
78       be notified, and then you'll automatically be notified of progress on
79       your bug as I make changes.
80

SUPPORT

82       You can find documentation for this module with the perldoc command.
83
84         perldoc Object::Deadly
85
86       You can also look for information at:
87
88       ·   AnnoCPAN: Annotated CPAN documentation
89
90           <http://annocpan.org/dist/Object-Deadly>
91
92       ·   CPAN Ratings
93
94           <http://cpanratings.perl.org/d/Object-Deadly>
95
96       ·   RT: CPAN's request tracker
97
98           <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Object-Deadly>
99
100       ·   Search CPAN
101
102           <http://search.cpan.org/dist/Object-Deadly>
103

ACKNOWLEDGEMENTS

105       Yves Orton and Yitzchak Scott-Thoennes.
106
108       Copyright 2006 Joshua ben Jore, all rights reserved.
109
110       This program is free software; you can redistribute it and/or modify it
111       under the same terms as Perl itself.
112
113
114
115perl v5.16.3                      2006-09-25                 Object::Deadly(3)
Impressum