The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Blosxom::Template - Intuitive interface of %blosxom::template

SYNOPSIS

  use Blosxom::Template;

  my %templates = ( html => { foo => 'bar' } );

  my $t = Blosxom::Template->new(\%templates);
  my $value = $t->get('foo.html');
  my $bool = $t->exists('foo.html');

  $t->set('foo.html' => 'baz'); # overwrites existent template
  $t->remove('foo.html');

  $t->{templates}; # same reference as \%templates

DESCRIPTION

Blosxom, a weblog application, exports %template which holds default values of templates. The data structure of this hash is as follows:

  %blosxom::template = (
      'html' => {
          'foo' => 'bar',
      },
  );

When you get a value of this, you must write as follows:

  my $value = $blosxom::template{html}{foo};

It doesn't seem intuitive.

If you used this module, you might write as follows:

  my $t = Blosxom::Template->new(\%blosxom::template);
  my $value = $t->get('foo.html');

METHODS

$t = Blosxom::Template->new(\%templates)

Creates a new Blosxom::Template object. This object holds a reference to the original given \%templates argument.

$t->get('foo.html')

Returns a value of the specified template.

$t->exists('foo.html')

Returns a Boolean value telling whether the specified template exists.

$t->set('foo.html' => 'baz')

Sets a value of the specified template.

$h->remove('foo.html')

Deletes the specified element from templates.

EXAMPLES

DEPENDENCIES

Blosxom 2.1.2

SEE ALSO

Blosxom::Header

AUTHOR

Ryo Anazawa (anazawa@cpan.org)

LICENSE AND COPYRIGHT

Copyright (c) 2011 Ryo Anazawa. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.