Query/Functions.pm

filter: Statementstmt 100% 32 / 32 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 100% 47 / 47 CC 5 SCAR 9.8
CC
5
Cov
100%
install_function
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
« Query/ExecutionContext.pm ↑ Summary Query/Algebra/Load.pm »
1 # RDF::Query::Functions
2 # -----------------------------------------------------------------------------
3  
4 =head1 NAME
5  
6 RDF::Query::Functions - Standard Extension Functions
7  
8 =head1 VERSION
9  
10 This document describes RDF::Query::Functions version 2.919.
11  
12 =head1 DESCRIPTION
13  
14 This stub module simply loads all other modules named
15 C<< RDF::Query::Functions::* >>. Each of those modules
16 has an C<install> method that simply adds coderefs
17 to C<< %RDF::Query::functions >>.
18  
19 =head1 METHODS
20  
21 =over 4
22  
23 =cut
24  
25 package RDF::Query::Functions;
26  
27 35 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 35 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 35 ▶no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 35 our $BLOOM_FILTER_LOADED;
32  
33 35 ▶use Scalar::Util qw(refaddr);
Subroutine BEGIN: called CC=1 SCAR=0.0
34 35 ▶use Log::Log4perl;
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 use Module::Pluggable
37 35 ▶ search_path => [ __PACKAGE__ ],
Subroutine BEGIN: called CC=1 SCAR=0.0
38 require => 1,
39 inner => 1,
40 sub_name => 'function_sets',
41 35 ;
42  
43 ######################################################################
44  
45 35 our ($VERSION, $l);
46 35 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
47 35 $l = Log::Log4perl->get_logger("rdf.query.functions");
48 35 $VERSION = '2.919';
49 }
50  
51 ######################################################################
52  
53 =item C<< install_function ( $uri, \&func ) >>
54  
55 =item C<< install_function ( \@uris, \&func ) >>
56  
57 Install the supplied CODE reference as the implementation for the given function URI(s).
58  
59 =cut
60  
61 3220 ▶sub install_function {
Subroutine install_function: called CC=5 SCAR=16.1
Pod documented
62 3220 my $class = shift;
63 3220 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 3220 3220 6440
64 3220 my $uris = shift;
65 3220 my $func = shift;
66 3220 ▶ $RDF::Query::preferred_function_name{ refaddr($func) } = ref($uris) ? $uris->[0] : $uris;
Branch: 1 branch
BranchTrueFalseTotal
ref $uris ? : 315 2905 3220
67 3220 ▶ foreach my $uri (ref($uris) ? @$uris : $uris) {
Branch: 1 branch
BranchTrueFalseTotal
ref $uris ? : 315 2905 3220
68 3535 $RDF::Query::functions{$uri} = $func;
69 }
70 }
71 }
72  
73 35 foreach my $function_set (__PACKAGE__->function_sets) {
74 175 $function_set->install;
75 }
76  
77 35 1;
78  
79 __END__
« Query/ExecutionContext.pm ↑ Summary Query/Algebra/Load.pm »