File Coverage

blib/lib/Struct/Path/PerlStyle/Functions.pm
Criterion Covered Total %
statement 18 18 100.0
branch 4 4 100.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 28 28 100.0


line stmt bran cond sub pod time code
1             package Struct::Path::PerlStyle::Functions;
2              
3 8     8   181 use 5.006;
  8         29  
4 8     8   46 use strict;
  8         20  
  8         214  
5 8     8   44 use warnings FATAL => 'all';
  8         17  
  8         372  
6 8     8   49 use parent 'Exporter';
  8         17  
  8         52  
7              
8             our @EXPORT_OK = qw(
9             back
10             );
11              
12             =head1 NAME
13              
14             Struct::Path::PerlStyle::Functions - Collection handy functions for
15             L hooks.
16              
17             =cut
18              
19             =head1 EXPORT
20              
21             Nothing is exported by default.
22              
23             =head1 Functions
24              
25             =head2 back
26              
27             Step back count times
28              
29             back(3); # go back 3 steps
30              
31             C returned when requested amount is greater than current step.
32              
33             =cut
34              
35             sub back {
36 4 100   4 1 1800 my $steps = defined $_[0] ? $_[0] : 1;
37              
38 4 100       9 return undef if ($steps > @{$_{path}});
  4         15  
39              
40 3         6 splice @{$_{path}}, -$steps;
  3         11  
41 3         4 splice @{$_{refs}}, -$steps;
  3         17  
42             }
43              
44             =head1 AUTHOR
45              
46             Michael Samoglyadov, C<< >>
47              
48             =head1 BUGS
49              
50             Please report any bugs or feature requests to
51             C, or through the web interface at
52             L. I
53             will be notified, and then you'll automatically be notified of progress on
54             your bug as I make changes.
55              
56             =head1 SUPPORT
57              
58             You can find documentation for this module with the perldoc command.
59              
60             perldoc Struct::Path::PerlStyle::Functions
61              
62             You can also look for information at:
63              
64             =over 4
65              
66             =item * RT: CPAN's request tracker (report bugs here)
67              
68             L
69              
70             =item * AnnoCPAN: Annotated CPAN documentation
71              
72             L
73              
74             =item * CPAN Ratings
75              
76             L
77              
78             =item * Search CPAN
79              
80             L
81              
82             =back
83              
84             =head1 SEE ALSO
85              
86             L, L, L, L
87              
88             =head1 LICENSE AND COPYRIGHT
89              
90             Copyright 2018 Michael Samoglyadov.
91              
92             This program is free software; you can redistribute it and/or modify it
93             under the terms of either: the GNU General Public License as published
94             by the Free Software Foundation; or the Artistic License.
95              
96             See L for more information.
97              
98             =cut
99              
100             1; # End of Struct::Path::PerlStyle::Functions