File Coverage

blib/lib/HTML/LinkAdd.pm
Criterion Covered Total %
statement 51 58 87.9
branch 20 30 66.6
condition 7 24 29.1
subroutine 5 6 83.3
pod 0 3 0.0
total 83 121 68.6


line stmt bran cond sub pod time code
1             package HTML::LinkAdd;
2             our $VERSION = 0.13; # POD and link titles
3            
4 1     1   22576 use strict;
  1         2  
  1         38  
5 1     1   5 use warnings;
  1         2  
  1         27  
6 1     1   403918 use HTML::TokeParser;
  1         16884  
  1         1184  
7            
8             =head1 NAME
9            
10             HTML::LinkAdd - Add hyperlinks to phrases in HTML documents
11            
12             =head1 SYNOPSIS
13            
14             use HTML::LinkAdd;
15             my $page = new HTML::LinkAdd(
16             'testinput1.html', {
17             'the clocks were striking thirteen'=>'footnotes.html#OrwellG-1',
18             'updated' => ['updated.html', 'View the latest update],
19             });
20             warn $page -> hyperlinked;
21             $page ->save ('output.html');
22            
23             =head1 DESCRIPTION
24            
25             A simple object that accepts a class reference, a path to a file,
26             and a hash of text-phrase/link-URLs,
27             and supplies a method to obtain the HTML with supplied hyperlinks interpolated.
28            
29             If the values of the supplied has are anonymous lists, the first value
30             should a URI, the second escaped text to place in the link's C attribute. </td> </tr> <tr> <td class="h" > <a name="31">31</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="32">32</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> The phrase to hyperlink will be skipped if it appears in a context that prevents </td> </tr> <tr> <td class="h" > <a name="33">33</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> linking, as defined in C<%$HTML::LinkAdd::SKIP>. This is currently </td> </tr> <tr> <td class="h" > <a name="34">34</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> C<head>, C<script>, C<style>>, C<pre>, C<xmp>, C<textarea>, C<object>, and C<a>. </td> </tr> <tr> <td class="h" > <a name="35">35</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="36">36</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =head1 DEPENDENCIES </td> </tr> <tr> <td class="h" > <a name="37">37</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="38">38</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> L<HTML::TokeParser> </td> </tr> <tr> <td class="h" > <a name="39">39</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="40">40</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =head1 CONSTRUCTOR (new) </td> </tr> <tr> <td class="h" > <a name="41">41</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="42">42</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> Accepts class reference, followed by either a filename or reference to a scalar of HTML </td> </tr> <tr> <td class="h" > <a name="43">43</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> (as L<HTML::TokeParser|HTML::TokeParser>, and a hash of phrases and hyperlinks. </td> </tr> <tr> <td class="h" > <a name="44">44</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="45">45</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> Returns a scalar that is the updated HTML. </td> </tr> <tr> <td class="h" > <a name="46">46</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="47">47</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =cut </td> </tr> <tr> <td class="h" > <a name="48">48</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="49">49</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> our $SKIP = { map {$_=>1} qw{ </td> </tr> <tr> <td class="h" > <a name="50">50</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> head pre xmp textarea object a script style </td> </tr> <tr> <td class="h" > <a name="51">51</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } }; </td> </tr> <tr> <td class="h" > <a name="52">52</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="53">53</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> sub new { </td> </tr> <tr> <td class="h" > <a name="54">54</a> </td> <td class="c3" > 4 </td> <td >   </td> <td >   </td> <td class="c3" > <a href="blib-lib-HTML-LinkAdd-pm--subroutine.html#54-1"> 4 </a> </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--subroutine.html#54-1"> 0 </a> </td> <td > 1215 </td> <td class="s"> my ($class,$input) = (shift,shift); </td> </tr> <tr> <td class="h" > <a name="55">55</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="56">56</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> # Lets HTML::TokeParser handle the input file/string checks:- </td> </tr> <tr> <td class="h" > <a name="57">57</a> </td> <td class="c3" > 4 </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--branch.html#57-1"> 50 </a> </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--condition.html#57-1"> 0 </a> </td> <td >   </td> <td >   </td> <td > 11 </td> <td class="s"> warn "HTML::LinkAdd::new called without a class ref?" and return undef unless defined $class; </td> </tr> <tr> <td class="h" > <a name="58">58</a> </td> <td class="c3" > 4 </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--branch.html#58-1"> 50 </a> </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--condition.html#58-1"> 0 </a> </td> <td >   </td> <td >   </td> <td > 10 </td> <td class="s"> warn "Useage: new $class (\$path_to_file or \\\$HTML)" and return undef if not defined $input; </td> </tr> <tr> <td class="h" > <a name="59">59</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="60">60</a> </td> <td class="c3" > 4 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 21 </td> <td class="s"> my $self = bless { </td> </tr> <tr> <td class="h" > <a name="61">61</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> INPUT => $input, </td> </tr> <tr> <td class="h" > <a name="62">62</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> HREFS => {}, </td> </tr> <tr> <td class="h" > <a name="63">63</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> output => '', </td> </tr> <tr> <td class="h" > <a name="64">64</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> skipto => [], </td> </tr> <tr> <td class="h" > <a name="65">65</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> },$class; </td> </tr> <tr> <td class="h" > <a name="66">66</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="67">67</a> </td> <td class="c3" > 4 </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--branch.html#67-1"> 50 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td > 14 </td> <td class="s"> my %args = ref($_[0]) eq 'HASH'? %{$_[0]} : @_; </td> </tr> <tr> <td class="h" > <a > </a> </td> <td class="c3" > 4 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 20 </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="68">68</a> </td> <td class="c3" > 4 </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--branch.html#68-1"> 50 </a> </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--condition.html#68-1"> 0 </a> </td> <td >   </td> <td >   </td> <td > 13 </td> <td class="s"> warn "new requires a hash (or ref to such) as parameter." and return undef if not scalar keys %args; </td> </tr> <tr> <td class="h" > <a name="69">69</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="70">70</a> </td> <td class="c3" > 4 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 9 </td> <td class="s"> foreach my $phrase (keys %args){ </td> </tr> <tr> <td class="h" > <a name="71">71</a> </td> <td class="c3" > 4 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 21 </td> <td class="s"> my $clean = $phrase; </td> </tr> <tr> <td class="h" > <a name="72">72</a> </td> <td class="c3" > 4 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 7 </td> <td class="s"> $clean =~ s{\s}{ }; # Squash whitespace in the phrase </td> </tr> <tr> <td class="h" > <a name="73">73</a> </td> <td class="c3" > 4 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 18 </td> <td class="s"> $self->{HREFS}->{$clean} = $args{$phrase}; </td> </tr> <tr> <td class="h" > <a name="74">74</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="75">75</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="76">76</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> # Create new TokeParser and parse all text, comparing HTML against keys of our targets </td> </tr> <tr> <td class="h" > <a name="77">77</a> </td> <td class="c3" > 4 </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--branch.html#77-1"> 50 </a> </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--condition.html#77-1"> 0 </a> </td> <td >   </td> <td >   </td> <td > 19 </td> <td class="s"> my $p = new HTML::TokeParser ( $self->{INPUT} ) </td> </tr> <tr> <td class="h" > <a name="78">78</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> or warn "Counldn't instantiate HTML::TokeParser!\n$!" and return undef; </td> </tr> <tr> <td class="h" > <a name="79">79</a> </td> <td class="c3" > 4 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 568 </td> <td class="s"> my $token; </td> </tr> <tr> <td class="h" > <a name="80">80</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="81">81</a> </td> <td class="c3" > 4 </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--condition.html#81-1"> 33 </a> </td> <td >   </td> <td >   </td> <td > 19 </td> <td class="s"> while ($token = $p->get_token and not (@$token[1] eq 'html' and @$token[0] eq 'E') ){ </td> </tr> <tr> <td class="h" > <a > </a> </td> <td >   </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--condition.html#-2"> 66 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="82">82</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="83">83</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> # warn "@$token[0] @$token[1] - [", (scalar @{ $self->{skipto} }? join(', ', @{ $self->{skipto} }) : ''), "]\n"; </td> </tr> <tr> <td class="h" > <a name="84">84</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="85">85</a> </td> <td class="c3" > 26 </td> <td class="c3" > <a href="blib-lib-HTML-LinkAdd-pm--branch.html#85-1"> 100 </a> </td> <td class="c3" > <a href="blib-lib-HTML-LinkAdd-pm--condition.html#85-1"> 100 </a> </td> <td >   </td> <td >   </td> <td > 472 </td> <td class="s"> if (@$token[0] eq 'T' # Text token </td> </tr> <tr> <td class="h" > <a > </a> </td> <td class="c3" > 11 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 38 </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="86">86</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> and not @{ $self->{skipto} } # and not ignoreing head/pre, etc </td> </tr> <tr> <td class="h" > <a name="87">87</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ) { </td> </tr> <tr> <td class="h" > <a name="88">88</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="89">89</a> </td> <td class="c3" > 6 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 33 </td> <td class="s"> @$token[1] =~ s{\s+}{ }; # Squash whitespace in the text </td> </tr> <tr> <td class="h" > <a name="90">90</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="91">91</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> # If we got a text node, loop over every user-supplied phrase </td> </tr> <tr> <td class="h" > <a name="92">92</a> </td> <td class="c3" > 6 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 10 </td> <td class="s"> foreach my $key ( keys %{$self->{HREFS}} ) { </td> </tr> <tr> <td class="h" > <a > </a> </td> <td class="c3" > 6 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 18 </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="93">93</a> </td> <td class="c3" > 6 </td> <td class="c3" > <a href="blib-lib-HTML-LinkAdd-pm--branch.html#93-1"> 100 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td > 50 </td> <td class="s"> if (@$token[1] =~ m/\Q$key\E/sg){ </td> </tr> <tr> <td class="h" > <a name="94">94</a> </td> <td class="c3" > 4 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 8 </td> <td class="s"> my ($title, $href); </td> </tr> <tr> <td class="h" > <a name="95">95</a> </td> <td class="c3" > 4 </td> <td class="c3" > <a href="blib-lib-HTML-LinkAdd-pm--branch.html#95-1"> 100 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td > 13 </td> <td class="s"> if (ref $self->{HREFS}->{$key}){ </td> </tr> <tr> <td class="h" > <a name="96">96</a> </td> <td class="c3" > 3 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 4 </td> <td class="s"> ($href, $title) = @{ $self->{HREFS}->{$key} }; </td> </tr> <tr> <td class="h" > <a > </a> </td> <td class="c3" > 3 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 8 </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="97">97</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="98">98</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> else { </td> </tr> <tr> <td class="h" > <a name="99">99</a> </td> <td class="c3" > 1 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 4 </td> <td class="s"> $href = $self->{HREFS}->{$key}; </td> </tr> <tr> <td class="h" > <a name="100">100</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="101">101</a> </td> <td class="c3" > 4 </td> <td class="c3" > <a href="blib-lib-HTML-LinkAdd-pm--branch.html#101-1"> 100 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td > 19 </td> <td class="s"> my $subs = "<a href=\"$href\"" </td> </tr> <tr> <td class="h" > <a name="102">102</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> . ($title? " title=\"$title\"" : '') </td> </tr> <tr> <td class="h" > <a name="103">103</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> . ">$key</a>"; </td> </tr> <tr> <td class="h" > <a name="104">104</a> </td> <td class="c3" > 4 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 46 </td> <td class="s"> @$token[1] =~ s/\Q$key\E/$subs/sg; </td> </tr> <tr> <td class="h" > <a name="105">105</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="106">106</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="107">107</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> }; </td> </tr> <tr> <td class="h" > <a name="108">108</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="109">109</a> </td> <td class="c3" > 26 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 28 </td> <td class="s"> my $literal; </td> </tr> <tr> <td class="h" > <a name="110">110</a> </td> <td class="c3" > 26 </td> <td class="c3" > <a href="blib-lib-HTML-LinkAdd-pm--branch.html#110-1"> 100 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td > 60 </td> <td class="s"> if (@$token[0] eq 'S') { </td> </tr> <tr> <td class="h" > <a > </a> </td> <td >   </td> <td class="c3" > <a href="blib-lib-HTML-LinkAdd-pm--branch.html#-2"> 100 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="111">111</a> </td> <td class="c3" > 8 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 14 </td> <td class="s"> $literal = @$token[4]; </td> </tr> <tr> <td class="h" > <a name="112">112</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> # Skip PRE and XMP and TEXTAREA and HEAD </td> </tr> <tr> <td class="h" > <a name="113">113</a> </td> <td class="c3" > 8 </td> <td class="c3" > <a href="blib-lib-HTML-LinkAdd-pm--branch.html#113-1"> 100 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td > 21 </td> <td class="s"> if (exists $SKIP->{ @$token[1] }){ </td> </tr> <tr> <td class="h" > <a name="114">114</a> </td> <td class="c3" > 7 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 7 </td> <td class="s"> unshift @{$self->{skipto}}, @$token[1]; </td> </tr> <tr> <td class="h" > <a > </a> </td> <td class="c3" > 7 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 21 </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="115">115</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="116">116</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="117">117</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> elsif (@$token[0] eq 'E') { </td> </tr> <tr> <td class="h" > <a name="118">118</a> </td> <td class="c3" > 7 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 8 </td> <td class="s"> $literal = @$token[2]; </td> </tr> <tr> <td class="h" > <a name="119">119</a> </td> <td class="c3" > 7 </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--branch.html#119-1"> 50 </a> </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--condition.html#119-1"> 33 </a> </td> <td >   </td> <td >   </td> <td > 8 </td> <td class="s"> if (@{ $self->{skipto} } </td> </tr> <tr> <td class="h" > <a > </a> </td> <td class="c3" > 7 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 46 </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="120">120</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> and @$token[1] eq $self->{skipto}->[0]){ </td> </tr> <tr> <td class="h" > <a name="121">121</a> </td> <td class="c3" > 7 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 46 </td> <td class="s"> shift @{$self->{skipto}}; </td> </tr> <tr> <td class="h" > <a > </a> </td> <td class="c3" > 7 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 10 </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="122">122</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="123">123</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="124">124</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> else { </td> </tr> <tr> <td class="h" > <a name="125">125</a> </td> <td class="c3" > 11 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 15 </td> <td class="s"> $literal = @$token[1]; </td> </tr> <tr> <td class="h" > <a name="126">126</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="127">127</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="128">128</a> </td> <td class="c3" > 26 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 92 </td> <td class="s"> $self->{output} .= $literal; </td> </tr> <tr> <td class="h" > <a name="129">129</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="130">130</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="131">131</a> </td> <td class="c3" > 4 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td > 64 </td> <td class="s"> return $self; </td> </tr> <tr> <td class="h" > <a name="132">132</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="133">133</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="134">134</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="135">135</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =head1 PUBLIC METHOD hyperlink </td> </tr> <tr> <td class="h" > <a name="136">136</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="137">137</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> Returns the hyperlinked HTML docuemnt constructed by...the constructor. </td> </tr> <tr> <td class="h" > <a name="138">138</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="139">139</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =cut </td> </tr> <tr> <td class="h" > <a name="140">140</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="141">141</a> </td> <td class="c3" > 5 </td> <td >   </td> <td >   </td> <td class="c3" > <a href="blib-lib-HTML-LinkAdd-pm--subroutine.html#141-1"> 5 </a> </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--subroutine.html#141-1"> 0 </a> </td> <td > 676 </td> <td class="s"> sub hyperlinked { return $_[0]->{output} } </td> </tr> <tr> <td class="h" > <a name="142">142</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="143">143</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="144">144</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =head1 PUBLIC METHOD save </td> </tr> <tr> <td class="h" > <a name="145">145</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="146">146</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> Convenience method to save the object's C<output> slot to filename passed as scalar. </td> </tr> <tr> <td class="h" > <a name="147">147</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="148">148</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> Returns undef on failure, C<1> on success. </td> </tr> <tr> <td class="h" > <a name="149">149</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="150">150</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =cut </td> </tr> <tr> <td class="h" > <a name="151">151</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="152">152</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--subroutine.html#152-1"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--subroutine.html#152-1"> 0 </a> </td> <td >   </td> <td class="s"> sub save { my ($self,$filename) = (shift,shift); </td> </tr> <tr> <td class="h" > <a name="153">153</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--branch.html#153-1"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--condition.html#153-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> warn "HTML::LinkAdd::save requires a filename as parameter 1" and return undef unless defined $filename; </td> </tr> <tr> <td class="h" > <a name="154">154</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> local *OUT; </td> </tr> <tr> <td class="h" > <a name="155">155</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--branch.html#155-1"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-LinkAdd-pm--condition.html#155-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> open OUT, ">$filename" </td> </tr> <tr> <td class="h" > <a name="156">156</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> or warn "HTML::LinkAdd::save could not open the file <$filename> for writing.\n$!" and return undef; </td> </tr> <tr> <td class="h" > <a name="157">157</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> print OUT $self->{output}; </td> </tr> <tr> <td class="h" > <a name="158">158</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> close OUT; </td> </tr> <tr> <td class="h" > <a name="159">159</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return 1; </td> </tr> <tr> <td class="h" > <a name="160">160</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="161">161</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="162">162</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> 1; # Return cleanly </td> </tr> <tr> <td class="h" > <a name="163">163</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="164">164</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="165">165</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> __END__; </td> </tr> </table> </body> </html>