The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Blosxom::Component::DataSection - Read data from __DATA__

SYNOPSIS

  package my_plugin;
  use strict;
  use warnings;
  use parent 'Blosxom::Plguin';

  __PACKAGE__->load_components( 'DataSection' );

  sub start {
      my $class = shift;

      my $template = $class->get_data_section( 'my_plugin.html' );
      # <!DOCTYPE html>
      # ...

      # merge __DATA__ into Blosxom default templates
      $class->merge_data_section_into( \%blosxom::template );

      return 1;
  }

  1;

  __DATA__

  @@ my_plugin.html

  <!DOCTYPE html>
  <html>
  <head>
    <meta charset="utf-8">
    <title>My Plugin</title>
  </head>
  <body>
  <h1>Hello, world</h1>
  </body>
  </html>

DESCRIPTION

This module extracts data from __DATA__ section of the plugin, and also merges them into Blosxom default templates.

METHODS

$template = $class->get_data_section( $name )

This method returns a string containing the data from the named section.

@names = $class->data_section_names

This returns a list of all the names that will be recognized by the get_data_section() method.

$class->merge_data_section_into( \%blosxom::template )

Given a reference to a hash which holds Blosxom default templates, merges __DATA__ into the hash. The following data structure is expected:

  {
      html => {
          head  => '<html><head>...',
          story => '<p><a name="$fn">...',
      },
      rss => {
          head  => '<?xml version="1.0">...',
          story => '<item>...',
      },
  }

SEE ALSO

Blosxom::Plugin, Data::Section::Simple

AUTHOR

Ryo Anazawa <anazawa@cpan.org>

LICENSE

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