[Pdx-pm] Data::Dumper::Simple and source filters

Ovid publiustemp-pdxpm at yahoo.com
Wed May 18 11:39:31 PDT 2005


--- Tom Phoenix <tom.phoenix at gmail.com> wrote:
> On 5/18/05, Ovid <publiustemp-pdxpm at yahoo.com> wrote:
> 
> > The relevant line of code in the
> > source filter is this:
> > 
> >   $DUMPER_FUNCTION\s*\(([^)]+)\)
> 
> Can you also have it look for $DUMPER_FUNCTION followed by a
> comma-separated list of variable names followed by a semicolon? That
> is, can you have two different syntaxes that both trigger your code?

Sure.

  my $COMMA = qr/(?:,|=>)/;
  my $SIGIL = qr/$@%*&/;
  my $ATOM  = qr/[[:word:]]+/;
  my $SEP   = qr/::/;
  my $VAR   = qr/$SIGIL$SEP?$ATOM(?:$SEP$ATOM)*/;

  my $WITH_PARENS = qr/$DUMPER_FUNCTION\s*\(([^)]+)\)/;
  my $VAR_LIST    = qr/$VAR\s*(?:$COMMA\s*$VAR)*/;

  my $MATCH = qr/($WITH_PARENS|$VAR_LIST)/;

That seems more trouble than it's worth and I assume it's buggy. 
Patches welcome :)

Cheers,
Ovid

-- 
If this message is a response to a question on a mailing list, please send
follow up questions to the list.

Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/


More information about the Pdx-pm-list mailing list