summaryrefslogtreecommitdiff
path: root/lib/App/Dthumb/Data.pm.PL
diff options
context:
space:
mode:
Diffstat (limited to 'lib/App/Dthumb/Data.pm.PL')
-rw-r--r--lib/App/Dthumb/Data.pm.PL82
1 files changed, 82 insertions, 0 deletions
diff --git a/lib/App/Dthumb/Data.pm.PL b/lib/App/Dthumb/Data.pm.PL
index 0e602ef..6ebea05 100644
--- a/lib/App/Dthumb/Data.pm.PL
+++ b/lib/App/Dthumb/Data.pm.PL
@@ -38,6 +38,33 @@ close($out_fh);
__DATA__
package App::Dthumb::Data;
+
+=head1 NAME
+
+App::Dthumb::Data - Retrieve installed data (like lightbox images)
+
+=head1 SYNOPSIS
+
+ use App::Dthumb::Data;
+ my $data = App::Dthumb::Data->new();
+
+ $data->set_vars(
+ title => 'Something funky',
+ );
+
+ print $data->get('html_start.dthumb');
+
+ open(my $fh, '>', 'close.png');
+ print {$fh} $data->get('close.png');
+ close($fh);
+
+=head1 VERSION
+
+This manual documents B<App::Dthumb::Data> version 0.2
+
+=cut
+
+
use strict;
use warnings;
use base 'Exporter';
@@ -48,22 +75,59 @@ use MIME::Base64 qw(decode_base64);
our @EXPORT_OK = ();
our $VERSION = '0.2';
+
+=head1 METHODS
+
+=head2 new
+
+Returns a new B<App::Dthumb> object. Does not take any arguments.
+
+=cut
+
+
sub new {
my ($obj) = @_;
my $ref = {};
return bless($ref, $obj);
}
+
+=head2 set_vars(%vars)
+
+Set replacement variables. For each hash key, when outputting data using the
+B<get> function, dthumb will replace occurences of "<!-- $key -->" or "/* $key
+*/" (the dollar sign is literal) with its value.
+
+=cut
+
+
sub set_vars {
my ($self, %vars) = @_;
$self->{replace} = \%vars;
}
+
+=head2 list_archived
+
+Returns an array of all saved data. That is, all files which do not end in
+".dthumb".
+
+=cut
+
+
sub list_archived {
my ($self) = @_;
return grep { ! /\.dthumb$/ } $self->section_data_names();
}
+
+=head2 get($filename)
+
+Returns the exact content of share/$filename.
+
+=cut
+
+
sub get {
my ($self, $name) = @_;
my $data = $self->section_data($name);
@@ -93,5 +157,23 @@ sub get {
1;
+=head1 DEPENDENCIES
+
+=over
+
+=item * Data::Section
+
+=back
+
+=head1 AUTHOR
+
+Copyright (C) 2011 by Daniel Friesel E<lt>derf@chaosdorf.deE<gt>
+
+=head1 LICENSE
+
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
+
+=cut
+
__DATA__