Softpedia
 


LINUX CATEGORIES:



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

    String::MatchInterpolate 0.06

    Download button

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

    License / Price:

    Last Updated:

    Category:
    Paul Evans | More programs
    Perl Artistic License / FREE
    September 29th, 2007, 01:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    String::MatchInterpolate description

    It can perform named regexp capture and variable interpolation from the same template.

    String::MatchInterpolate can perform named regexp capture and variable interpolation from the same template.

    SYNOPSIS

    use String::MatchInterpolate;

    my $smi = String::MatchInterpolate->new( 'My name is ${NAME/w+/}' );

    my $vars = $smi->match( "My name is Bob" );
    my $name = $vars->{NAME};

    print $smi->interpolate( { NAME => "Jim" } ) . "n";


    This module provides an object class which represents a string matching and interpolation pattern. It contains named-variable placeholders which include a regexp pattern to match them on. An instance of this class represents a single pattern, which can be matched against or interpolated into.
    Objects in this class are not modified once constructed; they do not store any runtime state other than data derived arguments passed to the constructor.

    Template Format

    The template consists of a string with named variable placeholders embedded in it. It looks similar to a perl or shell string with interpolation:

    A string here with ${NAME/pattern/} interpolations

    The embedded variable is delmited by perl-style ${ } braces, and contains a name and a pattern. The pattern is a normal perl regexp fragment that will be used by the match() method. This regexp should not contain any capture brackets ( ) as these will confuse the parsing logic.

    Outside of the embedded variables, the string is interpreted literally; i.e. not as a regexp pattern. A backslash may be used to escape the following character, allowing literal backslashes or dollar signs to be used.

    The intended use for this object class is that the template strings would come from a configuration file, or some other source of "trusted" input. In the current implementation, there is nothing to stop a carefully-crafted string from containing arbitrary perl code, which would be executed every time the match() or interpolate() methods are called. (See "SECURITY" section). This fact may be changed in a later version.


    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    regexp capture | variable interpolation | Perl module | regexp | capture | variable

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

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