Text::Chump - a module for parsing Chump like syntax
use Text::Chump; my $tc = Text::Chump->new(); $tc->chump('[all mine!|http://thegestalt.org]'); # returns <a href='http://thegestalt.org'>all mine!</a> $tc->chump('+[all mine!|http://thegestalt.org]'); # returns <img src='http://thegestalt.org' alt='all mine!'> $tc->chump('http://thegestalt.org'); # returns <a href='http://thegestalt.org'>http;//thegestalt.org</a> my $tc = Text::Chump->new({images=>0}); $tc->chump('+[all mine!|http://thegestalt.org]'); # returns '+[all mine!|http://thegestalt.org]' sub foo { my ($url, $label) = @_; return "$label ($url)"; } $tc->install('link',\&foo); $tc->chump('[foo|http://bar.com]'); # returns 'foo (http://bar.com)' sub quirka { my ($opts, $match, $label) = @_; return "<a href="blog.cgi?entry=$match">$label</a>"; } $tc->install('link',\$quirka,'\d+'); $tc->chump('[stuff|4444]'); # returns "<a href="blog.cgi?entry=4444">stuff</a>"
This module has external dependencies on the following modules:
Test::More Text::DelimMatch Tie::IxHash URI::Find
perl Makefile.PL make test
and if all goes well
make install
v1.02 - Fixing some potential undef warnings
Found by Tom insam
Copyright 2003, Simon Wistow <simon@thegestalt.org>
http://usefulinc.com/chump/, Bot::Basic::Pluggable::Blog, Template::Plugin::Chump, Text::WikiFormat, HTML::FromText, Tie::IxHash
To install Text::Chump, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::Chump
CPAN shell
perl -MCPAN -e shell install Text::Chump
For more information on module installation, please visit the detailed CPAN module installation guide.