[freeside-commits] freeside/fs_selfservice/FS-SelfService Makefile.PL, 1.5, 1.6 MANIFEST, 1.2, 1.3 freeside-selfservice-xmlrpc-server, NONE, 1.1
Jeff Finucane,420,,
jeff at wavetail.420.am
Mon Aug 6 01:46:08 PDT 2007
Update of /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService
In directory wavetail:/tmp/cvs-serv12502
Modified Files:
Makefile.PL MANIFEST
Added Files:
freeside-selfservice-xmlrpc-server
Log Message:
add selfservice xmlrpc facilities (#591)
--- NEW FILE: freeside-selfservice-xmlrpc-server ---
#!/usr/bin/perl -w
#
# freeside-selfservice-xmlrpc-server
#
use strict;
use Fcntl qw(:flock);
use POSIX;
use Getopt::Std;
use XMLRPC::Transport::HTTP;
use XMLRPC::Lite; # for XMLRPC::Serializer;
use FS::SelfService::XMLRPC;
use vars qw( $opt_p $opt_d );
use vars qw( $DEBUG );
getopts("p:d");
$DEBUG = $opt_d;
my $tag = $opt_p ? ':'.$opt_p : '';
my %typelookup = (
base64 => [10, sub {$_[0] =~ /[^\x09\x0a\x0d\x20-\x7f]/}, 'as_base64'],
dateTime => [35, sub {$_[0] =~ /^\d{8}T\d\d:\d\d:\d\d$/}, 'as_dateTime'],
string => [40, sub {1}, 'as_string'],
);
my $serializer = new XMLRPC::Serializer(typelookup => \%typelookup);
my $log_file = "/usr/local/freeside/selfservice.xmlrpc$tag.log";
my $pid = fork;
defined($pid) or die "Can't fork to start: $!";
print "Started daemon with pid $pid\n" if $pid;
exit if $pid;
POSIX::setsid();
open STDIN, "/dev/null" or die "Can't get rid of STDIN";
open STDOUT, ">/dev/null" or die "Can't get rid of STDOUT";
open STDERR, ">&STDOUT" or die "Can't get rid of STDERR";
$SIG{__WARN__} = \&_logmsg;
$SIG{__DIE__} = sub { &_logmsg(@_); exit };
my $daemon = XMLRPC::Transport::HTTP::Daemon
->new(LocalPort => $opt_p ? $opt_p : 8080)
->dispatch_to('FS::SelfService::XMLRPC')
->serializer($serializer);
warn "Handling request at ", $daemon->url, "\n";
$daemon->handle;
sub _logmsg {
chomp( my $msg = shift );
my $log = new IO::File ">>$log_file";
flock($log, LOCK_EX);
seek($log, 0, 2);
print $log "[". scalar(localtime). "] [$$] $msg\n";
flock($log, LOCK_UN);
close $log;
}
Index: Makefile.PL
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/Makefile.PL,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Makefile.PL 9 Aug 2006 03:45:00 -0000 1.5
+++ Makefile.PL 6 Aug 2007 08:46:05 -0000 1.6
@@ -5,7 +5,7 @@
'NAME' => 'FS::SelfService',
'VERSION_FROM' => 'SelfService.pm', # finds $VERSION
'EXE_FILES' => [ 'freeside-selfservice-clientd',
- #'freeside-selfservice-xmlrpc-server',
+ 'freeside-selfservice-xmlrpc-server',
],
'INSTALLSCRIPT' => '/usr/local/sbin',
'INSTALLSITEBIN' => '/usr/local/sbin',
Index: MANIFEST
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/MANIFEST,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- MANIFEST 11 Jul 2002 13:52:39 -0000 1.2
+++ MANIFEST 6 Aug 2007 08:46:05 -0000 1.3
@@ -2,5 +2,6 @@
Makefile.PL
MANIFEST
SelfService.pm
+SelfService/XMLRPC.pm
test.pl
freeside-selfservice-clientd
More information about the freeside-commits
mailing list