This file is indexed.

/usr/share/perl5/AAT/Utils.pm is in octopussy 1.0.6-0ubuntu1.

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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# $HeadURL: https://syslog-analyzer.svn.sourceforge.net/svnroot/syslog-analyzer/tags/Octopussy-1.0.6/usr/share/perl5/AAT/Utils.pm $
# $Revision: 356 $
# $Date: 2010-05-27 18:51:53 +0100 (Thu, 27 May 2010) $
# $Author: sebthebert $

=head1 NAME

AAT::Utils - AAT Utils module

=cut

package AAT::Utils;

use strict;
use warnings;
use Readonly;

use Exporter 'import';

our @EXPORT_OK = qw( ARRAY HASH HASH_KEYS NOT_NULL NULL );

Readonly my $START_YEAR   => 1900;

=head1 FUNCTIONS

=head2 ARRAY($value)

Converts $value to an array ( @{$value) )

=cut

sub ARRAY
{
  my $value = shift;

  return (
    (
      NOT_NULL($value)
      ? ((ref $value eq 'ARRAY') ? @{$value} : ("$value"))
      : ()
    )
  );
}

=head2 ARRAY_REF($value)

Converts $value to an array reference ( \@{$value} )

=cut

sub ARRAY_REF
{
  my $value = shift;

  return (
    (
      NOT_NULL($value)
      ? ((ref $value eq 'ARRAY') ? \@{$value} : ["$value"])
      : []
    )
  );
}

=head2 HASH($value)

Converts $value to an hash ( %{$value} )

=cut

sub HASH
{
  my $value = shift;

  return ((NOT_NULL($value)) ? %{$value} : ());
}

=head2 HASH_KEYS($value)

Returns keys for the converted hash $value ( keys %{$value} )

=cut

sub HASH_KEYS
{
  my $value = shift;

  return ((NOT_NULL($value)) ? keys %{$value} : ());
}

=head2 NOT_NULL($value)

Checks that value '$value' is not null (undef or '')

=cut

sub NOT_NULL
{
  my $value = shift;

  if (ref $value eq 'ARRAY')
  {
    return (
      scalar(@{$value}) > 1
      ? 1
      : (((scalar(@{$value}) == 1) && (NOT_NULL(${$value}[0]))) ? 1 : 0)
    );
  }

  return (((defined $value) && ($value ne '')) ? 1 : 0);
}

=head2 NULL($value)

Checks that value '$value' is null (undef or '')

=cut

sub NULL
{
  my $value = shift;

  if (ref $value eq 'ARRAY')
  {
    return (
      scalar(@{$value}) > 1
      ? 0
      : (((scalar(@{$value}) == 1) && (NOT_NULL(${$value}[0]))) ? 0 : 1)
    );
  }

  return (((defined $value) && ($value ne '')) ? 0 : 1);
}


=head2 Now()

Returns current date (now!) in an Array (YYYY, MM, DD, HH, MM, SS)

=cut

sub Now
{
	my ($sec, $min, $hour, $mday, $mon, $year) = localtime time;
	
  $year += $START_YEAR;
  $mon++;
  $mon  = ($mon < 10  ? '0' . $mon  : $mon);
  $mday = ($mday < 10 ? '0' . $mday : $mday);
  $hour = ($hour < 10 ? '0' . $hour : $hour);
  $min  = ($min < 10  ? '0' . $min  : $min);
  $sec  = ($sec < 10  ? '0' . $sec  : $sec);

  return ($year, $mon, $mday, $hour, $min, $sec);
}


=head2 Now_String()

Get te actual time in "YYYY/MM/DD HH:MM" format

Returns:
 $now_string - string "YYYY/MM/DD HH:MM" formated

=cut

sub Now_String
{
  my ($year, $month, $mday, $hour, $min) = Now();

  return ("$year/$month/$mday $hour:$min");
}


1;

=head1 AUTHOR

Sebastien Thebert <octo.devel@gmail.com>

=cut