Here's what I'm starting with
#$Id: MultiMarkdown.pm 4103 2009-03-02 20:41:50Z andrew $
package Template::Plugin::MultiMarkdown;
use strict;
use base qw (Template::Plugin::Filter);
use Text::MultiMarkdown;
our $VERSION = 0.03;
sub init {
my $self = shift;
$self->{_DYNAMIC} = 1;
$self->install_filter($self->{_ARGS}->[0] || 'multimarkdown');
return $self;
}
sub filter {
my ($self, $text, $args, $config) = @_;
my $m = Text::MultiMarkdown->new(%{$config || {}});
return $m->markdown($text);
}
1;
I want to change the reference to the Perl moudule Text::MultiMarkdown
to use an executable /usr/local/bin/multimarkdown
I think I need to change:
use Text::MultiMarkdown;
To
use IPC::run3
and then the my $m
line involves a call to run3
, but then I'm lost.
I have found some mentions of how to write a filter on both the Template Toolkit mailing list, and on Perl Monks, but in both cases the answer assumes that I know something that I don't and it goes right over my head, hence the request here.
I asked a similar question earlier, but the answer given didn't seem to apply to using an external program.
Here is a simple example of a filter that calls an external program (
perl
) to replace all occurences of "Hello" with "Bye". It usesIPC::Run3
: