[Petal] Modifiers and variables

William McKee william at knowmad.com
Wed Aug 18 14:34:20 BST 2004


On Mon, Aug 16, 2004 at 10:24:00PM +0100, Fergal Daly wrote:
> The patch attached moves about about 20 lines of code out of process() and
> into it's own subroutine called parse_args(). It also changes fetch() in the
> manner I explained earlier. Here's an example of a new modifier

Thanks, examples really help me grasp these ideas.


> #################
> package Reflect;

Interesting idea for a modifier <g>.


> Here's a more useful one:
> 
> ################
> 
> package Shorten;

I've implemented this in Petal::Utils as substr: though not with the
ability of cutting the string in half. This may prove a useful
addition if you don't mind me borrowing it.


> Give it a spin,

Cool, but I have to agree with Jean-Michel that I'd prefer the args not
be automatically parsed. However, I'm interested in your code that does
the parsing of the tokens. In the following line, has $TOKEN_RE already
been defined in Petal or is this coming from Petal::CodePerl?

    my @tokens = $argument =~ /($TOKEN_RE)/gsm;

Also, I've been under the misconception that s and m were mutually
exclusive regex modifiers. Apparently this is not the case. What
behavior are you seeking by setting in both of these?

Thanks,
William

-- 
Knowmad Services Inc.
http://www.knowmad.com


More information about the Petal mailing list