Text::Parser::Manual::CollectedExamples - A collection of examples using Text::Parser
version 1.000
use strict; use Text::Parser; my $parser = Text::Parser->new(); $parser->BEGIN_rule( do => '~errors = 0; ~warnings = 0; ~fatal = 0; ~info = 0;' ); $parser->add_rule( if => '$1 eq "ERROR:"', do => '~errors++;', dont_record => 1, ); $parser->add_rule( if => '$1 eq "WARNING:"', do => '~warnings++;', dont_record => 1, ); $parser->add_rule( if => '$1 eq "INFO:"', do => '~info++;', dont_record => 1, ); $parser->add_rule( if => '$1 eq "FATAL:"', do => '~fatal++;', dont_record => 1, ); $parser->read('/path/to/logfile.log'); my (%log_stats) = $parser->stashed;
This is a stub...
You're invited to contribute your examples of how you use this package. Contributions will be acknowledged.
Please report any bugs or feature requests on the bugtracker website http://github.com/balajirama/Text-Parser/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
Balaji Ramasubramanian <balajiram@cpan.org>
This software is copyright (c) 2018-2019 by Balaji Ramasubramanian.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Text::Parser, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::Parser
CPAN shell
perl -MCPAN -e shell install Text::Parser
For more information on module installation, please visit the detailed CPAN module installation guide.