| 1 | package SeeAlso::Source::BeaconAggregator::Publisher; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 4 | our $VERSION = "0.2_92"; | |||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | SeeAlso::Source::BeaconAggregator::Publisher - additional methods for SeeAlso::Source::BeaconAggregator | ||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | $source = SeeAlso::Source::BeaconAggregator::Publisher->new(...); | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | This package provides the functionallity to export a BEACON file from the | ||||||||||||||||||||||||||||||||||||||||||
| 18 | data connected with an SeeAlso::Source::BeaconAggregator instance and | ||||||||||||||||||||||||||||||||||||||||||
| 19 | also the additional formats "redirect" and "sources" which universally | ||||||||||||||||||||||||||||||||||||||||||
| 20 | can be used as callbacks for SeeAlso::Server (replacing the default | ||||||||||||||||||||||||||||||||||||||||||
| 21 | "seealso" method yielding JSON data). | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 4 | our %Defaults = ( | |||||||||||||||||||||||||||||||||||||||||
| 26 | # "REVISIT" => 86400, # one day | ||||||||||||||||||||||||||||||||||||||||||
| 27 | "REVISIT" => undef, # no default (leave empty unless otherwise set) | ||||||||||||||||||||||||||||||||||||||||||
| 28 | "uAformatname" => "sources", | ||||||||||||||||||||||||||||||||||||||||||
| 29 | "beaconformatname" => "beacon", | ||||||||||||||||||||||||||||||||||||||||||
| 30 | "FORMAT" => "BEACON", | ||||||||||||||||||||||||||||||||||||||||||
| 31 | "VERSION" => "0.1", # no other exist | ||||||||||||||||||||||||||||||||||||||||||
| 32 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 4 | ▶ | use SeeAlso::Source::BeaconAggregator; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 4 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | =head2 new ( ... ) | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | Creates an SeeAlso::Source::BeaconAggregator object with additional methods from | ||||||||||||||||||||||||||||||||||||||||||
| 40 | this package enabled | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 4 | ▶ | sub new { # directly create BeaconAggregator instance with extended features... | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 4 | my $class = shift @_; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 4 | push(@SeeAlso::Source::BeaconAggregator::ISA, $class); | |||||||||||||||||||||||||||||||||||||||||
| 47 | 4 | return SeeAlso::Source::BeaconAggregator->new(@_); | |||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | =head2 activate () | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | Makes SeeAlso::Source::BeaconAggregator objects member of this class, | ||||||||||||||||||||||||||||||||||||||||||
| 54 | globally enabling the additional methods | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | $db = SeeAlso::Source::BeaconAggregator::Maintenance->new(...); | ||||||||||||||||||||||||||||||||||||||||||
| 59 | ... | ||||||||||||||||||||||||||||||||||||||||||
| 60 | do stuff | ||||||||||||||||||||||||||||||||||||||||||
| 61 | ... | ||||||||||||||||||||||||||||||||||||||||||
| 62 | require SeeAlso::Source::BeaconAggregator::Publisher | ||||||||||||||||||||||||||||||||||||||||||
| 63 | or die "could not require Publisher extension"; | ||||||||||||||||||||||||||||||||||||||||||
| 64 | SeeAlso::Source::BeaconAggregator::Publisher->activate(); # "recast" all objects | ||||||||||||||||||||||||||||||||||||||||||
| 65 | ... | ||||||||||||||||||||||||||||||||||||||||||
| 66 | do more stuff | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 2 | ▶ | sub activate { # enrich SeeAlso::Source and derived classes with our methods | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
activate: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 2 | my $class = shift @_; | |||||||||||||||||||||||||||||||||||||||||
| 71 | 2 | push(@SeeAlso::Source::BeaconAggregator::ISA, $class); | |||||||||||||||||||||||||||||||||||||||||
| 72 | 2 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | ### Produktion der Beacon-Datei | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | =head2 beacon ( [dumpmeta arguments] ) | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | produces a BEACON file (however, $cgibase is mandatory) | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | =head2 dumpmeta ( [$cgibase, [$uAformatname, [$headersonly]]] [, $preset]) | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | produces only the meta fields of a BEACON file | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | Meta fields are generated from the $preset Hashref, falling back to | ||||||||||||||||||||||||||||||||||||||||||
| 87 | values stored in the database, falling back to reasonable default | ||||||||||||||||||||||||||||||||||||||||||
| 88 | values. | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | Arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | =over 8 | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | =item $cgibase | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | URL of the SeeAlso service the BEACON file is provided for | ||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | =item $uAformatname | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | unAPI format name to be used as target (Default: "sources") | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | =item $headersonly | ||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | currently unused | ||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | =item $preset | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | Hashref of Beacon header fields overriding the contents of the database | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | Regular Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | $db = SeeAlso::Source::BeaconAggregator::Publisher->new(...); | ||||||||||||||||||||||||||||||||||||||||||
| 115 | binmode(STDOUT, ":utf8"); | ||||||||||||||||||||||||||||||||||||||||||
| 116 | my $cgibase = "http://address/of/service"; | ||||||||||||||||||||||||||||||||||||||||||
| 117 | my ( $error, $headerref) = $db->beacon($cgibase, @ARGV, {'FORMAT' => 'PND-BEACON'}); | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | CGI Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | $format = $CGI->param('format') || ""; | ||||||||||||||||||||||||||||||||||||||||||
| 123 | if ( $format eq "beacon" ) { # bypass SeeAlso::Server->query() b/c performance / interim storage | ||||||||||||||||||||||||||||||||||||||||||
| 124 | insert access restrictions here... | ||||||||||||||||||||||||||||||||||||||||||
| 125 | do_beacon($source, $CGI); | ||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||
| 127 | ... | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | sub do_beacon { | ||||||||||||||||||||||||||||||||||||||||||
| 130 | my ($self, $cgi) = @_; # Of type SeeAlso::Source::BeaconAggregator | ||||||||||||||||||||||||||||||||||||||||||
| 131 | unless ( $self->can("beacon") ) { | ||||||||||||||||||||||||||||||||||||||||||
| 132 | croak "On the fly generation of beacon Files not supported by this service";} | ||||||||||||||||||||||||||||||||||||||||||
| 133 | my $cgibase = $cgi->url(-path_info=>1); | ||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | print $cgi->header( -status => 200, | ||||||||||||||||||||||||||||||||||||||||||
| 136 | -expires => '+1d', | ||||||||||||||||||||||||||||||||||||||||||
| 137 | -type => 'text/plain', | ||||||||||||||||||||||||||||||||||||||||||
| 138 | -charset => 'utf-8', | ||||||||||||||||||||||||||||||||||||||||||
| 139 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 140 | return $self->beacon($cgibase, "sources", {}); # prints directly to stdout..., returns $error, $headerref | ||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | 2 | ▶ | sub beacon { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
beacon: called CC=13 SCAR=33.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 2 | ▶ | my ($self) = shift @_ or croak("beacon is a method!"); # Of type SeeAlso::Source::BeaconAggregator | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | 2 | my ($error, $headerref) = $self->dumpmeta(@_); | |||||||||||||||||||||||||||||||||||||||||
| 148 | 2 | ▶ | croak("Error generating Header, will not proceed") if $error; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | 2 | print @$headerref; | |||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | 2 | ▶ | my $c = (defined $self->{identifierClass}) ? $self->{identifierClass} : $self->autoIdentifier(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | 2 | my ($sth, $sthexpl) = $self->stmtHdl(<<"XxX"); | |||||||||||||||||||||||||||||||||||||||||
| 155 | SELECT hash, COUNT(DISTINCT seqno) FROM beacons GROUP BY hash ORDER BY hash; | ||||||||||||||||||||||||||||||||||||||||||
| 156 | XxX | ||||||||||||||||||||||||||||||||||||||||||
| 157 | 2 | ▶ | $self->stmtExplain($sthexpl) if $ENV{'DBI_PROFILE'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | 2 | ▶ | $sth->execute() or croak("Could not execute >".$sth->{Statement}."<: ".$sth->errstr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | 2 | my $rows = 0; | |||||||||||||||||||||||||||||||||||||||||
| 160 | 2 | ▶ | while ( my $row = $sth->fetchrow_arrayref ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 12 | $rows++; | |||||||||||||||||||||||||||||||||||||||||
| 162 | 12 | my $expanded = $row->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 163 | 12 | ▶ | if ( defined $c ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | # compat: hash might not take an argument, must resort to value, has to be cleared before... | ||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | $c->value(""); | |||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | my $did = $c->hash($row->[0]) || $c->value($row->[0]); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$c->hash($row->[0]) || $c->value($row->[0])
MC/DC0%0/2
$c->hash($row->[0]) || $c->value($row->[0])
$c->hash($row->[0])
$c->value($row->[0])
Truth table0%0/3
A || B
A= $c->hash($row->[0])B= $c->value($row->[0])
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | $expanded = $c->can("pretty") ? $c->pretty() : $c->value(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | # illegal identifier b/c different classes for loading and exporting? | ||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | next unless defined $expanded && ($expanded ne ""); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $expanded and $expanded ne ""
MC/DC0%0/2
defined $expanded and $expanded ne ""
defined $expanded
$expanded ne ""
Truth table0%0/3
A and B
A= defined $expandedB= $expanded ne ""
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 12 | ▶ | print $expanded.(($row->[1] > 1) ? "|".$row->[1] : "")."\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | 2 | return $rows, $headerref; | |||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | 3 | ▶ | sub dumpmeta { # cgibase unAPIformatname headers_only {preset} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dumpmeta: called CC=54 SCAR=50.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 3 | ▶ | my ($self) = shift @_ or croak("dumpmeta is a method!"); # Of type SeeAlso::Source::BeaconAggregator | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 3 | my ($error, @result) = (0, ()); | |||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | 3 | ▶ | my $cgibase = shift @_ if @_ && !ref($_[0]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ and not ref $_[0]
MC/DC0%0/2
@_ and not ref $_[0]
@_
not ref $_[0]
Truth table33%1/3
A and not(B)
A= @_B= not ref $_[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | 3 | ▶ | my $uAformatname = shift @_ if @_ && !ref($_[0]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@_ and not ref $_[0]
MC/DC50%1/2
@_ and not ref $_[0]
@_
not ref $_[0]
Truth table66%2/3
A and not(B)
A= @_B= not ref $_[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | 3 | ▶ | $uAformatname ||= $Defaults{'uAformatname'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$uAformatname ||= $SeeAlso::Source::BeaconAggregator::Publisher::Defaults{"uAformatname"}
MC/DC0%0/2
$uAformatname ||= $SeeAlso::Source::BeaconAggregator::Publisher::Defaults{"uAformatname"}
$uAformatname
$SeeAlso::Source::BeaconAggregator::Publisher::Defaults{"uAformatname"}
Truth table33%1/3
A ||= B
A= $uAformatnameB= $SeeAlso::Source::BeaconAggregator::Publisher::Defaults{"uAformatname"}
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 3 | ▶ | my $headersonly = shift @_ if @_ && !ref($_[0]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@_ and not ref $_[0]
MC/DC50%1/2
@_ and not ref $_[0]
@_
not ref $_[0]
Truth table66%2/3
A and not(B)
A= @_B= not ref $_[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | 3 | ▶ | my $preset = (@_ && ref($_[0])) ? (shift @_) : {}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ and ref $_[0]
MC/DC0%0/2
@_ and ref $_[0]
@_
ref $_[0]
Truth table33%1/3
A and B
A= @_B= ref $_[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | 3 | my ($metasth, $metasthexpl) = $self->stmtHdl(<<"XxX"); | |||||||||||||||||||||||||||||||||||||||||
| 188 | SELECT key, val FROM osd; | ||||||||||||||||||||||||||||||||||||||||||
| 189 | XxX | ||||||||||||||||||||||||||||||||||||||||||
| 190 | 3 | ▶ | $self->stmtExplain($metasthexpl) if $ENV{'DBI_PROFILE'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 3 | ▶ | $metasth->execute() or croak("Could not execute >".$metasth->{Statement}."<: ".$metasth->errstr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | 3 | my (%osd, %beaconmeta); | |||||||||||||||||||||||||||||||||||||||||
| 194 | 3 | ▶ | while ( my $aryref = $metasth->fetchrow_arrayref ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | 27 | my ($key, $val) = @$aryref; | |||||||||||||||||||||||||||||||||||||||||
| 196 | 27 | ▶ | next unless $val; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | 27 | ▶ | if ($key =~ s/^bc// ) { # BeaconMeta Fields | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 6 | $beaconmeta{$key} = $val} | |||||||||||||||||||||||||||||||||||||||||
| 199 | elsif ( exists $osd{$key} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 200 | 18 | ▶ | if ( ref($osd{$key}) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | 15 | push(@{$osd{$key}}, $val)} | |||||||||||||||||||||||||||||||||||||||||
| 202 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 203 | 3 | $osd{$key} = [$osd{$key}, $val]}; | |||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||
| 205 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 206 | 3 | $osd{$key} = $val}; | |||||||||||||||||||||||||||||||||||||||||
| 207 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 208 | 3 | my @osdexamples; | |||||||||||||||||||||||||||||||||||||||||
| 209 | 3 | ▶ | if ( $osd{'Examples'} && ref($osd{'Examples'}) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$osd{"Examples"} and ref $osd{"Examples"}
MC/DC0%0/2
$osd{"Examples"} and ref $osd{"Examples"}
$osd{"Examples"}
ref $osd{"Examples"}
Truth table33%1/3
A and B
A= $osd{"Examples"}B= ref $osd{"Examples"}
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | foreach my $expl ( @{$osd{'Examples'}} ) { | |||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | $expl =~ s/\s*\|.*$//; | |||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | push(@osdexamples, $expl); | |||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||
| 215 | elsif ( my $expl = $osd{'Examples'} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $expl =~ s/\s*\|.*$//; | |||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | push(@osdexamples, $expl); | |||||||||||||||||||||||||||||||||||||||||
| 218 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | 3 | foreach ( grep /^[A-Z]+$/, keys %$preset ) { | |||||||||||||||||||||||||||||||||||||||||
| 221 | 6 | $beaconmeta{$_} = $preset->{$_}} | |||||||||||||||||||||||||||||||||||||||||
| 222 | # Mandatory fields | ||||||||||||||||||||||||||||||||||||||||||
| 223 | 3 | ▶ | push(@result, "#FORMAT: ".($beaconmeta{'FORMAT'} || $Defaults{'FORMAT'})."\n"); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$beaconmeta{'FORMAT'} || $SeeAlso::Source::BeaconAggregator::Publisher::Defaults{'FORMAT'}
MC/DC0%0/2
$beaconmeta{'FORMAT'} || $SeeAlso::Source::BeaconAggregator::Publisher::Defaults{'FORMAT'}
$beaconmeta{'FORMAT'}
$SeeAlso::Source::BeaconAggregator::Publisher::Defaults{'FORMAT'}
Truth table66%2/3
A || B
A= $beaconmeta{'FORMAT'}B= $SeeAlso::Source::BeaconAggregator::Publisher::Defaults{'FORMAT'}
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | 3 | ▶ | push(@result, "#VERSION: ".($beaconmeta{'VERSION'} || $Defaults{'VERSION'})."\n"); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$beaconmeta{'VERSION'} || $SeeAlso::Source::BeaconAggregator::Publisher::Defaults{'VERSION'}
MC/DC0%0/2
$beaconmeta{'VERSION'} || $SeeAlso::Source::BeaconAggregator::Publisher::Defaults{'VERSION'}
$beaconmeta{'VERSION'}
$SeeAlso::Source::BeaconAggregator::Publisher::Defaults{'VERSION'}
Truth table66%2/3
A || B
A= $beaconmeta{'VERSION'}B= $SeeAlso::Source::BeaconAggregator::Publisher::Defaults{'VERSION'}
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | 3 | ▶ | if ( $beaconmeta{'TARGET'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | $beaconmeta{'TARGET'} =~ s/^\{BASE\}/$cgibase/; | |||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | push(@result, "#TARGET: $beaconmeta{'TARGET'}\n"); | |||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 229 | elsif ( $cgibase ) { | ||||||||||||||||||||||||||||||||||||||||||
| 230 | 3 | push(@result, "#TARGET: $cgibase?format=$uAformatname&id={ID}\n")} | |||||||||||||||||||||||||||||||||||||||||
| 231 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | carp "Don't know how to construct the mandatory #TARGET field!"; | |||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | $error ++; | |||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | 3 | ▶ | my $timestamp = $preset->{'TIMESTAMP'} || $osd{DateModified} || $^T; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$preset->{'TIMESTAMP'} || $osd{'DateModified'} || $^T
$preset->{"TIMESTAMP"} or $osd{"DateModified"}
MC/DC0%0/3
$preset->{'TIMESTAMP'} || $osd{'DateModified'} || $^T
$preset->{"TIMESTAMP"}
$osd{"DateModified"}
$^T
Truth table25%1/4
A or B || C
A= $preset->{"TIMESTAMP"}B= $osd{"DateModified"}C= $^T
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | 3 | ▶ | push(@result, "#TIMESTAMP: ".SeeAlso::Source::BeaconAggregator::tToISO($timestamp)."\n") if $timestamp > 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | 3 | ▶ | my $revisit = ($beaconmeta{'REVISIT'} || $Defaults{'REVISIT'}) || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition80%4/5
$beaconmeta{'REVISIT'} || $SeeAlso::Source::BeaconAggregator::Publisher::Defaults{'REVISIT'} || ''
$beaconmeta{"REVISIT"} or $SeeAlso::Source::BeaconAggregator::Publisher::Defaults{"REVISIT"}
MC/DC50%1/2
$beaconmeta{'REVISIT'} || $SeeAlso::Source::BeaconAggregator::Publisher::Defaults{'REVISIT'} || ''
$beaconmeta{"REVISIT"}
$SeeAlso::Source::BeaconAggregator::Publisher::Defaults{"REVISIT"}
Truth table66%2/3
A or B
A= $beaconmeta{"REVISIT"}B= $SeeAlso::Source::BeaconAggregator::Publisher::Defaults{"REVISIT"}
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | 3 | $revisit =~ tr/ //d; | |||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | $revisit =~ s/(\d+)mo\w*/($1*30)."d"/ei; | |||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | $revisit =~ s/(\d+)M\w*/($1*30)."d"/e; | |||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | $revisit =~ s/(\d+)w\w*/($1*7)."d"/ei; | |||||||||||||||||||||||||||||||||||||||||
| 243 | 3 | $revisit =~ s/(\d+)d\w*/($1*24)."h"/ei; | |||||||||||||||||||||||||||||||||||||||||
| 244 | 3 | $revisit =~ s/(\d+)h\w*/($1*60)."m"/ei; | |||||||||||||||||||||||||||||||||||||||||
| 245 | 3 | $revisit =~ s/(\d+)m\w*/($1*60)."s"/ei; | |||||||||||||||||||||||||||||||||||||||||
| 246 | 3 | $revisit =~ s/(\d+)s\w*/$1/i; | |||||||||||||||||||||||||||||||||||||||||
| 247 | 3 | ▶ | push(@result, "#REVISIT: ".SeeAlso::Source::BeaconAggregator::tToISO($timestamp + $revisit)."\n") if $revisit && ($revisit =~ /^[+-]?\d+$/) && ($revisit > 0);; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$revisit and $revisit =~ /^[+-]?\d+$/ and $revisit > 0
$revisit and $revisit =~ /^[+-]?\d+$/
MC/DC33%1/3
$revisit and $revisit =~ /^[+-]?\d+$/ and $revisit > 0
$revisit
$revisit =~ /^[+-]?\d+$/
$revisit > 0
Truth table50%2/4
A and B and C
A= $revisitB= $revisit =~ /^[+-]?\d+$/C= $revisit > 0
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | # $beaconmeta{'UPDATE'} ||= "daily"; | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 3 | ▶ | $beaconmeta{'FEED'} ||= "$cgibase?format=".$Defaults{'beaconformatname'} if $cgibase; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$beaconmeta{"FEED"} ||= "$cgibase?format=" . $SeeAlso::Source::BeaconAggregator::Publisher::Defaults{"beaconformatname"}
MC/DC0%0/2
$beaconmeta{"FEED"} ||= "$cgibase?format=" . $SeeAlso::Source::BeaconAggregator::Publisher::Defaults{"beaconformatname"}
$beaconmeta{"FEED"}
"$cgibase?format=" . $SeeAlso::Source::BeaconAggregator::Publisher::Defaults{"beaconformatname"}
Truth table66%2/3
A ||= B
A= $beaconmeta{"FEED"}B= "$cgibase?format=" . $SeeAlso::Source::BeaconAggregator::Publisher::Defaults{"beaconformatname"}
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | 3 | ▶ | $beaconmeta{'EXAMPLES'} ||= join("|", @osdexamples); | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$beaconmeta{"EXAMPLES"} ||= join("|", @osdexamples)
MC/DC0%0/2
$beaconmeta{"EXAMPLES"} ||= join("|", @osdexamples)
$beaconmeta{"EXAMPLES"}
join("|", @osdexamples)
Truth table33%1/3
A ||= B
A= $beaconmeta{"EXAMPLES"}B= join("|", @osdexamples)
| |||||||||||||||||||||||||||||||||||||||||||
| 252 | 3 | ▶ | $beaconmeta{'CONTACT'} ||= $self->{Contact} || $osd{'Contact'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$beaconmeta{"CONTACT"} ||= $self->{"Contact"} || $osd{"Contact"}
$self->{'Contact'} || $osd{'Contact'}
MC/DC0%0/3
$beaconmeta{"CONTACT"} ||= $self->{"Contact"} || $osd{"Contact"}
$beaconmeta{"CONTACT"}
$self->{'Contact'}
$osd{'Contact'}
Truth table0%0/4
A ||= B || C
A= $beaconmeta{"CONTACT"}B= $self->{'Contact'}C= $osd{'Contact'}
| |||||||||||||||||||||||||||||||||||||||||||
| 253 | 3 | ▶ | $beaconmeta{'DESCRIPTION'} ||= $self->{Description} || $osd{'Description'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$beaconmeta{"DESCRIPTION"} ||= $self->{"Description"} || $osd{"Description"}
$self->{'Description'} || $osd{'Description'}
MC/DC0%0/3
$beaconmeta{"DESCRIPTION"} ||= $self->{"Description"} || $osd{"Description"}
$beaconmeta{"DESCRIPTION"}
$self->{'Description'}
$osd{'Description'}
Truth table0%0/4
A ||= B || C
A= $beaconmeta{"DESCRIPTION"}B= $self->{'Description'}C= $osd{'Description'}
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | 3 | ▶ | $beaconmeta{'NAME'} ||= $self->{ShortName} || $osd{'ShortName'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$beaconmeta{"NAME"} ||= $self->{"ShortName"} || $osd{"ShortName"}
$self->{'ShortName'} || $osd{'ShortName'}
MC/DC0%0/3
$beaconmeta{"NAME"} ||= $self->{"ShortName"} || $osd{"ShortName"}
$beaconmeta{"NAME"}
$self->{'ShortName'}
$osd{'ShortName'}
Truth table0%0/4
A ||= B || C
A= $beaconmeta{"NAME"}B= $self->{'ShortName'}C= $osd{'ShortName'}
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 3 | foreach ( grep !/^(FORMAT|REVISIT|TARGET|TIMESTAMP|VERSION)$/, SeeAlso::Source::BeaconAggregator->beaconfields() ) { | |||||||||||||||||||||||||||||||||||||||||
| 256 | 48 | ▶ | next unless my $val = $beaconmeta{$_}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | 8 | ▶ | next if $val =~ /^-/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 258 | 8 | $val =~ s/\s+/ /g; $val =~ s/^\s+//; $val =~ s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||
| 259 | 8 | push(@result, "#$_: $val\n"); | |||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | # extract admin info of last transaction (i.e. last possible modification of underlying data) | ||||||||||||||||||||||||||||||||||||||||||
| 263 | # alternatively: SELECT seqno, utime FROM repos WHERE seqno=(SELECT MAX(seqno) FROM repos); | ||||||||||||||||||||||||||||||||||||||||||
| 264 | 3 | my ($laststh, $laststhexpl) = $self->stmtHdl(<<"XxX"); | |||||||||||||||||||||||||||||||||||||||||
| 265 | SELECT MAX(seqno), MAX(mtime) FROM repos; | ||||||||||||||||||||||||||||||||||||||||||
| 266 | XxX | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 3 | ▶ | $self->stmtExplain($laststhexpl) if $ENV{'DBI_PROFILE'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 3 | ▶ | $laststh->execute() or croak("Could not execute >".$laststh->{Statement}."<: ".$laststh->errstr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 3 | ▶ | if ( my $aryref = $laststh->fetchrow_arrayref ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | 3 | my ($sq, $ut) = @$aryref; | |||||||||||||||||||||||||||||||||||||||||
| 271 | 3 | ▶ | push(@result, "#X-REVISION: $sq [".SeeAlso::Source::BeaconAggregator::tToISO($ut)."]\n") if $sq; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 273 | 3 | my $admref = $self->admhash(); | |||||||||||||||||||||||||||||||||||||||||
| 274 | 3 | ▶ | if ( my $cu = $admref->{'gcountu'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | 3 | ▶ | my $type = $admref->{'IDENTIFIER_CLASS'} || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$admref->{'IDENTIFIER_CLASS'} || ''
MC/DC0%0/1
$admref->{'IDENTIFIER_CLASS'} || ''
$admref->{'IDENTIFIER_CLASS'}
Truth table50%1/2
A
A= $admref->{'IDENTIFIER_CLASS'}
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | 3 | ▶ | push(@result, "#X-EXTENT: $cu unique identifiers".($type ? " of type $type" : "")."\n"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | ## PND-BEACON | ||||||||||||||||||||||||||||||||||||||||||
| 281 | # CONTACT => ['VARCHAR(63)'], | ||||||||||||||||||||||||||||||||||||||||||
| 282 | # INSTITUTION => ['VARCHAR(255)'], | ||||||||||||||||||||||||||||||||||||||||||
| 283 | # ISIL => ['VARCHAR(63)'], | ||||||||||||||||||||||||||||||||||||||||||
| 284 | # DESCRIPTION => ['VARCHAR(255)'], | ||||||||||||||||||||||||||||||||||||||||||
| 285 | ## BEACON | ||||||||||||||||||||||||||||||||||||||||||
| 286 | # MESSAGE => ['VARCHAR(255)'], # enthaelt {hits} | ||||||||||||||||||||||||||||||||||||||||||
| 287 | # ONEMESSAGE => ['VARCHAR(255)'], | ||||||||||||||||||||||||||||||||||||||||||
| 288 | # SOMEMESSAGE => ['VARCHAR(255)'], | ||||||||||||||||||||||||||||||||||||||||||
| 289 | # PREFIX => ['VARCHAR(255)'], | ||||||||||||||||||||||||||||||||||||||||||
| 290 | ## WInofficial | ||||||||||||||||||||||||||||||||||||||||||
| 291 | # NAME => ['VARCHAR(255)'], | ||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | 3 | return $error, \@result; | |||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | =head2 redirect ( $server, $format, $extra, $query ) | ||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | Produces an HTTP redirect page, HTML content contains very terse details in case | ||||||||||||||||||||||||||||||||||||||||||
| 300 | of multiple results. | ||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | This subroutine may be used as callback method in SeeAlso::Server | ||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | Usage is a bit cludgy due to author's lack of understanding of SeeAlso::Server | ||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | $source = SeeAlso::Sources::BeaconAggregator::Publisher->new(...); | ||||||||||||||||||||||||||||||||||||||||||
| 307 | $CGI = CGI->new(); | ||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | $formats = { | ||||||||||||||||||||||||||||||||||||||||||
| 310 | ... | ||||||||||||||||||||||||||||||||||||||||||
| 311 | redirect => { | ||||||||||||||||||||||||||||||||||||||||||
| 312 | type => "text/html", | ||||||||||||||||||||||||||||||||||||||||||
| 313 | docs => "http://www.endofthe.net/", | ||||||||||||||||||||||||||||||||||||||||||
| 314 | # method => \&SeeAlso::Source::BeaconAggregator::Publisher::redirect, | ||||||||||||||||||||||||||||||||||||||||||
| 315 | #redirect_300 => 'sources', | ||||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 317 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | $server = SeeAlso::Server->new ( | ||||||||||||||||||||||||||||||||||||||||||
| 320 | 'cgi' => $CGI, | ||||||||||||||||||||||||||||||||||||||||||
| 321 | 'formats' => $formats, | ||||||||||||||||||||||||||||||||||||||||||
| 322 | ... | ||||||||||||||||||||||||||||||||||||||||||
| 323 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | # Closure as fix: Server.pm does not expose self, $source and the CGI object to the format methods | ||||||||||||||||||||||||||||||||||||||||||
| 326 | my $oref = \&SeeAlso::Source::BeaconAggregator::Publisher::redirect; | ||||||||||||||||||||||||||||||||||||||||||
| 327 | $server->{'formats'}->{'redirect'}->{method} | ||||||||||||||||||||||||||||||||||||||||||
| 328 | = sub {return &$oref($source, $server, $method, $formats->{$method}, @_)}; | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | my $result = $server->query($source); | ||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | Arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||
| 334 | =over 8 | ||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | =item $server | ||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | SeeAlso::Server object. Must contain a CGI object | ||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | =item $format | ||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | Name of a format registered with the $server object () | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | =item $extra | ||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | Hashref with the following configuration directives | ||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | redirect_300 => CGI 'format' parameter to be used in HTML content (eg. format=sources) | ||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | force_single => Only regard the first hit (thus always redirect) | ||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | =item $query | ||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | Identifier to be queried | ||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||
| 358 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | sub redirect { # Liste der Beacon-Header fuer Treffer oder einfaches redirect | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
redirect: not called CC=58 SCAR=81.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | my ($self, $server, $format, $extra, $query) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | ▶ | my $formatprops = $server->{'formats'}->{$format} || {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$server->{'formats'}{$format} || {}
MC/DC0%0/1
$server->{'formats'}{$format} || {}
$server->{'formats'}{$format}
Truth table0%0/2
A
A= $server->{'formats'}{$format}
| |||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | ▶ | my $cgi = $server->{'cgi'} or croak("I rely on a prepared CGI.pm object"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | my %headerdefaults = ( -type => ($formatprops->{'type'} || 'text/html'), | ||||||||||||||||||||||||||||||||||||||||||
| 366 | # ($formatprops->{'charset'} ? (-charset => $formatprops->{'charset'}) : ()), | ||||||||||||||||||||||||||||||||||||||||||
| 367 | -charset => ($formatprops->{'charset'} || 'UTF-8'), | ||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | -expires => ($server->{'expires'} || '+1h'), | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$formatprops->{'type'} || 'text/html'
$formatprops->{'charset'} || 'UTF-8'
$server->{'expires'} || '+1h'
MC/DC0%0/1
$formatprops->{'type'} || 'text/html'
$formatprops->{'type'}
MC/DC0%0/1
$formatprops->{'charset'} || 'UTF-8'
$formatprops->{'charset'}
MC/DC0%0/1
$server->{'expires'} || '+1h'
$server->{'expires'}
Truth table0%0/2
A
A= $formatprops->{'type'}
Truth table0%0/2
A
A= $formatprops->{'charset'}
Truth table0%0/2
A
A= $server->{'expires'}
| |||||||||||||||||||||||||||||||||||||||||||
| 369 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | my ($hash, $pretty, $canon) = $self->prepare_query($query); | |||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | ▶ | unless ( $hash ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | print $cgi->header(-status => "400 Bad Request (Identifier '$query' not valid)", | |||||||||||||||||||||||||||||||||||||||||
| 374 | -expires => "+1y", | ||||||||||||||||||||||||||||||||||||||||||
| 375 | -type => 'text/html', | ||||||||||||||||||||||||||||||||||||||||||
| 376 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 377 | $cgi->start_html (-dtd => "-//W3C//DTD HTML 3.2 Final//EN", | ||||||||||||||||||||||||||||||||||||||||||
| 378 | -title => "No valid identifier", | ||||||||||||||||||||||||||||||||||||||||||
| 379 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 380 | $cgi->p("Malformed identifier '$query'"), | ||||||||||||||||||||||||||||||||||||||||||
| 381 | $cgi->end_html; | ||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | return ""; | |||||||||||||||||||||||||||||||||||||||||
| 383 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | my $clusterid; | |||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | if ( $self->{cluster} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | my ($clusterh, $clusterexpl) = $self->stmtHdl("SELECT beacons.altid FROM cluster.beacons WHERE beacons.hash=? OR beacons.altid=? LIMIT 1;"); | |||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | $self->stmtExplain($clusterexpl, $hash, $hash) if $ENV{'DBI_PROFILE'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | $clusterh->execute($hash, $hash); | |||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | ▶ | while ( my $onerow = $clusterh->fetchrow_arrayref() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | $clusterid = $onerow->[0];} | |||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | my $clause = $extra->{force_single} ? "LIMIT 1" : "ORDER BY repos.sort, repos.alias"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | my ( $tfield,$afield, $gfield, $mfield,$nfield,$ifield) = map{ scalar $self->beaconfields($_) } | |||||||||||||||||||||||||||||||||||||||||
| 396 | qw(TARGET ALTTARGET IMGTARGET MESSAGE NAME INSTITUTION); | ||||||||||||||||||||||||||||||||||||||||||
| 397 | # above 5 6 7 8 9 10 | ||||||||||||||||||||||||||||||||||||||||||
| 398 | # below 0 1 2 3 4 | ||||||||||||||||||||||||||||||||||||||||||
| 399 | # 11 | ||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | my ($sth, $sthexpl); | |||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | if ( $clusterid ) { # query IN cluster | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | ($sth, $sthexpl) = $self->stmtHdl(<<"XxX"); | |||||||||||||||||||||||||||||||||||||||||
| 403 | SELECT beacons.hash, beacons.altid, beacons.hits, beacons.info, beacons.link, | ||||||||||||||||||||||||||||||||||||||||||
| 404 | repos.$tfield, repos.$afield, repos.$gfield, repos.$mfield, repos.$nfield, repos.$ifield, | ||||||||||||||||||||||||||||||||||||||||||
| 405 | repos.alias | ||||||||||||||||||||||||||||||||||||||||||
| 406 | FROM beacons NATURAL LEFT JOIN repos | ||||||||||||||||||||||||||||||||||||||||||
| 407 | WHERE ( (beacons.hash=?) | ||||||||||||||||||||||||||||||||||||||||||
| 408 | OR (beacons.hash IN (SELECT cluster.beacons.hash FROM cluster.beacons WHERE cluster.beacons.altid=?)) ) | ||||||||||||||||||||||||||||||||||||||||||
| 409 | $clause; | ||||||||||||||||||||||||||||||||||||||||||
| 410 | XxX | ||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | $self->stmtExplain($sthexpl, $clusterid, $clusterid) if $ENV{'DBI_PROFILE'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | ▶ | $sth->execute($clusterid, $clusterid) or croak("Could not execute >".$sth->{Statement}."<: ".$sth->errstr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||
| 414 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | ($sth, $sthexpl) = $self->stmtHdl(<<"XxX"); | |||||||||||||||||||||||||||||||||||||||||
| 416 | SELECT beacons.hash, beacons.altid, beacons.hits, beacons.info, beacons.link, | ||||||||||||||||||||||||||||||||||||||||||
| 417 | repos.$tfield, repos.$afield, repos.$gfield, repos.$mfield, repos.$nfield, repos.$ifield, | ||||||||||||||||||||||||||||||||||||||||||
| 418 | repos.alias | ||||||||||||||||||||||||||||||||||||||||||
| 419 | FROM beacons NATURAL LEFT JOIN repos | ||||||||||||||||||||||||||||||||||||||||||
| 420 | WHERE beacons.hash=? | ||||||||||||||||||||||||||||||||||||||||||
| 421 | $clause; | ||||||||||||||||||||||||||||||||||||||||||
| 422 | XxX | ||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | ▶ | $self->stmtExplain($sthexpl, $hash) if $ENV{'DBI_PROFILE'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | ▶ | $sth->execute($hash) or croak("Could not execute >".$sth->{Statement}."<: ".$sth->errstr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | ▶ | my $c = $self->{identifierClass} || undef; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'identifierClass'} || undef
MC/DC0%0/1
$self->{'identifierClass'} || undef
$self->{'identifierClass'}
Truth table0%0/2
A
A= $self->{'identifierClass'}
| |||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | my @rawres; | |||||||||||||||||||||||||||||||||||||||||
| 429 | my %didalready; | ||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | ▶ | while ( my $onerow = $sth->fetchrow_arrayref ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | ▶ | next if $onerow->[11] && exists $self->{'aliasfilter'}->{$onerow->[11]}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$onerow->[11] and exists $self->{"aliasfilter"}{$onerow->[11]}
MC/DC0%0/2
$onerow->[11] and exists $self->{"aliasfilter"}{$onerow->[11]}
$onerow->[11]
exists $self->{"aliasfilter"}{$onerow->[11]}
Truth table0%0/3
A and B
A= $onerow->[11]B= exists $self->{"aliasfilter"}{$onerow->[11]}
| |||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | my $uri = $onerow->[4]; # Evtl. Expliziter Link | |||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | my $guri = ""; | |||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | my $h = $onerow->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | my $p; | |||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | ▶ | if ( $h eq $hash ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | $p = $pretty} | |||||||||||||||||||||||||||||||||||||||||
| 439 | ▶ | elsif ( $clusterid && ref($c) ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$clusterid and ref $c
MC/DC0%0/2
$clusterid and ref $c
$clusterid
ref $c
Truth table0%0/3
A and B
A= $clusteridB= ref $c
| |||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | $c->value(""); | |||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | my $did = $c->hash($h) || $c->value($h) || $h; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$c->hash($h) || $c->value($h) || $h
$c->hash($h) or $c->value($h)
MC/DC0%0/3
$c->hash($h) || $c->value($h) || $h
$c->hash($h)
$c->value($h)
$h
Truth table0%0/4
A or B || C
A= $c->hash($h)B= $c->value($h)C= $h
| |||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | ▶ | $p = $c->can("pretty") ? $c->pretty() : $c->value(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 443 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | ▶ | $p = ($clusterid ? $h : $pretty) unless defined $p; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | ▶ | if ( $onerow->[1] ) { # Konkordanzformat | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | ▶ | $uri ||= sprintf($onerow->[6] || $onerow->[5], $p, SeeAlso::Source::BeaconAggregator::urlpseudoescape($onerow->[1])); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$uri ||= sprintf($onerow->[6] || $onerow->[5], $p, SeeAlso::Source::BeaconAggregator::urlpseudoescape($onerow->[1]))
$onerow->[6] || $onerow->[5]
MC/DC0%0/2
$uri ||= sprintf($onerow->[6] || $onerow->[5], $p, SeeAlso::Source::BeaconAggregator::urlpseudoescape($onerow->[1]))
$uri
sprintf($onerow->[6] || $onerow->[5], $p, SeeAlso::Source::BeaconAggregator::urlpseudoescape($onerow->[1]))
MC/DC0%0/2
$onerow->[6] || $onerow->[5]
$onerow->[6]
$onerow->[5]
Truth table0%0/3
A ||= B
A= $uriB= sprintf($onerow->[6] || $onerow->[5], $p, SeeAlso::Source::BeaconAggregator::urlpseudoescape($onerow->[1]))
Truth table0%0/3
A || B
A= $onerow->[6]B= $onerow->[5]
| |||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | ▶ | $guri = sprintf($onerow->[7], $p, SeeAlso::Source::BeaconAggregator::urlpseudoescape($onerow->[1])) if $onerow->[7]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||
| 450 | elsif ( $onerow->[5] ) { # normales Beacon-Format | ||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | ▶ | $uri ||= sprintf($onerow->[5], $p); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$uri ||= sprintf($onerow->[5], $p)
MC/DC0%0/2
$uri ||= sprintf($onerow->[5], $p)
$uri
sprintf($onerow->[5], $p)
Truth table0%0/3
A ||= B
A= $uriB= sprintf($onerow->[5], $p)
| |||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | ▶ | $guri = sprintf($onerow->[7], $p) if $onerow->[7]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 453 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | ▶ | next unless $uri; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||
| 456 | # #NAME #INSTITUTION _alias | ||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | my $label; | |||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | ▶ | if ( $label = $onerow->[8] ) { #MESSAGE | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | $label = sprintf($label, $onerow->[2] || "...")} | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$onerow->[2] || '...'
MC/DC0%0/1
$onerow->[2] || '...'
$onerow->[2]
Truth table0%0/2
A
A= $onerow->[2]
| |||||||||||||||||||||||||||||||||||||||||||
| 460 | ▶ | elsif ( $label = $onerow->[9] || $onerow->[10] || $onerow->[11] || "???" ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/8
$onerow->[9] || $onerow->[10] || $onerow->[11] || '???'
$onerow->[9] or $onerow->[10] or $onerow->[11]
$onerow->[9] or $onerow->[10]
MC/DC0%0/3
$onerow->[9] || $onerow->[10] || $onerow->[11] || '???'
$onerow->[9]
$onerow->[10]
$onerow->[11]
Truth table0%0/4
A or B or C
A= $onerow->[9]B= $onerow->[10]C= $onerow->[11]
| |||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | ▶ | $label .= " (".$onerow->[1].")" if $onerow->[1]} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | ▶ | push(@rawres, [$uri, $guri, $label, $onerow->[11], $onerow->[3]]) unless $didalready{join("\x7f", $label, $uri)}++;; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 464 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | my $hits = scalar @rawres; | |||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | ▶ | if ( ! $hits ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | print $cgi->header(-status => "404 Not Found (identifier '$canon')", | |||||||||||||||||||||||||||||||||||||||||
| 469 | %headerdefaults), | ||||||||||||||||||||||||||||||||||||||||||
| 470 | $cgi->start_html (-dtd => "-//W3C//DTD HTML 3.2 Final//EN", | ||||||||||||||||||||||||||||||||||||||||||
| 471 | -title => "No References for $pretty", | ||||||||||||||||||||||||||||||||||||||||||
| 472 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 473 | $cgi->p("No References found for ", $cgi->a({href=>"$canon"}, $pretty)), | ||||||||||||||||||||||||||||||||||||||||||
| 474 | $cgi->end_html; | ||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | return ""; | |||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||
| 477 | elsif ( $hits == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | return $cgi->redirect(-status => "302 Found (Redirecting for identifier '$canon')", | |||||||||||||||||||||||||||||||||||||||||
| 479 | -uri => $rawres[0]->[0], | ||||||||||||||||||||||||||||||||||||||||||
| 480 | %headerdefaults); | ||||||||||||||||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | my $sources = new CGI($cgi); | |||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | $sources->param(-name => 'id', -value=>"$canon"); | |||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | ▶ | unless ( $canon =~ /:\/\// ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | my ($osd, $beaconmeta) = $self->get_meta; | |||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | ▶ | my $prefix = $beaconmeta->{'PREFIX'} || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$beaconmeta->{'PREFIX'} || ''
MC/DC0%0/1
$beaconmeta->{'PREFIX'} || ''
$beaconmeta->{'PREFIX'}
Truth table0%0/2
A
A= $beaconmeta->{'PREFIX'}
| |||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | ▶ | $canon = "$prefix$pretty" if $prefix; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 489 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | ▶ | if ( my $multired = $extra->{redirect_300} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | $sources->param(-name => 'format', -value=>$multired); | |||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | print $cgi->redirect(-status => "300 Multiple Choices for identifier '$canon'", | |||||||||||||||||||||||||||||||||||||||||
| 493 | -uri => $sources->url(-path_info=>1, -query=>1), | ||||||||||||||||||||||||||||||||||||||||||
| 494 | %headerdefaults); | ||||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||
| 496 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | print $cgi->header(-status => "300 Multiple Choices for identifier '$canon'", | |||||||||||||||||||||||||||||||||||||||||
| 498 | # -nph => 1, # for older CGI/mod_perl??? | ||||||||||||||||||||||||||||||||||||||||||
| 499 | %headerdefaults); | ||||||||||||||||||||||||||||||||||||||||||
| 500 | # mod_perl overrides the header and adds a custom document at the end of everything | ||||||||||||||||||||||||||||||||||||||||||
| 501 | # therefore we force the header out (a simple print "" does not suffice) and then can | ||||||||||||||||||||||||||||||||||||||||||
| 502 | # safely reset the status to OK via CGI.pm leaking the Apache2::Request object | ||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | ▶ | if ( my $r = $sources->r ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | local($|) = 1; | |||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | print "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | $r->status(200); | |||||||||||||||||||||||||||||||||||||||||
| 507 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 508 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | my @result; | |||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | push(@result, $cgi->start_html ( -title => "$hits References for $pretty", | |||||||||||||||||||||||||||||||||||||||||
| 511 | -dtd => "-//W3C//DTD HTML 3.2 Final//EN"), | ||||||||||||||||||||||||||||||||||||||||||
| 512 | $cgi->h1("$hits References for ", $cgi->a({href=>"$canon"}, $pretty)), | ||||||||||||||||||||||||||||||||||||||||||
| 513 | '<ul>'); | ||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | my $rowcnt = 0; | |||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | foreach ( @rawres ) { # uri, guri, label, alias, info | |||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | ▶ | if ( $_->[1] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | ▶ | my $tooltip = $_->[4] ? ($_->[4]." [".$_->[2]."]") : $_->[2]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | ▶ | my $img = $cgi->a({href=>$_->[0], title=>$tooltip}, $cgi->img({src=>$_->[1], alt=>$_->[4]||$_->[2], style=>"width: 5em; border: 0pt;"})); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$_->[4] || $_->[2]
MC/DC0%0/2
$_->[4] || $_->[2]
$_->[4]
$_->[2]
Truth table0%0/3
A || B
A= $_->[4]B= $_->[2]
| |||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | ▶ | push(@result, $cgi->li({id=>"$_->[3]".++$rowcnt}, $img, $cgi->a({href=>$_->[0]}, $_->[2]), ($_->[4] ? " [".$_->[4]."]" : ""))); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||||||||||||
| 522 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | ▶ | push(@result, $cgi->li({id=>"$_->[3]".++$rowcnt}, $cgi->a({href=>$_->[0]}, $_->[2]), $_->[4] ? " [".$_->[4]."]" : ""))}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 524 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | push(@result, '</ul>'); | |||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | ▶ | if ( $server->{'formats'}->{'sources'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | $sources->param(-name => 'format', -value=>"sources"); | |||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | push(@result, $cgi->p("[", $cgi->a({href=>($sources->url(-path_info=>1, -query=>1))}, "Details"), "]")); | |||||||||||||||||||||||||||||||||||||||||
| 531 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | my($tu, $ts, $tcu, $tcs) = times(); | |||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | push(@result, sprintf("<!-- user: %.3fs + sys: %.3fs = %.3fs -->", $tu, $ts, $tu+$ts), $cgi->end_html()); | |||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | return join("\n", @result); | |||||||||||||||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||
| 538 | =head2 sources ( $server, $format, $extra, $query ) | ||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||
| 540 | Produces an HTML page with details to the queried identifier (description of sources) | ||||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||
| 542 | This subroutine may be used as callback method in SeeAlso::Server (cf. description | ||||||||||||||||||||||||||||||||||||||||||
| 543 | of redirect above | ||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||
| 545 | =over 8 | ||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||
| 547 | =item $server | ||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||
| 549 | SeeAlso::Server object | ||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||
| 552 | =item $format | ||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||
| 554 | Format selected for $server | ||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||
| 557 | =item $extra | ||||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||
| 559 | Hashref with the following configuration directives | ||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||
| 561 | css => URL of css file to be referenced | ||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||
| 563 | =item $query | ||||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||
| 565 | Identifier to be queried | ||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||
| 567 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||
| 569 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | ▶ | sub sources { # Liste der Beacon-Header fuer Treffer | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sources: not called CC=148 SCAR=100.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 572 | # We escape all characters except US-ASCII, because older CGI.pm's set an xml declaration | ||||||||||||||||||||||||||||||||||||||||||
| 573 | # which somehow interferes with IE8's adherence to the character set... | ||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | my ($self, $server, $format, $extra, $query) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | ▶ | my $formatprops = $server->{'formats'}->{$format} || {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$server->{'formats'}{$format} || {}
MC/DC0%0/1
$server->{'formats'}{$format} || {}
$server->{'formats'}{$format}
Truth table0%0/2
A
A= $server->{'formats'}{$format}
| |||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | ▶ | my $cgi = $server->{'cgi'} || CGI->new(); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$server->{'cgi'} || 'CGI'->new
MC/DC0%0/2
$server->{'cgi'} || 'CGI'->new
$server->{'cgi'}
'CGI'->new
Truth table0%0/3
A || B
A= $server->{'cgi'}B= 'CGI'->new
| |||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | my ($hash, $pretty, $canon) = $self->prepare_query($query); | |||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | ▶ | unless ( $hash ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | print $cgi->header(-status => "400 Bad Request (Identifier '$query' not valid)", | |||||||||||||||||||||||||||||||||||||||||
| 581 | -expires => "+1y", | ||||||||||||||||||||||||||||||||||||||||||
| 582 | -type => 'text/html', | ||||||||||||||||||||||||||||||||||||||||||
| 583 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 584 | $cgi->start_html (-dtd => "-//W3C//DTD HTML 3.2 Final//EN", | ||||||||||||||||||||||||||||||||||||||||||
| 585 | -title => "No valid identifier", | ||||||||||||||||||||||||||||||||||||||||||
| 586 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 587 | $cgi->p("Malformed identifier '$query'"), | ||||||||||||||||||||||||||||||||||||||||||
| 588 | $cgi->end_html; | ||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | return ""; | |||||||||||||||||||||||||||||||||||||||||
| 590 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | my ($clusterid, %idlist); | |||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | ▶ | my $c = $self->{identifierClass} || undef; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'identifierClass'} || undef
MC/DC0%0/1
$self->{'identifierClass'} || undef
$self->{'identifierClass'}
Truth table0%0/2
A
A= $self->{'identifierClass'}
| |||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | ▶ | if ( $self->{cluster} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | my ($clusterh, $clusterexpl) = $self->stmtHdl("SELECT beacons.hash, beacons.altid FROM cluster.beacons WHERE beacons.hash=? OR beacons.altid=? LIMIT 1;"); | |||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | ▶ | $self->stmtExplain($clusterexpl, $hash, $hash) if $ENV{'DBI_PROFILE'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | ▶ | $clusterh->execute($hash, $hash) or croak("Could not execute >".$clusterh->{Statement}."<: ".$clusterh->errstr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | ▶ | while ( my $onerow = $clusterh->fetchrow_arrayref() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | $clusterid = $onerow->[1]; | |||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | my $h = $onerow->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | ▶ | if ( $c ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | $c->value(""); | |||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | ▶ | my $did = $c->hash($h) || $c->value($h); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$c->hash($h) || $c->value($h)
MC/DC0%0/2
$c->hash($h) || $c->value($h)
$c->hash($h)
$c->value($h)
Truth table0%0/3
A || B
A= $c->hash($h)B= $c->value($h)
| |||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | ▶ | my $p = $c->can("pretty") ? $c->pretty() : $c->value(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | $idlist{$p} = ""; | |||||||||||||||||||||||||||||||||||||||||
| 606 | } | ||||||||||||||||||||||||||||||||||||||||||
| 607 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 608 | 0 | $idlist{$h} = ""; | |||||||||||||||||||||||||||||||||||||||||
| 609 | } | ||||||||||||||||||||||||||||||||||||||||||
| 610 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | $idlist{$pretty} = "queriedid"; | |||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | ▶ | if ( $clusterid ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | ▶ | if ( $clusterid eq $hash ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | $idlist{$pretty} .= " preferredid"} | |||||||||||||||||||||||||||||||||||||||||
| 615 | elsif ( $c ) { | ||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | $c->value(""); | |||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | ▶ | my $did = $c->hash($clusterid) || $c->value($clusterid); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$c->hash($clusterid) || $c->value($clusterid)
MC/DC0%0/2
$c->hash($clusterid) || $c->value($clusterid)
$c->hash($clusterid)
$c->value($clusterid)
Truth table0%0/3
A || B
A= $c->hash($clusterid)B= $c->value($clusterid)
| |||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | ▶ | my $p = $c->can("pretty") ? $c->pretty() : $c->value(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | $idlist{$p} = "variantid preferredid"; | |||||||||||||||||||||||||||||||||||||||||
| 620 | } | ||||||||||||||||||||||||||||||||||||||||||
| 621 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | $idlist{$clusterid} = "variantid preferredid"; | |||||||||||||||||||||||||||||||||||||||||
| 623 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 624 | 0 | my ($varianth, $variantexpl) = $self->stmtHdl("SELECT beacons.hash FROM cluster.beacons WHERE beacons.altid=?;"); | |||||||||||||||||||||||||||||||||||||||||
| 625 | 0 | ▶ | $self->stmtExplain($variantexpl, $clusterid) if $ENV{'DBI_PROFILE'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | ▶ | $varianth->execute($clusterid) or croak("Could not execute >".$varianth->{Statement}."<: ".$varianth->errstr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | ▶ | while ( my $onerow = $varianth->fetchrow_arrayref() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | my $v = $onerow->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | ▶ | if ( $c ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | $c->value(""); | |||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | ▶ | my $did = $c->hash($v) || $c->value($v); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$c->hash($v) || $c->value($v)
MC/DC0%0/2
$c->hash($v) || $c->value($v)
$c->hash($v)
$c->value($v)
Truth table0%0/3
A || B
A= $c->hash($v)B= $c->value($v)
| |||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | ▶ | my $p = $c->can("pretty") ? $c->pretty() : $c->value(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | ▶ | (exists $idlist{$p}) || ($idlist{$p} = "variantid"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 634 | } | ||||||||||||||||||||||||||||||||||||||||||
| 635 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | ▶ | (exists $idlist{$v}) || ($idlist{$v} = "variantid"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 637 | } | ||||||||||||||||||||||||||||||||||||||||||
| 638 | } | ||||||||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | my ($countsth, $countexpl); | |||||||||||||||||||||||||||||||||||||||||
| 643 | 0 | ▶ | if ( $clusterid ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | ($countsth, $countexpl) = $self->stmtHdl(<<"XxX"); | |||||||||||||||||||||||||||||||||||||||||
| 645 | SELECT COUNT(DISTINCT seqno) FROM beacons | ||||||||||||||||||||||||||||||||||||||||||
| 646 | WHERE ( (hash=?) OR (hash IN (SELECT beacons.hash FROM cluster.beacons WHERE cluster.beacons.altid=?)) ); | ||||||||||||||||||||||||||||||||||||||||||
| 647 | XxX | ||||||||||||||||||||||||||||||||||||||||||
| 648 | 0 | ▶ | $self->stmtExplain($countexpl, $clusterid, $clusterid) if $ENV{'DBI_PROFILE'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | ▶ | $countsth->execute($clusterid, $clusterid) or croak("Could not execute >".$countsth->{Statement}."<: ".$countsth->errstr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 650 | } | ||||||||||||||||||||||||||||||||||||||||||
| 651 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | ($countsth, $countexpl) = $self->stmtHdl(<<"XxX"); | |||||||||||||||||||||||||||||||||||||||||
| 653 | SELECT COUNT(DISTINCT seqno) FROM beacons WHERE hash=?; | ||||||||||||||||||||||||||||||||||||||||||
| 654 | XxX | ||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | ▶ | $self->stmtExplain($countexpl, $hash) if $ENV{'DBI_PROFILE'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | ▶ | $countsth->execute($hash) or croak("Could not execute >".$countsth->{Statement}."<: ".$countsth->errstr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 657 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | my $hitsref = $countsth->fetchrow_arrayref; | |||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | ▶ | my $hits = $hitsref->[0] || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$hitsref->[0] || 0
MC/DC0%0/1
$hitsref->[0] || 0
$hitsref->[0]
Truth table0%0/2
A
A= $hitsref->[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | my ($osd, $beaconmeta) = $self->get_meta; | |||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | ▶ | my $prefix = $beaconmeta->{'PREFIX'} || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$beaconmeta->{'PREFIX'} || ''
MC/DC0%0/1
$beaconmeta->{'PREFIX'} || ''
$beaconmeta->{'PREFIX'}
Truth table0%0/2
A
A= $beaconmeta->{'PREFIX'}
| |||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | ▶ | (my $servicename = $beaconmeta->{'NAME'} || $osd->{'ShortName'} || "") =~ s/([<>&"]|[^\x00-\x7f])/'&#'.ord($1).';'/ge; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$beaconmeta->{'NAME'} || $osd->{'ShortName'} || ''
$beaconmeta->{"NAME"} or $osd->{"ShortName"}
MC/DC0%0/2
$beaconmeta->{'NAME'} || $osd->{'ShortName'} || ''
$beaconmeta->{"NAME"}
$osd->{"ShortName"}
Truth table0%0/3
A or B
A= $beaconmeta->{"NAME"}B= $osd->{"ShortName"}
| |||||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||
| 665 | 0 | my $target = $cgi->url(-path=>1); | |||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | my @result; | |||||||||||||||||||||||||||||||||||||||||
| 668 | push(@result, $cgi->start_html( | ||||||||||||||||||||||||||||||||||||||||||
| 669 | -encoding => "UTF-8", | ||||||||||||||||||||||||||||||||||||||||||
| 670 | -title => "$servicename referring ".$query->as_string(), | ||||||||||||||||||||||||||||||||||||||||||
| 671 | -meta => {'robots'=>'noindex'}, | ||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | ▶ | ($extra->{'css'} ? (-style => {'src'=>$extra->{'css'}}) : ()), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 673 | -head => [$cgi->Link({-rel=>'unapi-server', | ||||||||||||||||||||||||||||||||||||||||||
| 674 | -type=>'application/xml', | ||||||||||||||||||||||||||||||||||||||||||
| 675 | title=>'unAPI', | ||||||||||||||||||||||||||||||||||||||||||
| 676 | -href=>$target}), | ||||||||||||||||||||||||||||||||||||||||||
| 677 | $cgi->Link({-rel=>'start', | ||||||||||||||||||||||||||||||||||||||||||
| 678 | -href=>$target}), | ||||||||||||||||||||||||||||||||||||||||||
| 679 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 680 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | push(@result, '<script type="text/javascript">function toggle(divid) {if ( document.getElementById(divid).style.display == "none" ) {document.getElementById(divid).style.display = "block"} else {document.getElementById(divid).style.display = "none"}}</script>'); | |||||||||||||||||||||||||||||||||||||||||
| 683 | 0 | push(@result, '<script type="text/javascript">function mtoggle(dlid,cl) {var nd=document.getElementById(dlid).firstChild; while (nd!=null){if (nd.nodeType == 1) {if (nd.className==cl) {if (nd.style.display == "none"){nd.style.display = "block"}else{nd.style.display = "none"}}};nd=nd.nextSibling;};}</script>'); | |||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | push(@result, $cgi->h1("$hits References for ".$cgi->abbr({class=>"unapi-id", title=>"$canon"}, $query))); | |||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | push(@result, '<div id="description">'); | |||||||||||||||||||||||||||||||||||||||||
| 688 | 0 | ▶ | push(@result, $cgi->p($cgi->span("Identifier:"), $cgi->a({href=>"$prefix$pretty"}, "$prefix$pretty"))) if $prefix; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 689 | # delete $idlist{$pretty} if $prefix; | ||||||||||||||||||||||||||||||||||||||||||
| 690 | 0 | ▶ | push(@result, $cgi->p($cgi->span("Variant Identifiers:"), map {$cgi->span({class=>($idlist{$_} || "variantid")}, $_)} sort keys %idlist)) if %idlist; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$idlist{$_} || 'variantid'
MC/DC0%0/1
$idlist{$_} || 'variantid'
$idlist{$_}
Truth table0%0/2
A
A= $idlist{$_}
| |||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | push(@result, '</div>'); | |||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | my ($srcsth, $srcexpl); | |||||||||||||||||||||||||||||||||||||||||
| 694 | 0 | ▶ | if ( $clusterid ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | ($srcsth, $srcexpl) = $self->stmtHdl(<<"XxX"); | |||||||||||||||||||||||||||||||||||||||||
| 696 | SELECT beacons.*, repos.* | ||||||||||||||||||||||||||||||||||||||||||
| 697 | FROM beacons NATURAL LEFT JOIN repos | ||||||||||||||||||||||||||||||||||||||||||
| 698 | WHERE ( (beacons.hash=?) | ||||||||||||||||||||||||||||||||||||||||||
| 699 | OR (beacons.hash IN (SELECT beacons.hash FROM cluster.beacons WHERE cluster.beacons.altid=?)) ) | ||||||||||||||||||||||||||||||||||||||||||
| 700 | ORDER BY repos.sort, repos.alias; | ||||||||||||||||||||||||||||||||||||||||||
| 701 | XxX | ||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | ▶ | $self->stmtExplain($srcexpl, $clusterid, $clusterid) if $ENV{'DBI_PROFILE'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | ▶ | $srcsth->execute($clusterid, $clusterid) or croak("Could not execute >".$srcsth->{Statement}."<: ".$srcsth->errstr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 704 | } | ||||||||||||||||||||||||||||||||||||||||||
| 705 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | ($srcsth, $srcexpl) = $self->stmtHdl(<<"XxX"); | |||||||||||||||||||||||||||||||||||||||||
| 707 | SELECT beacons.*, repos.* | ||||||||||||||||||||||||||||||||||||||||||
| 708 | FROM beacons NATURAL LEFT JOIN repos | ||||||||||||||||||||||||||||||||||||||||||
| 709 | WHERE beacons.hash=? | ||||||||||||||||||||||||||||||||||||||||||
| 710 | ORDER BY repos.sort, repos.alias; | ||||||||||||||||||||||||||||||||||||||||||
| 711 | XxX | ||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | ▶ | $self->stmtExplain($srcexpl, $hash) if $ENV{'DBI_PROFILE'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | ▶ | $srcsth->execute($hash) or croak("Could not execute >".$srcsth->{Statement}."<: ".$srcsth->errstr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 714 | } | ||||||||||||||||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | my $rows = 0; | |||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | push(@result, '<div id="results">'); | |||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | my ($lastseq, @groups) = (0, ()); | |||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | ▶ | while ( my $onerow = $srcsth->fetchrow_hashref ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 720 | 0 | $rows ++; | |||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | ▶ | if ( $lastseq and $onerow->{'seqno'} == $lastseq ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$lastseq and $onerow->{"seqno"} == $lastseq
MC/DC0%0/2
$lastseq and $onerow->{"seqno"} == $lastseq
$lastseq
$onerow->{"seqno"} == $lastseq
Truth table0%0/3
A and B
A= $lastseqB= $onerow->{"seqno"} == $lastseq
| |||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | my %vary; | |||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | foreach my $key ( grep /^(hash|altid|hits|info|link)$/, keys %$onerow ) { | |||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | my $pval = $onerow->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 725 | 0 | ▶ | next unless defined $pval; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 726 | 0 | ▶ | $pval =~ s/([<>&"]|[^\x00-\x7f])/'&#'.ord($1).';'/ge if $key eq "link"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 727 | 0 | $vary{$key} = $pval; | |||||||||||||||||||||||||||||||||||||||||
| 728 | } | ||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | push(@{$groups[$#groups]}, \%vary); | |||||||||||||||||||||||||||||||||||||||||
| 730 | } | ||||||||||||||||||||||||||||||||||||||||||
| 731 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | my (%vary, %repos, %meta); | |||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | ▶ | while ( my($key, $val) = each %$onerow ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | my $pval = $val; | |||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | ▶ | unless ( $key =~ /altid|feed|target|uri|link/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | ▶ | $pval =~ s/([<>&"]|[^\x00-\x7f])/'&#'.ord($1).';'/ge if defined $pval}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | ▶ | if ( $key =~ /time|revisit/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 738 | 0 | ▶ | next unless $val; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 739 | 0 | $pval = HTTP::Date::time2str($val); | |||||||||||||||||||||||||||||||||||||||||
| 740 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | ▶ | if ( $key =~ /^bc(\w+)$/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | ▶ | $repos{$1} = $pval if $pval} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 743 | elsif ( $key =~ /^(hash|altid|hits|info|link)$/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | $vary{$key} = $pval} | |||||||||||||||||||||||||||||||||||||||||
| 745 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 746 | 0 | ▶ | $meta{"_$key"} = $pval if $pval} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 747 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | push(@groups, [\%repos, \%meta, \%vary]); | |||||||||||||||||||||||||||||||||||||||||
| 749 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | $lastseq = $onerow->{'seqno'}; | |||||||||||||||||||||||||||||||||||||||||
| 751 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 752 | # Grouping done, now display... | ||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | my %didalreadysee; | |||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | foreach my $groupref ( @groups ) { | |||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | my ($repos, $meta, @vary) = @$groupref; | |||||||||||||||||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||||||||||||||||
| 758 | 0 | ▶ | my $aos = $meta->{'_alias'} || $meta->{'_seqno'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$meta->{'_alias'} || $meta->{'_seqno'}
MC/DC0%0/2
$meta->{'_alias'} || $meta->{'_seqno'}
$meta->{'_alias'}
$meta->{'_seqno'}
Truth table0%0/3
A || B
A= $meta->{'_alias'}B= $meta->{'_seqno'}
| |||||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||
| 760 | 0 | ▶ | my $multi = (scalar @vary > 1) ? "multi" : "single"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | push(@result, qq!<div class="result $multi" id="resgrp$aos">!); | |||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | push(@result, $cgi->h3({class=>"aggregator", onClick=>"toggle('ag$aos')"}, "Administrative Details")); | |||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | push(@result, $cgi->h3({class=>"beacon", onClick=>"toggle('bc$aos')"}, "Repository Details")); | |||||||||||||||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | ▶ | if ( $multi eq "single" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | push(@result, $cgi->h3({class=>"hit", onClick=>"toggle('ht$aos')"}, "Result Details")); | |||||||||||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | my $vary = $vary[0]; | |||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||
| 771 | 0 | my $hits = $vary->{'hits'}; | |||||||||||||||||||||||||||||||||||||||||
| 772 | 0 | my $description = $hits; | |||||||||||||||||||||||||||||||||||||||||
| 773 | |||||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | my $h = $vary->{'hash'}; | |||||||||||||||||||||||||||||||||||||||||
| 775 | 0 | ▶ | my $variantid = ($h eq $hash) ? "" : "variantid"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | my $p; | |||||||||||||||||||||||||||||||||||||||||
| 777 | 0 | ▶ | if ( $h eq $hash ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 778 | 0 | $p = $pretty} | |||||||||||||||||||||||||||||||||||||||||
| 779 | ▶ | elsif ( $clusterid && ref($c) ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$clusterid and ref $c
MC/DC0%0/2
$clusterid and ref $c
$clusterid
ref $c
Truth table0%0/3
A and B
A= $clusteridB= ref $c
| |||||||||||||||||||||||||||||||||||||||||||
| 780 | 0 | $c->value(""); | |||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | ▶ | my $did = $c->hash($h) || $c->value($h) || $h; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$c->hash($h) || $c->value($h) || $h
$c->hash($h) or $c->value($h)
MC/DC0%0/3
$c->hash($h) || $c->value($h) || $h
$c->hash($h)
$c->value($h)
$h
Truth table0%0/4
A or B || C
A= $c->hash($h)B= $c->value($h)C= $h
| |||||||||||||||||||||||||||||||||||||||||||
| 782 | 0 | ▶ | $p = $c->can("pretty") ? $c->pretty() : $c->value(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 783 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 784 | 0 | ▶ | $p = ($clusterid ? $h : $pretty) unless defined $p; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||
| 786 | 0 | my $uri = "???"; | |||||||||||||||||||||||||||||||||||||||||
| 787 | 0 | ▶ | if ( $uri = $vary->{'link'} ) { # o.k. | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 788 | } | ||||||||||||||||||||||||||||||||||||||||||
| 789 | ▶ | elsif ( $repos->{'ALTTARGET'} && $vary->{'altid'} ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$repos->{"ALTTARGET"} and $vary->{"altid"}
MC/DC0%0/2
$repos->{"ALTTARGET"} and $vary->{"altid"}
$repos->{"ALTTARGET"}
$vary->{"altid"}
Truth table0%0/3
A and B
A= $repos->{"ALTTARGET"}B= $vary->{"altid"}
| |||||||||||||||||||||||||||||||||||||||||||
| 790 | 0 | $uri = sprintf($repos->{'ALTTARGET'}, $p, SeeAlso::Source::BeaconAggregator::urlpseudoescape($vary->{'altid'}))} | |||||||||||||||||||||||||||||||||||||||||
| 791 | elsif ( $repos->{'TARGET'} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 792 | 0 | $uri = sprintf($repos->{'TARGET'}, $p)} | |||||||||||||||||||||||||||||||||||||||||
| 793 | elsif ( $repos->{'ALTTARGET'} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 794 | 0 | $uri = sprintf($repos->{'ALTTARGET'}, $p, SeeAlso::Source::BeaconAggregator::urlpseudoescape($p))}; | |||||||||||||||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||||||||||||||||
| 796 | 0 | ▶ | my $redundant = ($didalreadysee{$uri}++) ? "subsequent" : ""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||||||||||||
| 798 | 0 | my $guri = ""; | |||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | ▶ | if ( $repos->{'IMGTARGET'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 800 | 0 | $guri = sprintf($repos->{'IMGTARGET'}, $p, SeeAlso::Source::BeaconAggregator::urlpseudoescape($vary->{'altid'}))} | |||||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||||||
| 802 | 0 | ▶ | my @labels = grep /\S/, $repos->{'NAME'} || "", $repos->{'DESCRIPTION'} || "", $repos->{'INSTITUTION'} || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$repos->{'NAME'} || ''
$repos->{'DESCRIPTION'} || ''
$repos->{'INSTITUTION'} || ''
MC/DC0%0/1
$repos->{'NAME'} || ''
$repos->{'NAME'}
MC/DC0%0/1
$repos->{'DESCRIPTION'} || ''
$repos->{'DESCRIPTION'}
MC/DC0%0/1
$repos->{'INSTITUTION'} || ''
$repos->{'INSTITUTION'}
Truth table0%0/2
A
A= $repos->{'NAME'}
Truth table0%0/2
A
A= $repos->{'DESCRIPTION'}
Truth table0%0/2
A
A= $repos->{'INSTITUTION'}
| |||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | my $rlabel; | |||||||||||||||||||||||||||||||||||||||||
| 804 | 0 | ▶ | if ( $hits == 1 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | ▶ | $rlabel = $repos->{'ONEMESSAGE'} if $repos->{'ONEMESSAGE'}} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 806 | elsif ( $hits == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | ▶ | $rlabel = $repos->{'SOMEMESSAGE'} if $repos->{'SOMEMESSAGE'}}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 808 | 0 | ▶ | unless ( $rlabel ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | ▶ | $rlabel = $repos->{'MESSAGE'} || shift @labels || "???"}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$repos->{'MESSAGE'} || shift @labels || '???'
$repos->{"MESSAGE"} or shift @labels
MC/DC0%0/2
$repos->{'MESSAGE'} || shift @labels || '???'
$repos->{"MESSAGE"}
shift @labels
Truth table0%0/3
A or B
A= $repos->{"MESSAGE"}B= shift @labels
| |||||||||||||||||||||||||||||||||||||||||||
| 810 | 0 | my $label = sprintf($rlabel, $hits); | |||||||||||||||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||||||||||||||||
| 812 | 0 | ▶ | my $ttip = pop @labels || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
pop @labels || ''
MC/DC0%0/1
pop @labels || ''
pop @labels
Truth table0%0/2
A
A= pop @labels
| |||||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | $ttip =~ s/&#(\d+);/chr($1)/ge; | |||||||||||||||||||||||||||||||||||||||||
| 814 | |||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | ▶ | push(@result, $cgi->a({style=>"float: right; clear: right;", href=>$uri}, $cgi->img({alt=>$vary->{'info'}||$label,src=>$guri}))) if $guri; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$vary->{'info'} || $label
MC/DC0%0/2
$vary->{'info'} || $label
$vary->{'info'}
$label
Truth table0%0/3
A || B
A= $vary->{'info'}B= $label
| |||||||||||||||||||||||||||||||||||||||||||
| 816 | |||||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | push(@result, $cgi->h2({class=>"label $redundant $variantid ident_$p", id=>"head$aos"}, $cgi->a({href=>$uri, title=>$ttip}, $label))); | |||||||||||||||||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||||||||||||||||
| 819 | 0 | push(@result, qq!<div class="synopsis" id="syn$aos">!); | |||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | ▶ | push(@result, $cgi->span($vary->{'info'})) if $vary->{'info'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 821 | 0 | ▶ | push(@result, $cgi->span("($hits Treffer)")) if $hits && ($rlabel !~ /%s/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$hits and not $rlabel =~ /%s/
MC/DC0%0/2
$hits and not $rlabel =~ /%s/
$hits
not $rlabel =~ /%s/
Truth table0%0/3
A and not(B)
A= $hitsB= not $rlabel =~ /%s/
| |||||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | push(@result, '</div>'); | |||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||
| 824 | 0 | push(@result, qq!<div class="hit" id="ht$aos" style="display: none;">!); | |||||||||||||||||||||||||||||||||||||||||
| 825 | 0 | push(@result, $cgi->p({class=>"ht_uri"}, $cgi->span("Target URL:"), $cgi->a({href=>$uri}, CGI::escapeHTML($uri)))); | |||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | ▶ | push(@result, $cgi->p({class=>"ht_guri"}, $cgi->span("Preview URL:"), $cgi->a({href=>$guri}, $guri))) if $guri; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 827 | 0 | ▶ | push(@result, $cgi->p({class=>"ht_hits"}, $cgi->span("Hits:"), $hits)) if $hits; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 828 | 0 | ▶ | push(@result, $cgi->p({class=>"ht_info"}, $cgi->span("Additional Info:"), $vary->{'info'})) if $vary->{'info'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 829 | 0 | ▶ | push(@result, $cgi->p({class=>"ht_idnote"}, $cgi->span("Variant Identifier:"), $p)) if $variantid; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 830 | 0 | push(@result, '</div>'); | |||||||||||||||||||||||||||||||||||||||||
| 831 | } | ||||||||||||||||||||||||||||||||||||||||||
| 832 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 833 | 0 | push(@result, $cgi->h3({class=>"hit", onClick=>"mtoggle('res$aos', 'hit')"}, "Result Details")); | |||||||||||||||||||||||||||||||||||||||||
| 834 | 0 | my $hits = scalar @vary; | |||||||||||||||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||||||||||||||||
| 836 | 0 | ▶ | my @labels = grep /\S/, $repos->{'NAME'} || "", $repos->{'DESCRIPTION'} || "", $repos->{'INSTITUTION'} || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$repos->{'NAME'} || ''
$repos->{'DESCRIPTION'} || ''
$repos->{'INSTITUTION'} || ''
MC/DC0%0/1
$repos->{'NAME'} || ''
$repos->{'NAME'}
MC/DC0%0/1
$repos->{'DESCRIPTION'} || ''
$repos->{'DESCRIPTION'}
MC/DC0%0/1
$repos->{'INSTITUTION'} || ''
$repos->{'INSTITUTION'}
Truth table0%0/2
A
A= $repos->{'NAME'}
Truth table0%0/2
A
A= $repos->{'DESCRIPTION'}
Truth table0%0/2
A
A= $repos->{'INSTITUTION'}
| |||||||||||||||||||||||||||||||||||||||||||
| 837 | 0 | ▶ | my $rlabel = $repos->{'MESSAGE'} || shift @labels || "???"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$repos->{'MESSAGE'} || shift @labels || '???'
$repos->{"MESSAGE"} or shift @labels
MC/DC0%0/2
$repos->{'MESSAGE'} || shift @labels || '???'
$repos->{"MESSAGE"}
shift @labels
Truth table0%0/3
A or B
A= $repos->{"MESSAGE"}B= shift @labels
| |||||||||||||||||||||||||||||||||||||||||||
| 838 | 0 | ▶ | my $ttip = pop @labels || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
pop @labels || ''
MC/DC0%0/1
pop @labels || ''
pop @labels
Truth table0%0/2
A
A= pop @labels
| |||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | $ttip =~ s/&#(\d+);/chr($1)/ge; | |||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||
| 841 | # my $rlabel = $repos->{'SOMEMESSAGE'} || $repos->{'MESSAGE'} || $repos->{'DESCRIPTION'} || $repos->{'NAME'} || $repos->{'INSTITUTION'} || "???"; | ||||||||||||||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||||||||||||
| 843 | # my $ttip = $repos->{'MESSAGE'} ? $repos->{'DESCRIPTION'} || $repos->{'NAME'} || $repos->{'INSTITUTION'} || "" | ||||||||||||||||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||||||||||||||||
| 845 | # : $repos->{'INSTITUTION'} || $repos->{'NAME'} || ""; | ||||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||
| 847 | # $ttip = "" if $ttip eq $rlabel; | ||||||||||||||||||||||||||||||||||||||||||
| 848 | 0 | $ttip =~ s/&#(\d+);/chr($1)/ge; | |||||||||||||||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | my $label = sprintf($rlabel, $hits); | |||||||||||||||||||||||||||||||||||||||||
| 851 | 0 | push(@result, $cgi->h2({class=>"label", id=>"head$aos"}, $label)); | |||||||||||||||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||||||||||||||||
| 853 | 0 | push(@result, qq!<dl id="res$aos" title="$ttip">!); | |||||||||||||||||||||||||||||||||||||||||
| 854 | 0 | my $cnt = 0; | |||||||||||||||||||||||||||||||||||||||||
| 855 | 0 | foreach my $vary ( @vary ) { | |||||||||||||||||||||||||||||||||||||||||
| 856 | 0 | $cnt ++; | |||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||
| 858 | 0 | my $h = $vary->{'hash'}; | |||||||||||||||||||||||||||||||||||||||||
| 859 | 0 | ▶ | my $variantid = ($h eq $hash) ? "" : "variantid"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 860 | 0 | my $p; | |||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | ▶ | if ( $h eq $hash ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 862 | 0 | $p = $pretty} | |||||||||||||||||||||||||||||||||||||||||
| 863 | ▶ | elsif ( $clusterid && ref($c) ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$clusterid and ref $c
MC/DC0%0/2
$clusterid and ref $c
$clusterid
ref $c
Truth table0%0/3
A and B
A= $clusteridB= ref $c
| |||||||||||||||||||||||||||||||||||||||||||
| 864 | 0 | $c->value(""); | |||||||||||||||||||||||||||||||||||||||||
| 865 | 0 | ▶ | my $did = $c->hash($h) || $c->value($h) || $h; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$c->hash($h) || $c->value($h) || $h
$c->hash($h) or $c->value($h)
MC/DC0%0/3
$c->hash($h) || $c->value($h) || $h
$c->hash($h)
$c->value($h)
$h
Truth table0%0/4
A or B || C
A= $c->hash($h)B= $c->value($h)C= $h
| |||||||||||||||||||||||||||||||||||||||||||
| 866 | 0 | ▶ | $p = $c->can("pretty") ? $c->pretty() : $c->value(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 867 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 868 | 0 | ▶ | $p = ($clusterid ? $h : $pretty) unless defined $p; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||||||||||||||||
| 870 | 0 | my $uri = "???"; | |||||||||||||||||||||||||||||||||||||||||
| 871 | 0 | ▶ | if ( $uri = $vary->{'link'} ) { # o.k. | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 872 | } | ||||||||||||||||||||||||||||||||||||||||||
| 873 | ▶ | elsif ( $repos->{'ALTTARGET'} && $vary->{'altid'} ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$repos->{"ALTTARGET"} and $vary->{"altid"}
MC/DC0%0/2
$repos->{"ALTTARGET"} and $vary->{"altid"}
$repos->{"ALTTARGET"}
$vary->{"altid"}
Truth table0%0/3
A and B
A= $repos->{"ALTTARGET"}B= $vary->{"altid"}
| |||||||||||||||||||||||||||||||||||||||||||
| 874 | 0 | $uri = sprintf($repos->{'ALTTARGET'}, $p, SeeAlso::Source::BeaconAggregator::urlpseudoescape($vary->{'altid'}))} | |||||||||||||||||||||||||||||||||||||||||
| 875 | elsif ( $repos->{'TARGET'} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 876 | 0 | $uri = sprintf($repos->{'TARGET'}, $p)} | |||||||||||||||||||||||||||||||||||||||||
| 877 | elsif ( $repos->{'ALTTARGET'} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 878 | 0 | $uri = sprintf($repos->{'ALTTARGET'}, $p, SeeAlso::Source::BeaconAggregator::urlpseudoescape($p))}; | |||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | ▶ | my $redundant = ($didalreadysee{$uri}++) ? "subsequent" : ""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | my $guri = ""; | |||||||||||||||||||||||||||||||||||||||||
| 883 | 0 | ▶ | if ( $repos->{'IMGTARGET'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 884 | 0 | $guri = sprintf($repos->{'IMGTARGET'}, $p, SeeAlso::Source::BeaconAggregator::urlpseudoescape($vary->{'altid'}))} | |||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | ▶ | my $hits = $vary->{hits} if $vary->{hits} and $vary->{hits} != 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$vary->{"hits"} and $vary->{"hits"} != 1
MC/DC0%0/2
$vary->{"hits"} and $vary->{"hits"} != 1
$vary->{"hits"}
$vary->{"hits"} != 1
Truth table0%0/3
A and B
A= $vary->{"hits"}B= $vary->{"hits"} != 1
| |||||||||||||||||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | push(@result, qq!<dt class="synopsis $redundant $variantid ident_$p" id="syn$aos-$cnt">!); | |||||||||||||||||||||||||||||||||||||||||
| 889 | 0 | ▶ | push(@result, $cgi->div({style=>"float: right;"}, $cgi->a({href=>$uri}, $cgi->img({src=>$guri})))) if $guri; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 890 | 0 | ▶ | push(@result, $cgi->a({href=>$uri}, $cgi->span($vary->{'info'} || "[$cnt.]"))); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$vary->{'info'} || "[$cnt.]"
MC/DC0%0/1
$vary->{'info'} || "[$cnt.]"
$vary->{'info'}
Truth table0%0/2
A
A= $vary->{'info'}
| |||||||||||||||||||||||||||||||||||||||||||
| 891 | 0 | ▶ | push(@result, $cgi->span("($hits Treffer)")) if $hits; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 892 | 0 | push(@result, '</dt>'); | |||||||||||||||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||||||||||||||||
| 894 | 0 | push(@result, qq!<dd class="hit" id="ht$aos-$cnt" style="display: none;">!); | |||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | push(@result, $cgi->p({class=>"ht_uri"}, $cgi->span("Target URL:"), $cgi->a({href=>$uri}, $uri))); | |||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | ▶ | push(@result, $cgi->p({class=>"ht_guri"}, $cgi->span("Preview URL:"), $cgi->a({href=>$guri}, $guri))) if $guri; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | ▶ | push(@result, $cgi->p({class=>"ht_hits"}, $cgi->span("Hits:"), $vary->{hits})) if $vary->{hits}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 898 | 0 | ▶ | push(@result, $cgi->p({class=>"ht_info"}, $cgi->span("Additional Info:"), $vary->{'info'})) if $vary->{'info'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | ▶ | push(@result, $cgi->p({class=>"ht_idnote"}, $cgi->span("Variant Identifier:"), $p)) if $variantid; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||||||||||
| 901 | 0 | push(@result, '<div class="floatfinish"><!-- egal --></div>'); | |||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | push(@result, '</dd>'); | |||||||||||||||||||||||||||||||||||||||||
| 903 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | push(@result, qq!</dl>!); | |||||||||||||||||||||||||||||||||||||||||
| 905 | } | ||||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | push(@result, qq!<div class="beacon" id="bc$aos" style="display: none;">!); | |||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | foreach ( sort keys %$repos ) { | |||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | ▶ | next if /(MESSAGE|TARGET)$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 910 | 0 | ▶ | next unless $repos->{$_}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | $repos->{$_} =~ s!([a-z]+://\S+)!$cgi->a({href=>"$1", target=>"_blank"}, "$1")!ge; # URL | |||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | $repos->{$_} =~ s!(?:\<\s*)?(\w[\w.-]*)\@((?:\w[\w-]*\.)+\w+)(?:\s*\>)?!<$1 (at) $2>!g; # Mail Addr | |||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | $repos->{$_} =~ s/\s*\|\s*/ | /g; # Examples | |||||||||||||||||||||||||||||||||||||||||
| 914 | 0 | ▶ | next if /^(FORMAT|PREFIX|REVISIT|VERSION)$/; # Postpone to "administrative Details" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 915 | 0 | push(@result, $cgi->p({class=>"bc_$_"}, $cgi->span("#$_:"), $repos->{$_})); | |||||||||||||||||||||||||||||||||||||||||
| 916 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 917 | 0 | ▶ | push(@result, $cgi->p({class=>"ag_mtime"}, $cgi->span("Modified:"), $meta->{'_mtime'})) if $meta->{'_mtime'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | push(@result, '</div>'); | |||||||||||||||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||||||||||||||||
| 920 | 0 | push(@result, qq!<div class="aggregator" id="ag$aos" style="display: none;">!); | |||||||||||||||||||||||||||||||||||||||||
| 921 | 0 | foreach ( sort keys %$repos ) { | |||||||||||||||||||||||||||||||||||||||||
| 922 | 0 | ▶ | next unless /^(FORMAT|PREFIX|REVISIT|VERSION)$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 923 | 0 | ▶ | next unless $repos->{$_}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 924 | 0 | push(@result, $cgi->p({class=>"bc_$_"}, $cgi->span("#$_:"), $repos->{$_})); | |||||||||||||||||||||||||||||||||||||||||
| 925 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 926 | 0 | ▶ | push(@result, $cgi->p({class=>"ag_ftime"}, $cgi->span("Loaded:"), $meta->{'_ftime'})) if $meta->{'_ftime'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | ▶ | push(@result, $cgi->p({class=>"ag_fstat"}, $cgi->span("Load status:"), $meta->{'_fstat'})) if $meta->{'_fstat'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | ▶ | push(@result, $cgi->p({class=>"ag_utime"}, $cgi->span("Update attempt:"), $meta->{'_utime'})) if $meta->{'_utime'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | ▶ | push(@result, $cgi->p({class=>"ag_ustat"}, $cgi->span("Update status:"), $meta->{'_ustat'})) if $meta->{'_ustat'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 930 | 0 | ▶ | push(@result, $cgi->p({class=>"ag_counti"}, $cgi->span("Identifiers:"), $meta->{'_counti'})) if $meta->{'_counti'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 931 | 0 | ▶ | push(@result, $cgi->p({class=>"ag_countu"}, $cgi->span("Distinct Ids:"), $meta->{'_countu'})) if $meta->{'_countu'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 932 | 0 | ▶ | push(@result, $cgi->p({class=>"ag_sort"}, $cgi->span("Sort key:"), $meta->{'_sort'})) if $meta->{'_sort'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | ▶ | push(@result, $cgi->p({class=>"ag_admin"}, $cgi->span("Remark:"), $meta->{'_admin'})) if $meta->{'_admin'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 934 | 0 | push(@result, '</div>'); | |||||||||||||||||||||||||||||||||||||||||
| 935 | |||||||||||||||||||||||||||||||||||||||||||
| 936 | 0 | push(@result, '<div class="floatfinish"><!-- egal --></div>'); | |||||||||||||||||||||||||||||||||||||||||
| 937 | |||||||||||||||||||||||||||||||||||||||||||
| 938 | 0 | push(@result, '</div>'); | |||||||||||||||||||||||||||||||||||||||||
| 939 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 940 | 0 | push(@result, '</div>'); | |||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||
| 942 | 0 | push(@result, '<div id="meta">'); | |||||||||||||||||||||||||||||||||||||||||
| 943 | # $cgi->span("provided by:"), | ||||||||||||||||||||||||||||||||||||||||||
| 944 | 0 | push(@result, $cgi->p({class=>"mt_NAME"}, $cgi->a({href=>$target}, $servicename))); | |||||||||||||||||||||||||||||||||||||||||
| 945 | # $cgi->span("Service description:"), | ||||||||||||||||||||||||||||||||||||||||||
| 946 | 0 | ▶ | (my $descr = $beaconmeta->{'DESCRIPTION'} || $osd->{'Description'} || "") =~ s/([<>&"]|[^\x00-\x7f])/'&#'.ord($1).';'/ge; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$beaconmeta->{'DESCRIPTION'} || $osd->{'Description'} || ''
$beaconmeta->{"DESCRIPTION"} or $osd->{"Description"}
MC/DC0%0/2
$beaconmeta->{'DESCRIPTION'} || $osd->{'Description'} || ''
$beaconmeta->{"DESCRIPTION"}
$osd->{"Description"}
Truth table0%0/3
A or B
A= $beaconmeta->{"DESCRIPTION"}B= $osd->{"Description"}
| |||||||||||||||||||||||||||||||||||||||||||
| 947 | 0 | push(@result, $cgi->p({class=>"mt_DESCRIPTION"}, $descr)); | |||||||||||||||||||||||||||||||||||||||||
| 948 | 0 | push(@result, '</div>'); | |||||||||||||||||||||||||||||||||||||||||
| 949 | |||||||||||||||||||||||||||||||||||||||||||
| 950 | 0 | my($tu, $ts, $tcu, $tcs) = times(); | |||||||||||||||||||||||||||||||||||||||||
| 951 | 0 | push(@result, sprintf("<!-- user: %.3fs + sys: %.3fs = %.3fs -->", $tu, $ts, $tu+$ts), $cgi->end_html()); | |||||||||||||||||||||||||||||||||||||||||
| 952 | 0 | return join("\n", @result); | |||||||||||||||||||||||||||||||||||||||||
| 953 | } | ||||||||||||||||||||||||||||||||||||||||||
| 954 | |||||||||||||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||||||||||||
| 956 | =head2 get_meta () | ||||||||||||||||||||||||||||||||||||||||||
| 957 | |||||||||||||||||||||||||||||||||||||||||||
| 958 | Returns a pair of hash references: | ||||||||||||||||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||||||||||||||||
| 960 | =over 8 | ||||||||||||||||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||||||||||||||||
| 962 | =item 1 | ||||||||||||||||||||||||||||||||||||||||||
| 963 | |||||||||||||||||||||||||||||||||||||||||||
| 964 | OSD fields | ||||||||||||||||||||||||||||||||||||||||||
| 965 | |||||||||||||||||||||||||||||||||||||||||||
| 966 | =item 2 | ||||||||||||||||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||||||||||||||||
| 968 | Beacon header fields | ||||||||||||||||||||||||||||||||||||||||||
| 969 | |||||||||||||||||||||||||||||||||||||||||||
| 970 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||||||||||||||||
| 972 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||||||||||||||||
| 974 | 1 | ▶ | sub get_meta { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_meta: called CC=8 SCAR=20.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 975 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 976 | |||||||||||||||||||||||||||||||||||||||||||
| 977 | 1 | my ($metasth, $metaexpl) = $self->stmtHdl(<<"XxX"); | |||||||||||||||||||||||||||||||||||||||||
| 978 | SELECT key, val FROM osd; | ||||||||||||||||||||||||||||||||||||||||||
| 979 | XxX | ||||||||||||||||||||||||||||||||||||||||||
| 980 | 1 | ▶ | $self->stmtExplain($metaexpl) if $ENV{'DBI_PROFILE'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 981 | 1 | ▶ | $metasth->execute() or croak("Could not execute >".$metasth->{Statement}."<: ".$metasth->errstr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 982 | 1 | my (%osd, %beaconmeta); | |||||||||||||||||||||||||||||||||||||||||
| 983 | 1 | ▶ | while ( my $aryref = $metasth->fetchrow_arrayref ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 984 | 9 | my ($key, $val) = @$aryref; | |||||||||||||||||||||||||||||||||||||||||
| 985 | 9 | ▶ | next unless $val; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 986 | 9 | ▶ | if ($key =~ s/^bc// ) { # BeaconMeta Fields | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 987 | 2 | $beaconmeta{$key} = $val} | |||||||||||||||||||||||||||||||||||||||||
| 988 | elsif ( exists $osd{$key} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 989 | 6 | ▶ | if ( ref($osd{$key}) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 990 | 5 | push(@{$osd{$key}}, $val)} | |||||||||||||||||||||||||||||||||||||||||
| 991 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 992 | 1 | $osd{$key} = [$osd{$key}, $val]}; | |||||||||||||||||||||||||||||||||||||||||
| 993 | } | ||||||||||||||||||||||||||||||||||||||||||
| 994 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 995 | 1 | $osd{$key} = $val}; | |||||||||||||||||||||||||||||||||||||||||
| 996 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 997 | 1 | return (\%osd, \%beaconmeta); | |||||||||||||||||||||||||||||||||||||||||
| 998 | } | ||||||||||||||||||||||||||||||||||||||||||
| 999 | |||||||||||||||||||||||||||||||||||||||||||
| 1000 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 1001 | |||||||||||||||||||||||||||||||||||||||||||
| 1002 | Thomas Berger | ||||||||||||||||||||||||||||||||||||||||||
| 1003 | CPAN ID: THB | ||||||||||||||||||||||||||||||||||||||||||
| 1004 | gymel.com | ||||||||||||||||||||||||||||||||||||||||||
| 1005 | THB@cpan.org | ||||||||||||||||||||||||||||||||||||||||||
| 1006 | |||||||||||||||||||||||||||||||||||||||||||
| 1007 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||
| 1008 | |||||||||||||||||||||||||||||||||||||||||||
| 1009 | This program is free software; you can redistribute | ||||||||||||||||||||||||||||||||||||||||||
| 1010 | it and/or modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||
| 1011 | |||||||||||||||||||||||||||||||||||||||||||
| 1012 | The full text of the license can be found in the | ||||||||||||||||||||||||||||||||||||||||||
| 1013 | LICENSE file included with this module. | ||||||||||||||||||||||||||||||||||||||||||
| 1014 | |||||||||||||||||||||||||||||||||||||||||||
| 1015 | |||||||||||||||||||||||||||||||||||||||||||
| 1016 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1017 | |||||||||||||||||||||||||||||||||||||||||||
| 1018 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 1019 | # The preceding line will help the module return a true value | ||||||||||||||||||||||||||||||||||||||||||
| 1020 | |||||||||||||||||||||||||||||||||||||||||||