Name           DSLI  Description
-------------  ----  --------------------------------------------
Text::Tokens   bdpO  Base class for parsing text with tokens

I wrote Text::Tokens for the sole purpose of having a small and simple token
parsing base class, something easy to work and relatively speedy. The module
is quite short and simple.

What fer? I can subclass class Text::Tokens, with say Text::Tokens::Perl,
override the token method, and the ether method ('ether' is what's out side
the tokens), slap an eval on the token, and boom, you have An embedded perl
template parser. I could do the same to parse certain tags from HTML...you
get the picture.

I was originally thinking about using Text::Atoms (which I like) but then
thought that Text::Tokens (I don't see that being used already) would be a
natural.

There's a brief synopsis below if you are interested.

Any comments, recommendations?

--
Steve McKay
Colgreen Internet Development
http://www.colgreen.com/
[EMAIL PROTECTED]
(562) 951-9128


SYNOPSIS
      use Text::Tokens;
      @ISA = ('Text::Tokens');

      # override SUPER::token
      sub token
      {
        my $self = shift;
        my $token = shift;
        # $token->[0] - left bracket
        # $token->[1] - contents
        # $token->[2] - right bracket
        # do something with the token...
      }

      # override SUPER::ether
      sub ether
      {
        # my $self = shift;
        # my $text = shift;
        # do something with the text...
      }

      #... else where ...

      $self->text("Some text with [-TOKENS-] in it");
      $self->delimiters(['[-','-]']);
      $self->parse();


Reply via email to