[SCM] Packaging of Net::Citadel in Debian branch, master, updated. debian/0.16-1-45-gd21e85b

Robert James Clay jame at rocasa.us
Wed Jun 5 17:20:42 UTC 2013


The following commit has been merged in the master branch:
commit 801624e1698cd1bd0257a283340edb76155d806f
Author: Robert James Clay <jame at rocasa.us>
Date:   Sun Oct 21 19:03:37 2012 -0400

    Add initial version of citadel_mrtg function to Citadel.pm

diff --git a/lib/Net/Citadel.pm b/lib/Net/Citadel.pm
index 4ab26a9..53e7b4a 100644
--- a/lib/Net/Citadel.pm
+++ b/lib/Net/Citadel.pm
@@ -756,6 +756,39 @@ sub citadel_info {
     return \@info;
 }
 
+=item I<citadel_mrtg>
+
+%mrtg_hash = I<$c>->citadel_mrtg($type)
+
+Sends the C<MRTG> command to the Citadel server. It expects a type of either
+C<users> or C<messages> to be passed to it and returns a hash containing the
+information from the server.
+
+=cut
+
+sub citadel_mrtg {
+    my $self = shift;
+    my $type = shift;
+    my $s    = $self->{socket};
+    my ( %mrtg, @mrtg_lines, $line );
+
+    print $s "MRTG $type\n";
+
+    if ((<$s>) !~ /1../) { croak "Incorrect response from Citadel MRTG command." };
+
+    # Get the listing of the MRTG information from the server.
+    while ($line = <$s>) {
+        if ( $line !~ /^000/ ) {
+            push @mrtg_lines, $line;
+        }
+        else { last; }
+    }
+
+    # Create the %mrtg hash from the information in the @mrtg_lines array
+
+    return %mrtg;
+}
+
 =pod
 
 =item I<citadel_time>

-- 
Packaging of Net::Citadel in Debian



More information about the Pkg-perl-cvs-commits mailing list