lib/Template/Plugin.pm

filter: Statementstmt 71.4% 15 / 21 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 4 / 6 Podpod 66.6% 2 / 3 totaltotal 68.7% 22 / 32 CC 1 SCAR 2.9
CC
1
Cov
70%
new
2.0
fail
2.0
BEGIN
1.0
CRAP 1.3
« lib/Template/Plugin/Format.pm ↑ Summary lib/Template/Plugin/View.pm »
1 #============================================================= -*-Perl-*-
2 #
3 # Template::Plugin
4 #
5 # DESCRIPTION
6 #
7 # Module defining a base class for a plugin object which can be loaded
8 # and instantiated via the USE directive.
9 #
10 # AUTHOR
11 # Andy Wardley <abw@wardley.org>
12 #
13 # COPYRIGHT
14 # Copyright (C) 1996-2022 Andy Wardley. All Rights Reserved.
15 #
16 # This module is free software; you can redistribute it an/or
17 # modify it under the same terms as Perl itself.
18 #
19 #============================================================================
20  
21 package Template::Plugin;
22  
23 34 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 34 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 34 ▶use base 'Template::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 34 our $VERSION = '3.106';
28 34 ▶our $DEBUG = 0 unless defined $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $Template::Plugin::DEBUG 34 0 34
29 34 our $ERROR = '';
30 34 our $AUTOLOAD;
31  
32  
33 #========================================================================
34 # ----- CLASS METHODS -----
35 #========================================================================
36  
37 #------------------------------------------------------------------------
38 # load()
39 #
40 # Class method called when the plugin module is first loaded. It
41 # returns the name of a class (by default, its own class) or a prototype
42 # object which will be used to instantiate new objects. The new()
43 # method is then called against the class name (class method) or
44 # prototype object (object method) to create a new instances of the
45 # object.
46 #------------------------------------------------------------------------
47  
48 56 ▶sub load {
Subroutine load: called CC=1 SCAR=0.0
Pod documented
49 56 return $_[0];
50 }
51  
52  
53 #------------------------------------------------------------------------
54 # new($context, $delegate, @params)
55 #
56 # Object constructor which is called by the Template::Context to
57 # instantiate a new Plugin object. This base class constructor is
58 # used as a general mechanism to load and delegate to other Perl
59 # modules. The context is passed as the first parameter, followed by
60 # a reference to a delegate object or the name of the module which
61 # should be loaded and instantiated. Any additional parameters passed
62 # to the USE directive are forwarded to the new() constructor.
63 #
64 # A plugin object is returned which has an AUTOLOAD method to delegate
65 # requests to the underlying object.
66 #------------------------------------------------------------------------
67  
68 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
69 0 my $class = shift;
70 0 bless {
71 }, $class;
72 }
73  
74 #------------------------------------------------------------------------
75 # fail($error)
76 #
77 # Version 1 error reporting function, now replaced by error() inherited
78 # from Template::Base. Raises a "deprecated function" warning and then
79 # calls error().
80 #------------------------------------------------------------------------
81  
82 0 ▶sub fail {
Subroutine fail: not called CC=1 SCAR=6.9
Pod undocumented
83 0 my $class = shift;
84 0 my ($pkg, $file, $line) = caller();
85 0 warn "Template::Plugin::fail() is deprecated at $file line $line. Please use error()\n";
86 0 $class->error(@_);
87 }
88  
89 34 1;
90  
91 __END__
« lib/Template/Plugin/Format.pm ↑ Summary lib/Template/Plugin/View.pm »