Rolf Harold Nelson > SyslogScan > SyslogScan::Usage

Download:
SyslogScan-0.32.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Module Version: 0.2   Source  

NAME ^

SyslogScan::Usage -- encapsulates the total volumes of mail broadcast, sent, and received through sendmail by a single user or group.

SyslogScan::Volume -- encapsulates a number of messages along with a total number of bytes

SYNOPSIS ^

# $summary is a SyslogScan::Summary object

use SyslogScan::Usage; my $usage = $$summary{'john_doe@foo.com'}; $usage -> dump();

use SyslogScan::Volume; my $broadcastVolume = $usage -> getBroadcastVolume(); my $sendVolume = $usage -> getSendVolume(); my $receiveVolume = $usage -> getReceiveVolume();

print "John Doe sent $$sendVolume[0] messages with $$sendVolume[1] bytes\n";

DESCRIPTION ^

Broadcast, Send, and Receive

Volume of messages received has the obvious meaning. Volume of messages sent and volume of messages broadcast require more explanation.

If I send out a message which has three recipients, then for the purposes of the SyslogScan modules, I am broadcasting the message once, but I am sending it three times.

Usage methods

new() method

Creates a new, empty Usage object.

addUsage() method and deepCopy() method
   # $usage1 is 4 messages of 100 bytes Received
   # $usage2 is 1 message of 35 bytes Received

   my $usageTotal = $usage1 -> deepCopy();
   # $usageTotal is 4 messages of 100 bytes Received

   $usageTotal -> addUsage($usage2);
   # $usageTotal is 5 messages of 135 bytes Received

Note that because we used deepCopy, $usage1 is still 4 messages of 100 bytes.

registerBroadcast, registerSend, registerReceive methods
    my $usage = new SyslogScan::Usage();
    $usage -> registerSend(512);
    $usage -> registerSend(34);
    $usage -> registerBroadcast(34);
    # $usage is now 2 messages, 546 bytes Sent,
    # and 1 message, 34 bytes Broadcast
getBroadcastVolume, getSendVolume, getReceiveVolume methods

Returns deep copy of the applicable SyslogScan::Volume objects.

static deepCopy method

Returns deep copy of the whole SyslogScan::Usage object.

static dump

Returns a string containing (Message,Bytes) pairs for Broadcast, Send, and Receive volumes.

Volume methods

new() method

Creates a new Volume object of 0 messages, 0 bytes.

deepCopy() method

Creates a new Volume object with the same number of messages and bytes as the current Volume object.

addVolume(), addSize() methods

addVolume() adds the volume of a second Volume object onto the volume of the current Volume object.

addSize() adds on one message of the given size.

    use SyslogScan::Volume;

    my $volume1 = new SyslogScan::Volume();
    $volume1 -> addSize(512);

    my $volume2 = $volume1 -> deepCopy();
    # $volume2 is 1 message, 512 bytes

    $volume2 -> addSize(31);
    # $volume2 is 2 messages, 543 bytes

    $volume2 -> addVolume($volume1);
    # $volume2 is 3 messages, 1055 bytes

    $volume2 -> addVolume($volume2);
    # $volume2 is 6 messages, 2110 bytes
getMessageCount, getByteCount

Gets the number of messages and the total number of bytes, respectively.

dump()

Returns the string "getMessageCount(),getByteCount()"

Volume internals

A Volume is simply a two-element array of ($messages, $bytes).

$$volume[0] is the number of messages $$volume[1] is the number of bytes

AUTHOR and COPYRIGHT ^

The author (Rolf Harold Nelson) can currently be e-mailed as rolf@usa.healthnet.org.

This code is Copyright (C) SatelLife, Inc. 1996. All rights reserved. This code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

In no event shall SatelLife be liable to any party for direct, indirect, special, incidental, or consequential damages arising out of the use of this software and its documentation (including, but not limited to, lost profits) even if the authors have been advised of the possibility of such damage.

SEE ALSO ^

SyslogScan::Summary

syntax highlighting: