Text::CaffeinatedMarkup::PullParser
use Text::CaffeinatedMarkup::PullParser; my $parser = Text::CaffeinatedMarkup::PullParser->new( pml => 'Parse **this**' ); my @tokens = $parser->get_all_tokens; # or while (my $token = $parser->get_next_token) { # ... }
This module implements a Pull Parser for The Caffeinated Markup Language. For details on the syntax that CML implements, please see the Github wiki.
The Caffeinated Markup Language
This module isn't designed to be used directly in a client, but instead used by a formatter such as Text::CaffeinatedMarkup::HTMLFormatter.
This module implements the following methods.
my $token = $parser->get_next_token;
Whilst there is a token to return, this method will return it. If there are no tokens left then this will return 0 (zero).
my @tokens = $parser->get_all_tokens; my $tokens_r = $parser->get_all_tokens;
Returns all the tokens from the parsed document.
Please note, this uses get_next_token internally so, if you've already called get_next_token a couple of times and rhen call get_all_tokens, then get_all_tokens will return all the rest of the tokens from that point onwards and not the entire document.
get_next_token
get_all_tokens
The Github wiki
J Gregory <jgregory@cpan.org>
To install Text::CaffeinatedMarkup::PullParser, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::CaffeinatedMarkup::PullParser
CPAN shell
perl -MCPAN -e shell install Text::CaffeinatedMarkup::PullParser
For more information on module installation, please visit the detailed CPAN module installation guide.