line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Clustericious::Plugin::ClustericiousHelpers; |
2
|
|
|
|
|
|
|
|
3
|
24
|
|
|
24
|
|
9866
|
use strict; |
|
24
|
|
|
|
|
56
|
|
|
24
|
|
|
|
|
651
|
|
4
|
24
|
|
|
24
|
|
116
|
use warnings; |
|
24
|
|
|
|
|
45
|
|
|
24
|
|
|
|
|
510
|
|
5
|
24
|
|
|
24
|
|
361
|
use 5.010001; |
|
24
|
|
|
|
|
81
|
|
6
|
24
|
|
|
24
|
|
118
|
use Carp qw( carp ); |
|
24
|
|
|
|
|
48
|
|
|
24
|
|
|
|
|
1257
|
|
7
|
24
|
|
|
24
|
|
147
|
use base qw( Mojolicious::Plugin ); |
|
24
|
|
|
|
|
47
|
|
|
24
|
|
|
|
|
2907
|
|
8
|
24
|
|
|
24
|
|
150
|
use Mojo::ByteStream qw( b ); |
|
24
|
|
|
|
|
46
|
|
|
24
|
|
|
|
|
5338
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: Helpers for Clustericious |
11
|
|
|
|
|
|
|
our $VERSION = '1.27'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub register |
15
|
|
|
|
|
|
|
{ |
16
|
31
|
|
|
31
|
1
|
1276
|
my ($self, $app, $conf) = @_; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$app->helper(render_moved => sub { |
20
|
1
|
|
|
1
|
|
47
|
my($c,@args) = @_; |
21
|
1
|
|
|
|
|
13
|
$c->res->code(301); |
22
|
1
|
|
|
|
|
17
|
my $where = $c->url_for(@args)->to_abs; |
23
|
1
|
|
|
|
|
354
|
$c->res->headers->location($where); |
24
|
1
|
|
|
|
|
24
|
$c->render(text => "moved to $where"); |
25
|
31
|
|
|
|
|
233
|
}); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
31
|
|
|
|
|
502
|
do { |
29
|
31
|
|
|
|
|
103
|
my $client_class = ref($app) . "::Client"; |
30
|
31
|
100
|
100
|
|
|
1928
|
$client_class = 'Clustericious::Client' |
31
|
|
|
|
|
|
|
unless $client_class->can('new') |
32
|
|
|
|
|
|
|
|| eval qq{ require $client_class; $client_class->can('new') }; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
$app->helper(client => sub { |
35
|
13
|
|
|
13
|
|
16266
|
$client_class->new(config => $app->config); |
36
|
31
|
|
|
|
|
2033
|
}); |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=pod |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=encoding UTF-8 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 NAME |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Clustericious::Plugin::ClustericiousHelpers - Helpers for Clustericious |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 VERSION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
version 1.27 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 DESCRIPTION |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
This class provides helpers for Clustericious. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 HELPERS |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
In addition to the helpers provided by |
64
|
|
|
|
|
|
|
L<Mojolicious::Plugin::DefaultHelpers> you get: |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 render_moved |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
$c->render_moved($path); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Render a 301 response. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 client |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my $client = $c->client; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Returns the appropriate L<Clustericious::Client> object for your app. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 AUTHOR |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Original author: Brian Duggan |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Current maintainer: Graham Ollis E<lt>plicease@cpan.orgE<gt> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Contributors: |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Curt Tilmes |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Yanick Champoux |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This software is copyright (c) 2013 by NASA GSFC. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
95
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |