'm' treats the string as a multi-line and lets ^ and $ match next to embedded newlines.
's' treats the string as a single line and lets '.' match embedded newlines.
so use one or the other - not both.
also, why don't you just use the 'testcode' property, like:
$t->{'issues'}{'testcode'} = sub {
my ($node, $t) = @_;
$t->{'pre'} = load_status($node); # handle the 'pre' inside the 'testcode'
return 1;
};
sub load_status {
my $node = shift;
# load and return status list from DB for single-select;
}
instead of hacking something together to eval your text block with the 'sub load_status' in it? Especially since trying to match a subroutine block is much more complex than your regex would pick up (what happens in your regex if the subroutine has any curly brackets before the end of the subroutine block?).
Hope this helps.
Ryan
On Friday, May 30, 2003, at 07:22 PM, Christopher B. Liebman wrote:
I'm using XPathScript to create form (PerForm) elements in an XML file. I
need interpolation turned on *and* I need to create a 'pre' like:
$t->{'issues'}{pre} =' sub load_status { # load and return status list from DB for single-select } ';
The problem is that this matches the regex used to interpolate... I have
hacked my version to bail and do *no* interpolation if the string matches
"m/^sub\s+.*\{(.+?)\}/ms" a bt cheesy but works for now. I'd much rather
see the regex matching improved to not match sub decls... any ideas? (I'm
not the greatest with perl regex)
-- CHris
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
