NAME

App::Followme::Web - Functions to parse html

SYNOPSIS

    use App::Followme::Web;

DESCRIPTION

This module contains the subroutines followme uses to parse html. The code is placed in a separate module because it is used by more than one other module.

SUBROUTINES

$flag = web_has_variables($text, @search_variables);

Return true if any of a list of variables is present in a template. The variable names must include the sigil.

$match_count = web_match_tags($pattern, $text, $matcher, $metadata, $global);

Match a tag pattern ($pattern) in a text ($text), pass the matched text to a function ($matcher), which processes it and places it in a hash ($metadata). Repeat this process for the entire text if the flag ($global) is set.

$section = web_parse_sections($text);

Place the text inside section tags into a hash indexed by the section names.

$parsed_tag = web_parse_tag($tag);

Parse a single html tag into a hash indexed by attribute name.

$tags = web_only_tags(@tokens);

Extract the tags from a text that has been split into tokens.

$text = web_only_text(@tokens);

Extract the text from a text that has been split into tokens.

$text = web_substitute_sections($text, $section);

Replace sections in a text by sections of the same name stored in a hash.

$text = web_substitute_tags($pattern, $text, $substituter, $output, $global);

Match a tag pattern ($pattern) in a text ($text), pass the matched text to a function ($substituter), which processes it and places it in a hash ($output) as well as replaces the matched text. Repeat this process for the entire text if the flag ($global) is set. Return the text with the substitutions.

$sections = web_titled_sections($pattern, $text, $titler);

Return a hash of sections from html, where the name of each section is derived from the header tags that precede it. The title is built by calling the subroutine passed in as $titler. It is passed the set of tags matched by $pattern. A hash of sections that preceded by a matching set of header tags is returned.

LICENSE

Copyright (C) Bernie Simon.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Bernie Simon <bernie.simon@gmail.com>