Hi,
I'm trying to use Template::Extract to extract data out of a string.
#!/usr/bin/perl use strict; use warnings; use Template::Extract; my $template = <new(); my $data = $template_extract->extract($template, $doc); use Data::Dumper; print Dumper($data); print $template;
The problem is that it isn't capturing the 'alloc_pg' at the end of each line. Obviously, it is something simple...
$VAR1 = {
'records' => [
{
'alloc_pg' => '',
'extent_id' => '608',
'oampg' => '600'
},
{
'alloc_pg' => '',
'extent_id' => '616',
'oampg' => '128'
}
]
};
[% FOREACH records %]
[% ... %]
OAMPG: [% oampg %] Extent ID [% extent_id %] on allocation page [% alloc_pg %]
[% END %]
Any ideas?
No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1
use Template::Extract; my $template = <<'EOD'; [% FOR records %] [% ... %] OAMPG: [% oampg %] Extent ID [% extent_id %] on allocation page [% alloc_pg =~ /(\d+)/%] [% END %] EOD my $doc = <I'm not sure what the exact problem is with [cpan://Template::Extract] but I suspect it is because it needs a trailing token for the match to halt.new->extract($template, $doc));
That makes sense... I'm glad it isn't my brain sans caffeine that is the issue ;-)
No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1
perlmonks.org content © perlmonks.org and broquaint, jfroebe
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03