File Coverage

blib/lib/HiD/Server/Handler.pm
Criterion Covered Total %
statement 8 20 40.0
branch 0 2 0.0
condition 0 3 0.0
subroutine 3 5 60.0
pod 2 2 100.0
total 13 32 40.6


line stmt bran cond sub pod time code
1             # ABSTRACT: Helper for 'hid publish -A'
2              
3              
4             package HiD::Server::Handler;
5             our $AUTHORITY = 'cpan:GENEHACK';
6             $HiD::Server::Handler::VERSION = '1.991';
7 4     4   64 use 5.014; # strict, unicode_strings
  4         15  
8 4     4   22 use warnings;
  4         11  
  4         115  
9              
10 4     4   16 use parent 'Plack::Handler::Standalone';
  4         10  
  4         20  
11              
12              
13             sub new {
14 0     0 1   my( $class , %args ) = @_;
15              
16 0           my $hid = delete $args{hid};
17              
18 0 0 0       die "I must be passed something that can('publish') not a '$hid'!\n"
19             unless defined $hid and $hid->can('publish');
20              
21 0           my $self = $class->SUPER::new(%args);
22              
23 0           $self->{__hid__} = $hid;
24              
25 0           return $self;
26              
27             }
28              
29              
30             sub republish {
31 0     0 1   my $self = shift;
32              
33 0           my $hid = $self->{__hid__};
34              
35 0           $hid->reset_hid();
36              
37             # FIXME eeeeevvvviillll
38 0           $hid->config(); # force builder to fire
39 0           $hid->{hid}{config}{clean_destination} = 1; # get up in them guts
40              
41 0           $hid->publish();
42             }
43              
44             1;
45              
46             __END__
47              
48             =pod
49              
50             =encoding UTF-8
51              
52             =head1 NAME
53              
54             HiD::Server::Handler - Helper for 'hid publish -A'
55              
56             =head1 METHODS
57              
58             =head2 new
59              
60             Constructor.
61              
62             =head2 republish
63              
64             Handles resetting the embedded L<HiD> object and calling the C<publish> method
65             on it.
66              
67             =head1
68              
69             Helper for C<hid publish -A>
70              
71             =head1 VERSION
72              
73             version 1.991
74              
75             =head1 AUTHOR
76              
77             John SJ Anderson <genehack@genehack.org>
78              
79             =head1 COPYRIGHT AND LICENSE
80              
81             This software is copyright (c) 2015 by John SJ Anderson.
82              
83             This is free software; you can redistribute it and/or modify it under
84             the same terms as the Perl 5 programming language system itself.
85              
86             =cut