diff options
Diffstat (limited to 'lib/App/Dthumb.pm')
-rwxr-xr-x | lib/App/Dthumb.pm | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/lib/App/Dthumb.pm b/lib/App/Dthumb.pm index c4b7102..ecde021 100755 --- a/lib/App/Dthumb.pm +++ b/lib/App/Dthumb.pm @@ -47,7 +47,7 @@ use Cwd; use Image::Imlib2; our @EXPORT_OK = (); -our $VERSION = '0.1'; +our $VERSION = '0.2'; =head1 METHODS @@ -111,30 +111,32 @@ Default: false sub new { - my ($obj, $conf) = @_; + my ($obj, %conf) = @_; my $ref = {}; - $conf->{size} //= 200; - $conf->{spacing} //= 1.1; - $conf->{quality} //= 75; - $conf->{title} //= (split(qr{/}, cwd()))[-1]; - $conf->{lightbox} = !$conf->{'no-lightbox'}; - $conf->{names} = !$conf->{'no-names'}; + $conf{size} //= 200; + $conf{spacing} //= 1.1; + $conf{quality} //= 75; + $conf{title} //= (split(qr{/}, cwd()))[-1]; + $conf{file_index} //= 'index.xhtml'; + $conf{dir_thumbs} //= '.thumbs'; + $conf{dir_data} //= '.dthumb'; + - $ref->{config} = $conf; + # helpers to directly pass GetOptions results + $conf{lightbox} //= !$conf{'no-lightbox'}; + $conf{names} //= !$conf{'no-names'}; + + $ref->{config} = \%conf; $ref->{data} = App::Dthumb::Data->new(); $ref->{data}->set_vars( - title => $conf->{title}, - width => $conf->{size} * $conf->{spacing} . 'px', - height => $conf->{size} * $conf->{spacing} . 'px', + title => $conf{title}, + width => $conf{size} * $conf{spacing} . 'px', + height => $conf{size} * $conf{spacing} . 'px', ); - $ref->{config}->{file_index} = 'index.xhtml'; - $ref->{config}->{dir_thumbs} = '.thumbs'; - $ref->{config}->{dir_data} = '.dthumb'; - $ref->{html} = $ref->{data}->get('html_start'); return bless($ref, $obj); @@ -364,6 +366,10 @@ sub write_out_html { close($fh); } +sub version { + return $VERSION; +} + 1; __END__ |