From 8a7d7ab0eab7f7fdbe14631fa3e1e28825881884 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 2 Mar 2011 20:17:31 +0100 Subject: App::Dthumb::Data documentation --- lib/App/Dthumb/Data.pm.PL | 82 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) 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 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 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 function, dthumb will replace occurences of "" 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 Ederf@chaosdorf.deE + +=head1 LICENSE + + 0. You just DO WHAT THE FUCK YOU WANT TO. + +=cut + __DATA__ -- cgit v1.2.3