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.PL14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/App/Dthumb/Data.pm.PL b/lib/App/Dthumb/Data.pm.PL
index c1f1ed2..a686c6d 100644
--- a/lib/App/Dthumb/Data.pm.PL
+++ b/lib/App/Dthumb/Data.pm.PL
@@ -54,6 +54,11 @@ sub new {
return bless($ref, $obj);
}
+sub set_vars {
+ my ($self, %vars) = @_;
+ $self->{replace} = \%vars;
+}
+
sub get {
my ($self, $name) = @_;
my $data = $self->section_data($name);
@@ -65,6 +70,15 @@ sub get {
if ($name =~ qr{ \. (png | gif) $ }ox) {
return decode_base64(${$data});
}
+
+ while (my ($key, $value) = each %{$self->{replace}}) {
+ ${$data} =~ s{
+ ( \<\!-- | /\* )
+ \s+ \$ $key \s+
+ ( --\> | \*/ )
+ }{$value}gx;
+ }
+
return ${$data};
}