blib/lib/Embperl/Recipe/XSLT.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 42 CC 4 SCAR 24.0
CC
4
Cov
0%
get_recipe
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 11.0
1  
2 ###################################################################################
3 #
4 # Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh www.ecos.de
5 # Embperl - Copyright (c) 2008-2015 Gerald Richter
6 # Embperl - Copyright (c) 2015-2023 actevy.io
7 #
8 # You may distribute under the terms of either the GNU General Public
9 # License or the Artistic License, as specified in the Perl README file.
10 #
11 # THIS PACKAGE IS PROVIDED 'AS IS' AND WITHOUT ANY EXPRESS OR
12 # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
13 # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 #
15 ###################################################################################
16
17  
18  
19 package Embperl::Recipe::XSLT ;
20  
21 use strict ;
22 use vars qw{@ISA} ;
23  
24 use Embperl::Recipe ;
25  
26 no warnings "uninitialized" ;
27  
28 @ISA = ('Embperl::Recipe') ;
29  
30 # ---------------------------------------------------------------------------------
31 #
32 # Create a new recipe by converting request parameter
33 #
34 # ---------------------------------------------------------------------------------
35  
36  
37 sub get_recipe
38  
39 {
40 my ($class, $r, $recipe, $src) = @_ ;
41  
42 my $param = $r -> component -> param ;
43 my $config = $r -> component -> config ;
44 my $xsltproc = $config -> xsltproc ;
45 my @recipe ;
46  
47 my @stylesheet =
48 (
49 { type => 'file', 'filename' => $config -> xsltstylesheet, },
50 { type => $xsltproc . '-compile-xsl', cache => 1 },
51 ) ;
52  
53 if (!$src)
54 {
55 push @recipe, {'type' => ref ($param -> input)?'memory':'file' } ;
56 }
57 else
58 {
59 push @recipe, ref $src eq 'ARRAY'?@$src:$src ;
60 }
61  
62 push @recipe, {'type' => $xsltproc . '-parse-xml', } ;
63 push @recipe, {'type' => $xsltproc, stylesheet => \@stylesheet } ;
64  
65 return \@recipe ;
66 }
67  
68 1 ;
69  
70  
71 __END__