blib/lib/HTML/KhatGallery/Plugin/SortNaturally.pm

filter: Statementstmt 44.0% 11 / 25 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod 100% 2 / 2 totaltotal 44.4% 16 / 36 SCAR 16.4
CC
3
Cov
38%
sort_images
6.0
sort_dirs
6.0
BEGIN
1.0
CRAP 5.2
« Build ↑ Summary
1 package HTML::KhatGallery::Plugin::SortNaturally;
2 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 =head1 NAME
6  
7 HTML::KhatGallery::Plugin::SortNaturally - Plugin for khatgallery to use Natural sort for index lists.
8  
9 =head1 VERSION
10  
11 This describes version B<0.01> of HTML::KhatGallery::Plugin::SortNaturally.
12  
13 =cut
14  
15 4 our $VERSION = '0.01';
16  
17 =head1 SYNOPSIS
18  
19 # use the khatgallery script
20 khatgallery --plugins HTML::KhatGallery::Plugin::SortNaturally I<directory>
21
22 # from within a script
23 require HTML::KhatGallery;
24  
25 my @plugins = qw(HTML::KhatGallery:;Core HTML::KhatGallery::Plugin::SortNaturally);
26 HTML::KhatGallery->import(@plugins);
27 HTML::KhatGallery->run(%args);
28  
29 =head1 DESCRIPTION
30  
31 This is a plugin for khatgallery to use Natural sort for index lists.
32  
33 =cut
34  
35 4 ▶use Sort::Naturally;
Subroutine BEGIN: called CC=1 SCAR=0.0
36  
37 =head1 OBJECT METHODS
38  
39 Documentation for developers and those wishing to write plugins.
40  
41 =head1 Dir Action Methods
42  
43 Methods implementing directory-related actions. All such actions
44 expect a reference to a state hash, and generally will update either
45 that hash or the object itself, or both, in the course of their
46 running.
47  
48 =head2 sort_images
49  
50 Sorts the $dir_state->{files} array.
51  
52 =cut
53 sub sort_images {
54 0 ▶ my $self = shift;
Subroutine sort_images: not called CC=2 SCAR=17.9
Pod documented
55 0 my $dir_state = shift;
56  
57 0 ▶ if (@{$dir_state->{files}})
Branch: 1 branch
BranchTrueFalseTotal
if (@{$dir_state->{"files"};}) 0 0 0
58 {
59 0 my @images = nsort(@{$dir_state->{files}});
60 0 $dir_state->{files} = \@images;
61 }
62 } # sort_images
63  
64 =head2 sort_dirs
65  
66 Sorts the $dir_state->{subdirs} array.
67  
68 =cut
69 sub sort_dirs {
70 0 ▶ my $self = shift;
Subroutine sort_dirs: not called CC=2 SCAR=17.9
Pod documented
71 0 my $dir_state = shift;
72  
73 0 ▶ if (@{$dir_state->{subdirs}})
Branch: 1 branch
BranchTrueFalseTotal
if (@{$dir_state->{"subdirs"};}) 0 0 0
74 {
75 0 my @dirs = nsort(@{$dir_state->{subdirs}});
76 0 $dir_state->{subdirs} = \@dirs;
77 }
78 } # sort_dirs
79  
80  
81 =head1 REQUIRES
82  
83 Test::More
84 HTML::KhatGallery
85 Sort::Naturally
86  
87 =head1 INSTALLATION
88  
89 To install this module, run the following commands:
90  
91 perl Build.PL
92 ./Build
93 ./Build test
94 ./Build install
95  
96 Or, if you're on a platform (like DOS or Windows) that doesn't like the
97 "./" notation, you can do this:
98  
99 perl Build.PL
100 perl Build
101 perl Build test
102 perl Build install
103  
104 In order to install somewhere other than the default, such as
105 in a directory under your home directory, like "/home/fred/perl"
106 go
107  
108 perl Build.PL --install_base /home/fred/perl
109  
110 as the first step instead.
111  
112 This will install the files underneath /home/fred/perl.
113  
114 You will then need to make sure that you alter the PERL5LIB variable to
115 find the modules.
116  
117 Therefore you will need to change the PERL5LIB variable to add
118 /home/fred/perl/lib
119  
120 PERL5LIB=/home/fred/perl/lib:${PERL5LIB}
121  
122 =head1 SEE ALSO
123  
124 perl(1).
125  
126 =head1 BUGS
127  
128 Please report any bugs or feature requests to the author.
129  
130 =head1 AUTHOR
131  
132 Kathryn Andersen (RUBYKAT)
133 perlkat AT katspace dot com
134 http://www.katspace.org/tools
135  
136 =head1 COPYRIGHT AND LICENCE
137  
138 Copyright (c) 2006 by Kathryn Andersen
139  
140 This program is free software; you can redistribute it and/or modify it
141 under the same terms as Perl itself.
142  
143 =cut
144  
145 4 1; # End of HTML::KhatGallery::Plugin::SortNaturally
146 __END__
« Build ↑ Summary