File Coverage

lib/Module/AnyEvent/Helper/PPI/Transform/Net/Amazon/S3/Client/Object.pm
Criterion Covered Total %
statement 12 27 44.4
branch 0 4 0.0
condition 0 3 0.0
subroutine 4 8 50.0
pod 1 1 100.0
total 17 43 39.5


line stmt bran cond sub pod time code
1             package Module::AnyEvent::Helper::PPI::Transform::Net::Amazon::S3::Client::Object;
2              
3             # ABSTRACT: Additional transformer for Module::AnyEvent::Helper
4             our $VERSION = 'v0.04.0.80'; # VERSION
5              
6 1     1   469 use strict;
  1         1  
  1         26  
7 1     1   3 use warnings;
  1         2  
  1         20  
8              
9 1     1   3 use parent qw(Module::AnyEvent::Helper::PPI::Transform::Net::Amazon::S3);
  1         2  
  1         6  
10              
11 1     1   596 use Data::Dumper;
  1         5247  
  1         276  
12             my $arrayref = PPI::Document->new(\'[]');
13              
14             sub _is_enum_decl
15             {
16 0   0 0     return $_[0]->isa('PPI::Statement') &&
17             $_[0]->schild(0) && $_[0]->schild(0)->isa('PPI::Token::Word') && $_[0]->schild(0)->content eq 'enum';
18             }
19              
20             sub _is_bare_qw
21             {
22 0     0     my $qw = $_[0]->find_first('PPI::Token::QuoteLike::Words');
23 0 0         return _is_enum_decl($qw->parent) ? $qw : undef;
24             }
25              
26             sub document
27             {
28 0     0 1   my ($self, $doc) = @_;
29 0           $self->SUPER::document($doc);
30 0     0     my $enum = $doc->find(sub { _is_enum_decl($_[1]) });
  0            
31 0           foreach my $target (@$enum) {
32 0           my $qw = _is_bare_qw($target);
33 0 0         next unless $qw;
34 0           my $next = $qw->snext_sibling;
35 0           $qw->remove;
36 0           my $ctor = $arrayref->child(0)->child(0)->clone;
37 0           $ctor->add_element($qw);
38 0           $next->insert_before($ctor);
39             }
40             }
41              
42             1;
43              
44             __END__
45              
46             =pod
47              
48             =encoding UTF-8
49              
50             =head1 NAME
51              
52             Module::AnyEvent::Helper::PPI::Transform::Net::Amazon::S3::Client::Object - Additional transformer for Module::AnyEvent::Helper
53              
54             =head1 VERSION
55              
56             version v0.04.0.80
57              
58             =head1 SYNOPSIS
59              
60             use Module::AnyEvent::Helper::Filter -transformer => 'Net::Amazon::S3::Client::Object', -target => 'Net::Amazon::S3::Client::Object';
61              
62             =head1 DESCRIPTION
63              
64             This class is not intended to use directly.
65              
66             It is to fix https://github.com/pfig/net-amazon-s3/pull/42 in Net::Amazon::S3 0.60.
67              
68             =head1 AUTHOR
69              
70             Yasutaka ATARASHI <yakex@cpan.org>
71              
72             =head1 COPYRIGHT AND LICENSE
73              
74             This software is copyright (c) 2012 by Yasutaka ATARASHI.
75              
76             This is free software; you can redistribute it and/or modify it under
77             the same terms as the Perl 5 programming language system itself.
78              
79             =cut