| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Carp::POE; |
|
2
|
|
|
|
|
|
|
BEGIN { |
|
3
|
2
|
|
|
2
|
|
62085
|
$Carp::POE::AUTHORITY = 'cpan:HINRIK'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
|
|
|
|
|
|
{ |
|
6
|
|
|
|
|
|
|
$Carp::POE::VERSION = '0.10'; |
|
7
|
|
|
|
|
|
|
} |
|
8
|
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
18
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
70
|
|
|
10
|
2
|
|
|
2
|
|
10
|
use warnings FATAL => 'all'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
87
|
|
|
11
|
2
|
|
|
2
|
|
14
|
use Carp (); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
37
|
|
|
12
|
2
|
|
|
2
|
|
2492
|
use POE::Session; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use base qw(Exporter); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our @EXPORT = qw(confess croak carp); |
|
16
|
|
|
|
|
|
|
our @EXPORT_OK = qw(cluck verbose); |
|
17
|
|
|
|
|
|
|
our @EXPORT_FAIL = qw(verbose); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# from POE::Session |
|
20
|
|
|
|
|
|
|
my ($file, $line) = (CALLER_FILE, CALLER_LINE); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
{ |
|
23
|
|
|
|
|
|
|
no warnings 'once'; |
|
24
|
|
|
|
|
|
|
*export_fail = *Carp::export_fail; |
|
25
|
|
|
|
|
|
|
*confess = *Carp::confess; |
|
26
|
|
|
|
|
|
|
*cluck = *Carp::cluck; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub croak { |
|
30
|
|
|
|
|
|
|
_is_handler() |
|
31
|
|
|
|
|
|
|
? die _caller_info(@_), "\n" |
|
32
|
|
|
|
|
|
|
: die Carp::shortmess(@_), "\n" |
|
33
|
|
|
|
|
|
|
; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub carp { |
|
37
|
|
|
|
|
|
|
_is_handler() |
|
38
|
|
|
|
|
|
|
? warn _caller_info(@_), "\n" |
|
39
|
|
|
|
|
|
|
: warn Carp::shortmess(@_), "\n" |
|
40
|
|
|
|
|
|
|
; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub _is_handler { |
|
44
|
|
|
|
|
|
|
return 1 if (caller(3))[0] eq 'POE::Kernel'; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _caller_info { |
|
48
|
|
|
|
|
|
|
my @args = @_; |
|
49
|
|
|
|
|
|
|
{ |
|
50
|
|
|
|
|
|
|
package |
|
51
|
|
|
|
|
|
|
DB; |
|
52
|
|
|
|
|
|
|
my @throw_away = caller(2); |
|
53
|
|
|
|
|
|
|
return "@args at $DB::args[$file] line $DB::args[$line]"; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=encoding utf8 |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 NAME |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Carp::POE - Carp adapted to POE |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
use Carp::POE; |
|
68
|
|
|
|
|
|
|
use POE; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
POE::Session->create( |
|
71
|
|
|
|
|
|
|
package_states => [ |
|
72
|
|
|
|
|
|
|
main => [qw( _start test_event )] |
|
73
|
|
|
|
|
|
|
], |
|
74
|
|
|
|
|
|
|
); |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
$poe_kernel->run(); |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub _start { |
|
79
|
|
|
|
|
|
|
$_[KERNEL]->yield(test_event => 'fail'); |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub test_event { |
|
83
|
|
|
|
|
|
|
my $arg = $_[ARG0]; |
|
84
|
|
|
|
|
|
|
if ($arg ne 'correct') { |
|
85
|
|
|
|
|
|
|
carp "Argument is incorrect!"; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This module provides the same functions as L, but modifies |
|
92
|
|
|
|
|
|
|
the behavior of C and C if called inside a L |
|
93
|
|
|
|
|
|
|
event handler. The file names/line numbers in the emitted warnings are |
|
94
|
|
|
|
|
|
|
replaced with L's C<$_[CALLER_FILE]> and |
|
95
|
|
|
|
|
|
|
C<$_[CALLER_LINE]>. This is useful as it will direct you to the code |
|
96
|
|
|
|
|
|
|
that posted the event instead of directing you to some subroutine in |
|
97
|
|
|
|
|
|
|
POE::Session which actually called the event handler. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Calls to C and C in subroutines that are not POE event |
|
100
|
|
|
|
|
|
|
handlers will not be effected, so it's always safe to C |
|
101
|
|
|
|
|
|
|
instead of C. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 TODO |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Do something clever with C and C. |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 BUGS |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Those go here: L |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 AUTHOR |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Hinrik Ern SigurEsson |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Copyright 2008-2010 Hinrik Ern SigurEsson |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify |
|
120
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |