You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oro-user@jakarta.apache.org by "Daniel F. Savarese" <df...@savarese.org> on 2004/09/07 10:26:31 UTC

Re: globcompiler and groups

In message <98...@pdxcorp1.vwsnet.com>, "Scott
 Deboy" writes:
>I'd like to use GlobCompiler and groups, but parens are being prefixed by a sl
>ash since they're in the __isPerl5MetaCharacter method.
...
>I can work around it by using a Perl5Compiler but I was curious if this was by
> design, and if so, is there an alternate way of defining groups?

GlobCompiler delegates to Perl5Compiler as a convenience.  The syntax
isn't supposed to be Perl, so capturing isn't supported.  Perl
metacharacters have to be escaped so that they retain their
expected meaning as part of a glob expression.  So, yes, the behavior
is intentional.  Otherwise the expressions wouldn't be glob expressions.

Still, this is an example of where static methods can be a bad thing.
Had globToPerl5 been non-static and __isPerl5MetaCharacter been made
non-static and protected _isPerl5MetaCharacter_, then you could
override _isPerl5MetaCharacter_ to get the behavior you want.
Static methods tend to get in the way of accommodating unanticipated
requirements.

If this sort of customization is something you would use, we can add
non-static equivalents of those methods (they'll just call the static
methods) and have compile() call the nonstatic version of globToPerl5).
That way no existing code will break.  But then you will be able to
subclass GlobCompiler and override _isPerl5MetaCharacter_ to not
escape the parens.

daniel



---------------------------------------------------------------------
To unsubscribe, e-mail: oro-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: oro-user-help@jakarta.apache.org