This file is indexed.

/usr/share/perl5/Octopussy/Plugin/Unit.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
# $HeadURL$
# $Revision: 341 $
# $Date: 2010-04-16 17:22:13 +0100 (Fri, 16 Apr 2010) $
# $Author: sebthebert $

=head1 NAME

Octopussy::Plugin::Unit - Octopussy Plugin Unit

=cut

package Octopussy::Plugin::Unit;

use strict;
use warnings;
use Readonly;

use AAT::Translation;
use Octopussy;

Readonly my $KBYTES  => 1024;
Readonly my $MBYTES  => 1024 * $KBYTES;
Readonly my $GBYTES  => 1024 * $MBYTES;
Readonly my $TBYTES  => 1024 * $GBYTES;
Readonly my $MINUTES => 60;
Readonly my $HOURS   => 60 * $MINUTES;

my ($str_bytes, $str_minutes, $str_hours) = (undef, undef, undef);

=head1 FUNCTIONS

=head2 Init(\%conf)

=cut

sub Init
{
  my $conf = shift;

  $str_bytes   = lc AAT::Translation::Get($conf->{lang} || 'EN', '_BYTES');
  $str_minutes = lc AAT::Translation::Get($conf->{lang} || 'EN', '_MINUTES');
  $str_hours   = lc AAT::Translation::Get($conf->{lang} || 'EN', '_HOURS');

  return (1);
}

=head2 KiloBytes($bytes)

Converts Bytes to KiloBytes

=cut

sub KiloBytes
{
  my $bytes = shift;

  return (sprintf '%.1f %s', $bytes / $KBYTES, "K${str_bytes}");
}

=head2 MegaBytes($bytes)

Converts Bytes to MegaBytes

=cut

sub MegaBytes
{
  my $bytes = shift;

  return (sprintf '%.1f %s', $bytes / $MBYTES, "M${str_bytes}");
}

=head2 GigaBytes($bytes)

Converts Bytes to GigaBytes

=cut

sub GigaBytes
{
  my $bytes = shift;

  return (sprintf '%.1f %s', $bytes / $GBYTES, "G${str_bytes}");
}

=head2 TeraBytes($bytes)

Converts Bytes to TeraBytes

=cut

sub TeraBytes
{
  my $bytes = shift;

  return (sprintf '%.1f %s', $bytes / $TBYTES, "T${str_bytes}");
}

=head2 Minutes($seconds)

Converts Seconds to Minutes

=cut

sub Minutes
{
  my $seconds = shift;

  return (sprintf '%.1f %s', $seconds / $MINUTES, ${str_minutes});
}

=head2 Hours($seconds)

Converts Seconds to Hours

=cut

sub Hours
{
  my $seconds = shift;

  return (sprintf '%.1f %s', $seconds / $HOURS, ${str_hours});
}

1;

=head1 AUTHOR

Sebastien Thebert <octo.devel@gmail.com>

=cut