File Coverage

lib/Data/TagDB/Link.pm
Criterion Covered Total %
statement 11 23 47.8
branch 0 2 0.0
condition n/a
subroutine 4 9 44.4
pod 4 4 100.0
total 19 38 50.0


line stmt bran cond sub pod time code
1             # Copyright (c) 2024-2025 Philipp Schafft
2              
3             # licensed under Artistic License 2.0 (see LICENSE file)
4              
5             # ABSTRACT: Work with Tag databases
6              
7             package Data::TagDB::Link;
8              
9 1     1   594 use v5.10;
  1         4  
10 1     1   6 use strict;
  1         2  
  1         44  
11 1     1   6 use warnings;
  1         2  
  1         59  
12              
13 1     1   7 use Carp;
  1         1  
  1         475  
14              
15             our $VERSION = v0.12;
16              
17              
18              
19             sub db {
20 0     0 1   my ($self) = @_;
21 0           return $self->{db};
22             }
23              
24              
25             sub tag {
26 0     0 1   my ($self) = @_;
27 0           return $self->{tag};
28             }
29              
30             sub relation {
31 0     0 1   my ($self) = @_;
32 0           return $self->{relation};
33             }
34              
35             sub context {
36 0     0 1   my ($self) = @_;
37 0           return $self->{context};
38             }
39              
40             # ---- Private helpers ----
41              
42             sub _new {
43 0     0     my ($pkg, %opts) = @_;
44              
45 0           foreach my $required (qw(db tag relation)) {
46 0 0         croak 'Missing required member: '.$required unless defined $opts{$required};
47             }
48              
49 0           return bless \%opts, $pkg;
50             }
51              
52             1;
53              
54             __END__
55              
56             =pod
57              
58             =encoding UTF-8
59              
60             =head1 NAME
61              
62             Data::TagDB::Link - Work with Tag databases
63              
64             =head1 VERSION
65              
66             version v0.12
67              
68             =head1 SYNOPSIS
69              
70             use Data::TagDB;
71              
72             Parent package for L<Data::TagDB::Relation> and L<Data::TagDB::Metadata>.
73              
74             =head1 METHODS
75              
76             =head2 db
77              
78             my Data::TagDB $db = $db->db;
79              
80             Returns the current L<Data::TagDB> object
81              
82             =head2 tag, relation, context
83              
84             my Data::TagDB::Tag $db = $link->tag;
85             my Data::TagDB::Tag $db = $link->relation;
86             my Data::TagDB::Tag $db = $link->context;
87              
88             Returns the corresponding tag, relation, or context. Returns undef if not set.
89              
90             =head1 AUTHOR
91              
92             Philipp Schafft <lion@cpan.org>
93              
94             =head1 COPYRIGHT AND LICENSE
95              
96             This software is Copyright (c) 2024-2025 by Philipp Schafft <lion@cpan.org>.
97              
98             This is free software, licensed under:
99              
100             The Artistic License 2.0 (GPL Compatible)
101              
102             =cut