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