Software Freedom Law Center

root/trunk/antimatter/tim/Modules/SFLC/TimeTracker/Output/Dummy.pm

Revision 53, 2.3 kB (checked in by bkuhn, 10 months ago)
  • Added SFLC's internally developed tim bot released under AGPLv3
Line 
1 # Copyright (C) 2005, 2006   Software Freedom Law Center, Inc.
2 #  Author: Bradley M. Kuhn <bkuhn@softwarefreedom.org>
3 #
4 #  This software gives you freedom; it is licensed to you under version
5 #  3 of the GNU Affero General Public License.
6 #
7 #  This software is distributed WITHOUT ANY WARRANTY, without even the
8 #  implied warranties of MERCHANTABILITY and FITNESS FOR A PARTICULAR
9 #  PURPOSE.  See the GNU Affero General Public License for further
10 #  details.
11 #
12 # You should have received a copy of the GNU Affero General Public
13 # License, version 3 along with this software.  If not, see
14 # <http://www.gnu.org/licenses/>.
15 package SFLC::TimeTracker::Output::Dummy;
16
17 use strict;
18 use warnings;
19
20 use base qw(SFLC::TimeTracker::Output);
21
22 ###############################################################################
23 sub new {
24   my($class) = shift;
25
26   my(%input) = @_;
27   if (defined $input{string}) {
28     $input{object} = \$input{string};
29   }
30   my $self = SFLC::TimeTracker::Output::new($class, %input);
31
32   $self->{forcedActionData} = (defined $input{actionData})
33                                ?  $input{actionData}
34                                : { edge => 'proceed'};
35   return $self;
36 }
37 ###############################################################################
38 sub get {
39   my($self, $field) = @_;
40   if ($field =~ /^(?:string)$/) {
41     # double dollar on purpose: the stored object is a ref to a string
42     return ${$self->SUPER::get('object')};
43   } else {
44     return $self->SUPER::get($field);
45   }
46 }
47 ###############################################################################
48 sub prettyPrintIRC ($$) {
49   my($self, $now) = @_;
50
51   return $self->get('string');
52 }
53 ###############################################################################
54 sub action {
55   my($self, $newActionData) = @_;
56   # Dummy nodes should pass through any action data they receive to their
57   # children, provided they were not required to override it
58
59   foreach my $key (keys %{$newActionData}) {
60     $self->{forcedActionData}{$key} = $newActionData->{$key}
61       if not defined $self->{forcedActionData}{$key};
62   }
63   return $self->{forcedActionData};
64 }
65 ###############################################################################
66 1;
67 __END__
68
69 #
70 # Local variables:
71 # compile-command: "perl -I ../../../../Modules -c Dummy.pm"
72 # End:
Note: See TracBrowser for help on using the browser.

SFLC Main Page

[frdm] Support SFLC