line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Topicalizer::Block; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Copyright (c) 2012 Iain Campbell. All rights reserved. |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# This work may be used and modified freely, but I ask that the copyright |
6
|
|
|
|
|
|
|
# notice remain attached to the file. You may modify this module as you |
7
|
|
|
|
|
|
|
# wish, but if you redistribute a modified version, please attach a note |
8
|
|
|
|
|
|
|
# listing the modifications you have made. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
BEGIN { |
11
|
1
|
|
|
1
|
|
21166
|
$Topicalizer::Block::AUTHORITY = 'cpan:CPANIC'; |
12
|
1
|
|
|
|
|
2
|
$Topicalizer::Block::VERSION = '1.00'; |
13
|
1
|
|
|
|
|
49
|
$Topicalizer::Block::VERSION = eval $Topicalizer::Block::VERSION; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
37
|
use 5.008_004; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
43
|
|
17
|
1
|
|
|
1
|
|
10
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
18
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
19
|
1
|
|
|
1
|
|
964
|
use Params::Callbacks qw/list item/; |
|
1
|
|
|
|
|
657
|
|
|
1
|
|
|
|
|
447
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
require Exporter; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our @ISA = qw/Exporter/; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our @EXPORT_OK = qw/block yield list item/; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
28
|
|
|
|
|
|
|
all => [ @EXPORT_OK ] |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
our $callbacks; |
32
|
|
|
|
|
|
|
our $has_yielded; |
33
|
|
|
|
|
|
|
our $topic; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# RESULT = block { STATEMENT(S) } LIST; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub block (&;@) { |
38
|
|
|
|
|
|
|
local $_; |
39
|
|
|
|
|
|
|
local($has_yielded, $topic) = (0, shift); |
40
|
|
|
|
|
|
|
local($callbacks) = Params::Callbacks->extract(@_); |
41
|
|
|
|
|
|
|
my @result = $topic->(); |
42
|
|
|
|
|
|
|
return @result if $has_yielded; |
43
|
|
|
|
|
|
|
return $callbacks->yield(@result); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# RESULT = yield LIST; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub yield { |
49
|
|
|
|
|
|
|
$has_yielded = 1; |
50
|
|
|
|
|
|
|
$callbacks->yield(@_); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
__END__ |