line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dancer2::Template::Caribou::DancerVariables; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
3
|
|
|
|
|
|
|
#ABSTRACT: Role providing Dancer attributes to the template objects |
4
|
|
|
|
|
|
|
$Dancer2::Template::Caribou::DancerVariables::VERSION = '1.0.0'; |
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
1773
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
74
|
|
7
|
3
|
|
|
3
|
|
11
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
62
|
|
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
10
|
use Moose::Role; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
21
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has "request" => ( |
13
|
|
|
|
|
|
|
is => 'ro', |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub uri_for { |
18
|
2
|
|
|
2
|
1
|
3264
|
$_[0]->request->uri_for($_[1]); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
1; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
__END__ |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=pod |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=encoding UTF-8 |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 NAME |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Dancer2::Template::Caribou::DancerVariables - Role providing Dancer attributes to the template objects |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 VERSION |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
version 1.0.0 |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 SYNOPSIS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
package Dancer2::View::MyView; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
use Moose; |
42
|
|
|
|
|
|
|
use Template::Caribou; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
with qw/ |
45
|
|
|
|
|
|
|
Template::Caribou |
46
|
|
|
|
|
|
|
Dancer2::Template::Caribou::DancerVariables |
47
|
|
|
|
|
|
|
/; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
template page => sub { |
50
|
|
|
|
|
|
|
my $self = shift; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
print ::RAW $self->uri_for( '/foo' ); |
53
|
|
|
|
|
|
|
}; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 DESCRIPTION |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
C<Dancer2::Template::Caribou::DancerVariables> adds attributes and methods to |
58
|
|
|
|
|
|
|
allow interactions with the L<Dancer2> application and its context. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 METHODS |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 request() |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Returns the current L<Dancer2::Core::Request> object. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 uri_for( $path ) |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Returns the absolute url for the given C<$path>. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 AUTHOR |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Yanick Champoux <yanick@babyl.dyndns.org> |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This software is copyright (c) 2013 by Yanick Champoux. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
79
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |