Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    Template::Provider::FromDATA 0.12

    Download button

    No screenshots available
    Downloads: 399  Tell us about an update
    User Rating:
    Rated by:
    Good (3.2/5)
    10 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Brian Cassidy | More programs
    Perl Artistic License / FREE
    April 20th, 2012, 03:13 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Template::Provider::FromDATA description

    A Perl module that can load templates from your __DATA__ section.

    Template::Provider::FromDATA is a Perl module that can load templates from your __DATA__ section.

    SYNOPSIS

    use Template;
    use Template::Provider::FromDATA;

    # Create the provider
    my $provider = Template::Provider::FromDATA->new( {
    CLASSES => __PACKAGE__
    } );

    # Add the provider to the config
    my $template = Template->new( {
    # ...
    LOAD_TEMPLATES => [ $provider ]
    } );

    # ...and now the templates

    __DATA__

    __mytemplate__
    Foo [% bar %]

    __myothertemplate__
    Baz, [% qux %]?

    METHODS

    new( %OPTIONS )

    Create a new instance of the provider. The only option you can specify is CLASSES which will tell the provider what classes to search for templates. By omitting this option it will search main.

    # defaults to 'main'
    $provider = Template::Provider::FromDATA->new;

    # look for templates in 'Foo'
    $provider = Template::Provider::FromDATA->new;( {
    CLASSES => 'Foo'
    } );

    # look for templates in 'Foo::Bar' and 'Foo::Baz'
    $provider = Template::Provider::FromDATA->new;( {
    CLASSES => [ 'Foo::Bar', 'Foo::Baz' ]
    } );
    _init( %OPTIONS )

    A subclassed method to handle the options passed to new().

    fetch( $name )

    This is a subclassed method that will load a template via _fetch() if a non-reference argument is passed.

    _load( $name )

    Loads the template via the get_file() sub and sets some cache information.

    get_file( $class, $template )

    This method searches through $class for a template named $template. Returns the contents on success, undef on failure.

    This function was mostly borrowed from Catalyst::Helper's get_file function.

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    template provider | FormDATA templates | Perl module | template | provider | Perl

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM