File Coverage

blib/lib/HTML/KhatGallery.pm
Criterion Covered Total %
statement 19 19 100.0
branch 4 6 66.6
condition n/a
subroutine 4 4 100.0
pod n/a
total 27 29 93.1


line stmt bran cond sub pod time code
1             package HTML::KhatGallery;
2             our $VERSION = '0.24'; # VERSION
3 3     3   149597 use strict;
  3         22  
  3         74  
4 3     3   14 use warnings;
  3         4  
  3         213  
5              
6             =head1 NAME
7              
8             HTML::KhatGallery - HTML photo album generator.
9              
10             =head1 VERSION
11              
12             version 0.24
13              
14             =head1 SYNOPSIS
15              
16             # use the khatgallery script
17             khatgallery --plugins HTML::KhatGallery::Plugin::MyPlugin I
18            
19             # from within a script
20             require HTML::KhatGallery;
21              
22             my @plugins = qw(HTML::KhatGallery:;Core HTML::KhatGallery::Plugin::MyPlugin);
23             HTML::KhatGallery->import(@plugins);
24             HTML::KhatGallery->run(%args);
25              
26             =head1 DESCRIPTION
27              
28             HTML::KhatGallery generates a HTML photo gallery. It takes a directory
29             of images, and generates the HTML pages and thumbnails needed.
30              
31             This includes the khatgallery script (to generate the gallery)
32             and the kg_image_info script (to get information about an image).
33              
34             I decided to write this because, while there are gazillion gallery scripts
35             out there, none of them do quite what I want, and I wanted to take nice
36             features from different scripts and bring them together.
37              
38             =over
39              
40             =item *
41              
42             Pre-generated (baked, not fried)
43              
44             =item *
45              
46             Can recurse down into sub-directories of the top gallery directory.
47              
48             =item *
49              
50             Generates only new files by default.
51              
52             =item *
53              
54             Can clean out unused files.
55              
56             =item *
57              
58             Can force regeneration of HTML or thumbnails.
59              
60             =item *
61              
62             Does not require Javascript.
63              
64             =item *
65              
66             Ability to add plugins.
67              
68             =item *
69              
70             Meta-data from more than just jpeg files.
71              
72             =item *
73              
74             Multi-page albums. That is, directories with lots of images can show
75             only so many images per index page, instead of having to load every
76             single thumbnail.
77              
78             =item *
79              
80             Very simple page template, not complicated themes.
81              
82             =item *
83              
84             Pixel-area thumbnails (rather than conforming to particular width or
85             height, you get higher-quality thumbnails by making them have a given
86             area).
87              
88             =item *
89              
90             XHTML compliant.
91              
92             =item *
93              
94             Dynamic columns with CSS and HTML, rather than fixed tables.
95              
96             =back
97              
98             =head2 The Name
99              
100             KhatGallery comes from a slight mangling of "Kat's HTML Gallery"; it's
101             so hard to come up with names that haven't already been used.
102              
103             =cut
104              
105             =head1 CLASS METHODS
106              
107             =head2 import
108              
109             require HTML::KhatGallery;
110              
111             HTML::KhatGallery->import(@plugins);
112              
113             This needs to be run before L.
114             See L for more information.
115              
116             This loads plugins, modules which subclass HTML::KhatGallery and override its
117             methods and/or make additional methods. The arguments of this method are the
118             module names, in the order in which they should be loaded. The given modules
119             are required and arranged in an "is-a" chain. That is, HTML::KhatGallery
120             subclasses the last plugin given, which subclasses the second-to-last, up to
121             the first plugin given, which is the base class.
122              
123             This can be called in two different ways. It can be called implicitly
124             with the "use" directive, or it can be called explicitly if one 'requires'
125             HTML::KhatGallery rather then 'use'-ing it.
126              
127             The advantage of calling this explicitly is that one can set the
128             plugins dynamically, rather than hard-coding them in the calling
129             script.
130              
131             (idea taken from Module::Starter by Andy Lester and Ricardo Signes)
132              
133             =cut
134             sub import {
135 2     2   17 my $class = shift;
136              
137 2 50       8 my @plugins = @_ ? @_ : 'HTML::KhatGallery::Core';
138 2         2 my $parent;
139              
140 3     3   16 no strict 'refs';
  3         13  
  3         357  
141 2         5 for (@plugins, $class) {
142 4 100       9 if ($parent) {
143 2         88 eval "require $parent;";
144 2 50       15 die "couldn't load plugin $parent: $@" if $@;
145 2         4 push @{"${_}::ISA"}, $parent;
  2         24  
146             }
147 4         29 $parent = $_;
148             }
149             } # import
150              
151             =head1 REQUIRES
152              
153             Test::More
154             POSIX
155             File::Basename
156             File::Spec
157             Cwd
158             File::stat
159             YAML
160             Image::Info
161             Image::Magick
162              
163             =head1 INSTALLATION
164              
165             To install this module, run the following commands:
166              
167             perl Build.PL
168             ./Build
169             ./Build test
170             ./Build install
171              
172             Or, if you're on a platform (like DOS or Windows) that doesn't like the
173             "./" notation, you can do this:
174              
175             perl Build.PL
176             perl Build
177             perl Build test
178             perl Build install
179              
180             In order to install somewhere other than the default, such as
181             in a directory under your home directory, like "/home/fred/perl"
182             go
183              
184             perl Build.PL --install_base /home/fred/perl
185              
186             as the first step instead.
187              
188             This will install the files underneath /home/fred/perl.
189              
190             You will then need to make sure that you alter the PERL5LIB variable to
191             find the modules, and the PATH variable to find the script.
192              
193             Therefore you will need to change:
194             your path, to include /home/fred/perl/script (where the script will be)
195              
196             PATH=/home/fred/perl/script:${PATH}
197              
198             the PERL5LIB variable to add /home/fred/perl/lib
199              
200             PERL5LIB=/home/fred/perl/lib:${PERL5LIB}
201              
202              
203             =head1 SEE ALSO
204              
205             perl(1).
206              
207             =head1 BUGS
208              
209             Please report any bugs or feature requests to the author.
210              
211             =head1 AUTHOR
212              
213             Kathryn Andersen (RUBYKAT)
214             perlkat AT katspace dot org
215             http://www.katspace.org/tools
216              
217             =head1 COPYRIGHT AND LICENCE
218              
219             Copyright (c) 2006 by Kathryn Andersen
220              
221             This program is free software; you can redistribute it and/or modify it
222             under the same terms as Perl itself.
223              
224             =cut
225              
226             1; # End of HTML::KhatGallery
227             __END__