File Coverage

blib/lib/App/LinkSite/Link.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             =head1 NAME
2              
3             App::LinkSite::Link
4              
5             =head1 SYNOPSIS
6              
7             (You probably want to just look at the L application.)
8              
9             =head1 DESCRIPTION
10              
11             A class to model a link on a link site (part of App::LinkSite).
12              
13             =cut
14              
15 3     3   99035 use Feature::Compat::Class;
  3         477  
  3         17  
16              
17             class App::LinkSite::Link {
18             our $VERSION = '0.1.1';
19 3     3   516 use strict;
  3         4  
  3         51  
20 3     3   14 use warnings;
  3         13  
  3         132  
21 3     3   15 no if $] >= 5.038, 'warnings', 'experimental::class';
  3         5  
  3         1082  
22              
23             field $title :reader :param;
24             field $subtitle :reader :param = '';
25             field $link :reader :param;
26             field $new_link :reader(is_new) :param(new) = 0;
27              
28             =head1 METHODS
29              
30             =head2 mk_link
31              
32             Returns a fragment of HTML that is used to display this link on the site.
33              
34             It's actually an `
  • ` that wraps an ``. So this method probably needs
  • 35             to be renamed or refactored. Maybe it should just be called `render()`.
    36              
    37             =cut
    38              
    39             method mk_link {
    40             my $a_tag = q[] . $self->title . q[];
    41             my $subtitle = $self->subtitle ? q[
    ] . $self->subtitle . q[] : '';
    42              
    43             my @li_classes = qw[list-group-item list-group-item-action];
    44             push @li_classes, 'new-link' if $self->is_new;
    45              
    46             return qq[
  • $a_tag$subtitle
  • ];
    47             }
    48             }
    49              
    50             =head1 AUTHOR
    51              
    52             Dave Cross
    53              
    54             =head1 COPYRIGHT AND LICENCE
    55              
    56             Copyright (c) 2024, Magnum Solutions Ltd. All Rights Reserved.
    57              
    58             This library is free software; you can redistribute it and/or modify it
    59             under the same terms as Perl itself.
    60              
    61             =cut
    62              
    63             1;