File Coverage

blib/lib/Dancer/OO/Object.pm
Criterion Covered Total %
statement 4 6 66.6
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 6 8 75.0


line stmt bran cond sub pod time code
1             package Dancer::OO::Object;
2 1     1   1358 use strict;
  1         2  
  1         36  
3 1     1   36 use Dancer::OO::Dancer qw( debug );
  0            
  0            
4              
5             our $VERSION = '0.01';
6              
7             # this module actually installs deferred and properly stacked uri handlers
8              
9             sub _build_tree {
10             my ($package) = @_;
11             return unless $package;
12             no strict 'refs';
13             return map { $_, _build_tree($_) } @{"$package\::ISA"};
14             }
15              
16             # delay declarations
17             sub import {
18             my ( $self, $prefix ) = @_;
19             no strict 'refs';
20             ${"$self\::_prefix"} = $prefix;
21             my @tree = ($self, _build_tree($self));
22             my %seen;
23             foreach my $isa (@tree) {
24             foreach ( @{ ${"$isa\::_handler"} } ) {
25             my $path = join( '', $_->[0], $prefix, $_->[1] ) || '/';
26             next if $seen{$path};
27             debug( 'for', $self, $_->[0], $prefix . $_->[1], 'in', $isa);
28             $seen{$path} = 1;
29             foreach my $handler (@Dancer::OO::Dancer::route_handler) {
30             &{"Dancer\::$handler"}( $prefix . $_->[1], $_->[2]->($self) );
31             }
32             }
33             }
34             }
35              
36             =head1 NAME
37              
38             Dancer::OO::Object - root object for all packages
39              
40             =head1 VERSION
41              
42             Version 0.01
43              
44             =cut
45              
46             =head1 SYNOPSIS
47              
48             use parent 'Dancer::OO::Object';
49              
50             =head1 EXPORT
51              
52             =head1 SUBROUTINES/METHODS
53              
54             =cut
55              
56             =head1 AUTHOR
57              
58             Roman Galeev, C<< >>
59              
60             =head1 BUGS
61              
62             Please report any bugs or feature requests to C, or through
63             the web interface at L. I will be notified, and then you'll
64             automatically be notified of progress on your bug as I make changes.
65              
66             =head1 SUPPORT
67              
68             You can find documentation for this module with the perldoc command.
69              
70             perldoc Dancer::OO::Object
71              
72             You can also look for information at:
73              
74             =over 4
75              
76             =item * RT: CPAN's request tracker
77              
78             L
79              
80             =item * AnnoCPAN: Annotated CPAN documentation
81              
82             L
83              
84             =item * CPAN Ratings
85              
86             L
87              
88             =item * Search CPAN
89              
90             L
91              
92             =back
93              
94             =head1 ACKNOWLEDGEMENTS
95              
96             =head1 LICENSE AND COPYRIGHT
97              
98             Copyright 2012 Roman Galeev.
99              
100             This program is free software; you can redistribute it and/or modify it
101             under the terms of either: the GNU General Public License as published
102             by the Free Software Foundation; or the Artistic License.
103              
104             See http://dev.perl.org/licenses/ for more information.
105              
106             =cut
107              
108             1; # End of Dancer::OO::Object