File Coverage

lib/Comics/Fetcher/GoComics.pm
Criterion Covered Total %
statement 9 15 60.0
branch 0 2 0.0
condition 0 3 0.0
subroutine 3 4 75.0
pod 1 1 100.0
total 13 25 52.0


line stmt bran cond sub pod time code
1             #! perl
2              
3 1     1   1331 use strict;
  1         3  
  1         39  
4 1     1   6 use warnings;
  1         2  
  1         67  
5              
6             package Comics::Fetcher::GoComics;
7              
8 1     1   7 use parent qw(Comics::Fetcher::Cascade);
  1         3  
  1         120  
9              
10             =head1 NAME
11              
12             Comics::Fetcher::GoComics -- Fetcher for GoComics.
13              
14             =head1 SYNOPSIS
15              
16             package Comics::Plugin::Garfield;
17             use parent qw(Comics::Fetcher::GoComics);
18              
19             our $name = "Garfield";
20             our $url = "https://www.comics.com/garfield";
21              
22             # Return the package name.
23             __PACKAGE__;
24              
25             =head1 DESCRIPTION
26              
27             The C Fetcher handles comics that are on the GoComics
28             websites (comics.com, gocomics.com).
29              
30             The Fetcher requires the common arguments:
31              
32             =over 8
33              
34             =item name
35              
36             The full name of this comic, e.g. "Garfield".
37              
38             =item url
39              
40             The base url of this comic.
41              
42             =back
43              
44             Fetcher specific arguments:
45              
46             =over 8
47              
48             =item None as yet.
49              
50             =back
51              
52             =cut
53              
54             our $VERSION = "1.04";
55              
56             # Page contents changed, january 10, 2017.
57             # Page contents changed, april 5, 2018.
58             # Page contents changed, april 1, 2025.
59              
60             sub register {
61 0     0 1   my ( $pkg, $init ) = @_;
62              
63             # Leave the rest to SUPER.
64 0           my $self = $pkg->SUPER::register($init);
65              
66 0 0 0       if ( ! $self->{url} && $self->{tag} ) {
67 0           $self->{url} = "https?://www.gocomics.com/" . $self->{tag} . "/";
68             }
69              
70             # Add the standard pattern for GoComics comics.
71             $self->{patterns} =
72             [
73 0           qr{
74             rel="preload" \s+
75             as="image" \s+
76             imageSrcSet="
77             (?https://featureassets.gocomics.com/assets/
78             (?[0-9a-f]+))
79             }x,
80             ];
81              
82 0           return $self;
83             }
84              
85             1;