--- loncom/LondTransaction.pm 2003/05/13 01:01:49 1.3 +++ loncom/LondTransaction.pm 2005/06/16 22:33:45 1.8 @@ -1,7 +1,7 @@ # This module defines and implements a class that represents # a connection to a lond daemon. # -# $Id: LondTransaction.pm,v 1.3 2003/05/13 01:01:49 foxr Exp $ +# $Id: LondTransaction.pm,v 1.8 2005/06/16 22:33:45 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -35,6 +35,8 @@ =cut +use strict; + package LondTransaction; =pod @@ -91,15 +93,18 @@ Creates a new transaction object. =cut + + sub new { - my $class = shift; - my $Transaction = shift; + + my ($class, $Transaction) = @_; my $self = {request => $Transaction, active => 0, deferred => 0}; bless($self, $class); + return $self; } =pod @@ -121,8 +126,10 @@ will be carried. =cut sub Activate { - my $self = shift; - my $Connection = shift; # Reference to a lond connection. + + + my ($self, $Connection) = @_; + $self->{londSocket} = $Connection; # Store the connection object and $self->{active} = 1; # Indicate it's active. @@ -173,11 +180,12 @@ Name of the file that holds the deferred =cut sub SetDeferred { - my $self = shift; - my $File = shift; + + + my ($self, $File) = @_; $self->{deferred} = 1; - $self->{DeferrredFile} = $File; + $self->{DeferredFile} = $File; } =pod @@ -199,8 +207,8 @@ Parameters: =cut sub SetClient { - my $self = shift; - my $Client = shift; + + my ($self, $Client) = @_; $self->{deferred} = 0; $self->{clientSocket} = $Client; @@ -208,33 +216,6 @@ sub SetClient { =pod -=item WroteSome - - Called to indicate that some bytes were writtne to lond. - The request is trimmed by the number of bytes written. - If no bytes are left, nonzero is returned, else 0. - -Parameters: - -=over 3 - -=item Count - -Number of bytes written - -=back - -=cut -sub WroteSome { - my $self = shift; - my $Count = shift; - - substr($self->{request}, length($self->{request}), $Count); - - return (length($self->{request]) == 0); - -=pod - =head2 Selectors @@ -319,9 +300,28 @@ sub getServer { Returns the remaining request text. =cut + sub getRequest { my $self = shift; return $self->{request}; } +=pod + +=item getLoggableRequest + + Use this top get what the request is when you don't want to spew + sensitive data into logs + +=cut + +sub getLoggableRequest { + my $self = shift; + my ($cmd,$subcmd)=split(':',$self->{request}); + if ($cmd eq 'encrypt') { + return "$cmd:$subcmd"; + } + return $cmd; +} +1;