File Coverage

blib/lib/WebDyne/Err/Constant.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition 1 2 50.0
subroutine 5 5 100.0
pod 0 1 0.0
total 22 24 91.6


line stmt bran cond sub pod time code
1             #
2             # This file is part of WebDyne.
3             #
4             # This software is copyright (c) 2026 by Andrew Speer .
5             #
6             # This is free software; you can redistribute it and/or modify it under
7             # the same terms as the Perl 5 programming language system itself.
8             #
9             # Full license text is available at:
10             #
11             #
12             #
13             package WebDyne::Err::Constant;
14              
15              
16             # Pragma
17             #
18 7     7   46 use strict qw(vars);
  7         12  
  7         369  
19 7     7   42 use vars qw($VERSION @ISA %Constant);
  7         12  
  7         454  
20 7     7   35 use warnings;
  7         11  
  7         560  
21              
22              
23             # Does the heavy liftying of importing into caller namespace
24             #
25             require WebDyne::Constant;
26             @ISA=qw(WebDyne::Constant);
27              
28              
29             # Need the File::Spec module
30             #
31 7     7   52 use File::Spec;
  7         10  
  7         1539  
32              
33              
34             # Version information
35             #
36             $VERSION='2.075';
37              
38              
39             # Hash of constants
40             #
41             %Constant=(
42              
43              
44             # Where we keep the error template
45             #
46             WEBDYNE_ERR_TEMPLATE => File::Spec->catfile(&class_dn(__PACKAGE__), 'error.psp'),
47              
48              
49             # If set to 1, error messages will be sent as text/plain, not
50             # HTML. If ERROR_EXIT set, child will quit after an error
51             #
52             WEBDYNE_ERROR_TEXT => 0,
53             WEBDYNE_ERROR_EXIT => 0,
54              
55              
56             );
57              
58              
59             sub class_dn {
60              
61              
62             # Get class dir
63             #
64 7     7 0 16 my $class=shift();
65              
66              
67             # Get package file name so we can look up in inc
68             #
69 7         40 (my $class_fn="${class}.pm")=~s{::}{/}g;
70 7   50     35 $class_fn=$INC{$class_fn} ||
71             die("unable to find location for $class in \%INC");
72              
73              
74             # Split
75             #
76 7         282 my $class_dn=(File::Spec->splitpath($class_fn))[1];
77              
78             }
79              
80              
81             # Done
82             #
83             1;