/usr/share/perl5/EmailReminder/Utils.pm is in email-reminder 0.7.8-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | # This file is part of Email-Reminder.
#
# Email-Reminder is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# Email-Reminder is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Email-Reminder; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
package EmailReminder::Utils;
# Utility subroutines for the Email-Reminder program
use strict;
use warnings;
use XML::DOM;
our $VERSION = '0.7.8';
our $USER_CONFIG_FILE = '.email-reminders';
our $SPOOL_DIRECTORY = '/var/spool/email-reminder';
my %names = (
1 => "Paper",
2 => "Cotton",
3 => "Leather",
4 => "Linen",
5 => "Wood",
6 => "Iron",
7 => "Copper",
8 => "Bronze",
9 => "Pottery",
10 => "Tin",
11 => "Steel",
12 => "Silk",
13 => "Lace",
14 => "Ivory",
15 => "Crystal",
20 => "China",
25 => "Silver",
30 => "Pearl",
35 => "Jade",
40 => "Ruby",
45 => "Sapphire",
50 => "Golden",
55 => "Emerald",
60 => "Diamond",
);
sub get_node_value
{
my $node = shift;
my $tag_name = shift;
$node = $node->getElementsByTagName($tag_name, 0)->item(0);
return unless $node;
$node = $node->getFirstChild;
return unless $node;
return $node->getNodeValue;
}
sub set_node_value
{
my ($node, $tag_name, $new_value) = @_;
my $subnode = $node->getElementsByTagName($tag_name, 0)->item(0);
if (!defined($subnode))
{
$subnode = $node->getOwnerDocument()->createElement($tag_name);
$node->appendChild($subnode);
$subnode->addText($new_value);
}
else
{
my $textnode = $subnode->getFirstChild();
if (!defined($textnode))
{
$subnode->addText($new_value);
}
else
{
$textnode->setNodeValue($new_value);
}
}
return 1;
}
# Returns the proper English qualifier for this number
sub get_th
{
my $number = shift;
return unless defined($number);
if ($number >= 11 && $number <= 13) {
return "th";
} elsif ($number % 10 == 1) {
return "st";
} elsif ($number % 10 == 2) {
return "nd";
} elsif ($number % 10 == 3) {
return "rd";
} else {
return "th";
}
}
# Returns the traditional name for this occurence of the anniversary
# if applicable (e.g. Silver, Golden, Diamond)
# (see http://www.the-inspirations-store.com/acatalog/anniversary.html)
sub get_special_name
{
my $occurence = shift;
return unless exists $names{$occurence};
return "($names{$occurence}) ";
}
# Return some general-purpose debugging info
sub debug_info
{
my $obj = shift;
my $depth_level = shift;
my $ret = "\nEmail-reminder: ".$EmailReminder::Utils::VERSION;
$ret .= "\nPerl: $] ($^O)";
local $ENV{PATH};
$ENV{PATH} = ''; # remove potentially tainted path
$ENV{ENV} = ''; # necessary on SUSE
my $distro = `/usr/bin/lsb_release -s -d`; chomp $distro;
my $kernel = `/bin/uname -a`; chomp $kernel;
$ret .= "\nOS: $distro";
$ret .= "\nKernel: $kernel";
use Data::Dumper;
local $Data::Dumper::Maxdepth;
$Data::Dumper::Maxdepth = $depth_level;
$ret .= "\nObject:";
$ret .= Dumper($obj);
}
1;
|