File Coverage

blib/lib/threads/variables/reap/attr.pm
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 24 24 100.0


line stmt bran cond sub pod time code
1             package threads::variables::reap::attr;
2              
3 1     1   25086 use strict;
  1         366  
  1         990  
4 1     1   9 use warnings;
  1         2  
  1         49  
5              
6 1     1   32 use 5.008;
  1         9  
  1         47  
7              
8 1     1   1128 use Attribute::Lexical ();
  1         25688  
  1         67  
9 1     1   1283 use threads::variables::reap;
  1         978  
  1         242  
10              
11             our $VERSION = '0.06';
12              
13             sub import
14             {
15 1     1   15 Attribute::Lexical->import("SCALAR:reap" => \&reap);
16 1         41 Attribute::Lexical->import("ARRAY:reap" => \&reap);
17 1         27 Attribute::Lexical->import("HASH:reap" => \&reap);
18             }
19              
20             =pod
21              
22             =head1 NAME
23              
24             threads::variables::reap::attr - reap variables in new threads by attribute
25              
26             =head1 SYNOPSIS
27              
28             use threads::variables::reap::attr;
29              
30             # force database handle being reaped in each new thread
31             my $dbh : reap = DBI->connect(...);
32              
33             # force array being emptied in each new thread
34             my @connections : reap = map { DBI->connect( @{$_} ) } @dsnlist;
35              
36             =head1 DESCRIPTION
37              
38             C provides an attribute C by lexical
39             scoping using L to mark variables to get reaped in new
40             threads or child processes at compile time.
41              
42             =head1 AUTHOR
43              
44             Jens Rehsack, C<< >>
45              
46             =head1 BUGS
47              
48             This module provides an attribute C analogous to L
49             provides the C attribute. Entirely lower cased attribute names are
50             reserved for future features, so a warning will occure when
51             C is used. Attributes should be avoided
52             where ever possible, so I decided it's not to bad if an additional warning
53             occures. Use
54              
55             BEGIN { $^W = 0; }
56              
57             if the warning bothers you.
58              
59             Further you should recognize, that in perl before 5.9.4 the lexical state of
60             attribute declarations is not available at runtime. See L
61             for details.
62              
63             Please report any bugs or feature requests to C,
64             or through the web interface at L.
65             I will be notified, and then you'll automatically be notified of progress
66             on your bug as I make changes.
67              
68             =head1 SUPPORT
69              
70             You can find documentation for this module with the perldoc command.
71              
72             perldoc threads::variables::reap::attr
73              
74             You can also look for information at:
75              
76             =over 4
77              
78             =item * RT: CPAN's request tracker
79              
80             L
81              
82             =item * AnnoCPAN: Annotated CPAN documentation
83              
84             L
85              
86             =item * CPAN Ratings
87              
88             L
89              
90             =item * Search CPAN
91              
92             L
93              
94             =back
95              
96             =head1 ACKNOWLEDGEMENTS
97              
98             Larry Wall for giving us Perl - all our modules provide on his work.
99             David Golden for his great contribution about Perl and threads on PerlMonks
100             (see http://www.perlmonks.org/?node_id=483162).
101             Steffen Mueller for Attribute::Handlers and the helpful explanantion about
102             attributes there.
103             Andrew Main, Adam Kennedy and Joshua ben Jore helping me pointing my problem
104             I'm going to solve with this module.
105              
106             =head1 LICENSE AND COPYRIGHT
107              
108             Copyright 2010 Jens Rehsack.
109              
110             This program is free software; you can redistribute it and/or modify it
111             under the terms of either: the GNU General Public License as published
112             by the Free Software Foundation; or the Artistic License.
113              
114             See http://dev.perl.org/licenses/ for more information.
115              
116             =cut
117              
118             1;