Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Libraries

    Text::PSP 1.013

    Download button

    No screenshots available
    Downloads: 873  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Joost Diepenmaat | More programs
    Perl Artistic License / FREE
    September 21st, 2007, 00:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    Text::PSP description

    Text::PSP is a Perl extension implementing a JSP-like templating system.

    Text::PSP is a Perl extension implementing a JSP-like templating system.

    SYNOPSIS

    use Text::PSP;

    my $psp_engine = Text::PSP->new(
    template_root => 'templates',
    workdir => '/tmp/psp_work',
    );
    my $template_object = $psp_engine->template('/home/joost/templates/index.psp');
    my @out = $template_object->run(@arguments);

    print @out;

    The Text::PSP system consists of 3 modules: Text::PSP, Text::PSP::Parser and Text::PSP::Template. The parser creates perl modules from the input files, which are subclasses of Text::PSP::Template. Text::PSP is the module overseeing the creation and caching of the templates.

    You can use the basics of the JSP system:


    Hello, World - this is text mode

    That was an expression

    method %>
    And insert mode again

    includes


    and includes that search for a file upwards to the template
    root


    For a complete description of the template constructs, see Text::PSP::Syntax.

    METHODS

    new

    my $psp = Text::PSP->new(
    template_root => './templates',
    workdir => './work',
    );

    Instantiates a new Text::PSP object.

    Parameters

    template_root

    The root directory for the template files. No templates outside the template_root can be run by this Text::PSP object. This is a required parameter.

    workdir

    The directory in which to store the translated templates. This is a required parameter.

    create_workdir

    If this parameter is true and the workdir doesn't exist, one will be created. Default is false.

    template

    my $template = $psp->template("index.psp");
    # or
    my $template = $psp->template("index.psp", force_rebuild => 1);

    Get a template object from a template file. This will translate the template file into a Text::PSP::Template module if needed.

    Optional arguments:

    force_rebuild

    Always rebuild the resulting .pm file and reload it (useful for development). Normally, the .pm file is only built if the top most template file is newer than the resulting module. This can be really annoying if you're developing and are only changing some included file.

    find_template
    my $template = $psp->find_template("some/path/index.psp");
    # or
    my $template = $psp->find_template("some/path/index.psp", force_rebuild => 1);

    Similar to the template() method, but searches for a file starting at the specified path, working up to the template_root.

    The returned template object will behave as if it really were in the specified path, regardless of the real location of the template in the file system, so for instance any include and find directives will work from that path.

    clear_workdir

    $psp->clear_workdir();

    This will remove the entire content of the work directory, cleaning up disk space and forcing new calls to $psp->template() to recompile the template file.

    Requirements:

    · Perl



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    JSP templating | templating system | Perl module | JSP | template | Perl

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

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