The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Text::Chump - a module for parsing Chump like syntax

SYNOPSIS

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>"

DEPENDENCIES

This module has external dependencies on the following modules:

Test::More
Text::DelimMatch
Tie::IxHash
URI::Find

INSTALLATION

perl Makefile.PL
make test

and if all goes well

make install

HISTORY

v1.02 - Fixing some potential undef warnings

Found by Tom insam

AUTHOR

Copyright 2003, Simon Wistow <simon@thegestalt.org>

SEE ALSO

http://usefulinc.com/chump/, Bot::Basic::Pluggable::Blog, Template::Plugin::Chump, Text::WikiFormat, HTML::FromText, Tie::IxHash