lib/PXML/SVG.pm

filter: Statementstmt 82.5% 33 / 40 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 6 / 8 Podpod 0.0% 0 / 1 totaltotal 73.5% 39 / 53 CC 3 SCAR 11.0
CC
3
Cov
75%
svg
6.0
__ANON__
6.0
BEGIN
1.0
CRAP 3.0
« lib/FP/Abstract/Sequence.pm ↑ Summary lib/FP/Currying.pm »
1 #
2 # Copyright (c) 2014-2015 Christian Jaeger, copying@christianjaeger.ch
3 #
4 # This is free software, offered under either the same terms as perl 5
5 # or the terms of the Artistic License version 2 or the terms of the
6 # MIT License (Expat version). See the file COPYING.md that came
7 # bundled with this file.
8 #
9  
10 =head1 NAME
11  
12 PXML::SVG
13  
14 =head1 SYNOPSIS
15  
16 =head1 DESCRIPTION
17  
18  
19 =head1 NOTE
20  
21 This is alpha software! Read the status section in the package README
22 or on the L<website|http://functional-perl.org/>.
23  
24 =cut
25  
26 package PXML::SVG;
27 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 1 ▶use warnings FATAL => 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
30 1 ▶use Exporter "import";
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 1 ▶use PXML::Element;
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 1 our $tags = [
35 'svg', 'path', 'a',
36  
37 # XXX unfinished! Many more of course.
38 ];
39  
40 0 ▶sub svg {
Subroutine svg: not called CC=2 SCAR=17.9
Pod undocumented
41 0 ▶ my $attrs = ref $_[0] eq "HASH" ? shift : {};
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'HASH' ? : 0 0 0
42 0 my $attrs2 = +{%$attrs};
43 0 $$attrs2{xmlns} = "http://www.w3.org/2000/svg";
44 0 $$attrs2{"xmlns:xlink"} = "http://www.w3.org/1999/xlink";
45 0 PXML::SVG::SVG($attrs2, @_)
46 }
47  
48 # XX mostly copy paste from PXHTML. Abstract away, please.
49  
50 1 our $nbsp = "\xa0";
51  
52 our $funcs = [
53 map {
54 1 my $tag = $_;
55 [
56 uc $tag,
57 0 ▶ sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
58 0 ▶ my $atts = ref($_[0]) eq "HASH" ? shift : undef;
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'HASH' ? : 0 0 0
59 0 PXML::PSVG->new($tag, $atts, [@_]);
60 }
61 3 ]
62 } @$tags
63 ];
64  
65 1 for (@$funcs) {
66 3 my ($name, $fn) = @$_;
67 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
68 3 *{"PXML::SVG::$name"} = $fn
69 }
70  
71 1 our @EXPORT_OK = ('svg', '$nbsp', map { $$_[0] } @$funcs);
72 1 our %EXPORT_TAGS = (all => \@EXPORT_OK);
73  
74 {
75  
76 1 package PXML::PSVG;
77 1 our @ISA = "PXML::Element";
78  
79 # serialize to HTML5 compatible representation: -- nope, not
80 # necessary for SVG, ok? Assuming XHTML always? And different tags
81 # anyway, ok?
82 }
83  
84 1 1
« lib/FP/Abstract/Sequence.pm ↑ Summary lib/FP/Currying.pm »