File Coverage

blib/lib/WWW/Mixi/OO/TablePreviewListPage.pm
Criterion Covered Total %
statement 15 49 30.6
branch 0 12 0.0
condition n/a
subroutine 5 8 62.5
pod 1 1 100.0
total 21 70 30.0


|io; \s* |oig; |oig; \s* |oisxg];
line stmt bran cond sub pod time code
1             # -*- cperl -*-
2             # copyright (C) 2005 Topia . all rights reserved.
3             # This is free software; you can redistribute it and/or modify it
4             # under the same terms as Perl itself.
5             # $Id: TablePreviewListPage.pm 100 2005-02-04 19:19:55Z topia $
6             # $URL: file:///usr/minetools/svnroot/mixi/trunk/WWW-Mixi-OO/lib/WWW/Mixi/OO/TablePreviewListPage.pm $
7             package WWW::Mixi::OO::TablePreviewListPage;
8 2     2   29753 use strict;
  2         6  
  2         77  
9 2     2   13 use warnings;
  2         4  
  2         58  
10 2     2   12 use URI;
  2         6  
  2         42  
11 2     2   17 use URI::QueryParam;
  2         5  
  2         54  
12 2     2   11 use base qw(WWW::Mixi::OO::TableListPage);
  2         3  
  2         1455  
13              
14             =head1 NAME
15              
16             WWW::Mixi::OO::TablePreviewListPage - WWW::Mixi::OO's Table style List Pages base class
17              
18             =head1 SYNOPSIS
19              
20             package WWW::Mixi::OO::Foo;
21             use base qw(WWW::Mixi::OO::TableListPage);
22             # some implementations...
23              
24             =head1 DESCRIPTION
25              
26             table style list pages base class.
27              
28             =head1 METHODS
29              
30             =over 4
31              
32             =cut
33              
34             =item parse_title
35              
36             title parser: return scalar.
37              
38             =cut
39              
40             sub parse_title {
41 0     0 1   my $this = shift;
42 0           my $part = $this->parse_table_item('title');
43 0 0         return () unless defined $part;
44 0 0         return () unless $part =~ m|(.+)
45 0           return $1;
46             }
47              
48             sub _parse_table {
49 0     0     my $this = shift;
50 0 0         return $this->SUPER::_parse_table(@_) if @_ == 1; # overridable
51              
52 0           my $attr_regex = $this->regex_parts->{html_attr};
53 0           my $attrval_regex = $this->regex_parts->{html_attrval};
54 0           my $maybe_attrs_regex = $this->regex_parts->{html_maybe_attrs};
55 0           $this->SUPER::_parse_table(
56             qr|
57            
58             ((?>.*?)
59            
.+)
60            
61             |oisx);
62             }
63              
64             sub _parse_body {
65 0     0     my $this = shift;
66 0           my $part = $this->parse_table_item('body');
67 0 0         return () unless defined $part;
68 0           my $maybe_attrs_regex = $this->regex_parts->{html_maybe_attrs};
69 0           my $regex = qr|\A(.*?)
70             (.*?)\Z|oisx;
71 0           my $link;
72 0           return [map {
73 0           my ($photo, $text) = /$regex/;
74             # parse top-half
75             my @top_half = map {
76 0 0         if (m||oi) {
  0            
77 0           $link = $this->html_anchor_to_uri($1);
78 0           my %data = (
79             link => $link,
80             $this->analyze_uri($link),
81             );
82 0           $data{image} = $this->absolute_linked_uri(
83             $this->generate_case_preserved_hash(
84             $this->html_attrs_to_hash($2))->{src});
85 0           \%data;
86             } else {
87 0           ();
88             }
89             } $photo =~ m|(.*?)
90             # parse bottom-half
91             my @data = map {
92 0 0         if (m|\A(.*)\((\d+)\)|oi) {
  0            
93 0           my $data = shift(@top_half);
94 0           $data->{count} = $2;
95 0           $data->{subject} = $this->rewrite($1);
96 0           $data;
97             } else {
98 0           ();
99             }
100             } $text =~ m|(.*?)
101 0           @data;
102             } $part =~ m|(.*?
103             .*?)
104             }
105              
106             1;
107              
108             __END__