Package: libfrontier-rpc-perl Version: 0.07b4-4 Severity: wishlist Tags: patch
This patches for Clients.pm and RPC2.pm and the rewrite of Daemon.pm add some new features, but should be 100% compatible to older versions. The new Frontier::* stuff is able to push any arbitrary perl object over the wire by using Data::Serializer to put it into an ASCII stream and including this in the XML data. The new Frontier::Daemon additionally has the ability to filter client connections based on a list of given IPs which are able to make connections to the server. The daemon now is able to log requests including query path and method (if desired) to syslog. I already pushed these patches upstream, but it seems there is no active maintainer anymore. As I consider these changes useful for other, I would like this changes to be included in the Frontier distribution in Debian. I recommend to add the dependency to libdata-serializer-perl as Recommends. Ciao Max -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'stable') Architecture: i386 (i686) Kernel: Linux 2.6.25.4 Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages libfrontier-rpc-perl depends on: ii libwww-perl 5.812-1 WWW client/server library for Perl ii libxml-parser-perl 2.36-1.1+b1 Perl module for parsing XML files ii perl 5.10.0-10 Larry Wall's Practical Extraction libfrontier-rpc-perl recommends no packages. -- no debconf information
diff --git a/Client.pm b/Client.pm index 800acab..9ee5755 100644 --- a/Client.pm +++ b/Client.pm @@ -1,8 +1,12 @@ # # Copyright (C) 1998 Ken MacLeod +# Copyright (C) 2007-2008 Maximilian Wilhelm <[EMAIL PROTECTED]> +# # Frontier::Client is free software; you can redistribute it # and/or modify it under the same terms as Perl itself. # +# Handling of arbitrary perl objects added by Maximilian Wilhelm. +# # $Id: Client.pm,v 1.8 2001/10/03 01:30:54 kmacleod Exp $ # @@ -47,6 +51,10 @@ sub new { push @options, 'use_objects' => $self->{'use_objects'}; } + if (defined $self->{'handle_perl_objects'} && $self->{'handle_perl_objects'}) { + push @options, 'handle_perl_objects' => $self->{'handle_perl_objects'}; + } + $self->{'enc'} = Frontier::RPC2->new(@options); return $self;
diff --git a/RPC2.pm b/RPC2.pm index a42ec4d..fdf3257 100644 --- a/RPC2.pm +++ b/RPC2.pm @@ -1,8 +1,11 @@ # # Copyright (C) 1998, 1999 Ken MacLeod +# Copyright (C) 2007-2008 Maximilian Wilhelm <[EMAIL PROTECTED]> # Frontier::RPC is free software; you can redistribute it # and/or modify it under the same terms as Perl itself. # +# Handling of arbitrary perl objects added by Maximilian Wilhelm. +# # $Id: RPC2.pm,v 1.18 2002/08/02 18:35:21 ivan420 Exp $ # @@ -45,6 +48,16 @@ sub new { $self->{'encoding_'} = ""; } + # + # This version of Frontier::RPC2 can push arbitrary perl objects across the wire... + # + # If you set 'handle_perl_objects' are parameter this feature is actived. + if ($self->{handle_perl_objects}) { + require Data::Serializer; + $self->{serializer} = Data::Serializer->new(); + $scalars{'perl_object'} = 1; + } + return $self; } @@ -183,7 +196,16 @@ sub _item { push @text, $self->_hash($item); } elsif ($ref =~ /=ARRAY\(/) { push @text, $self->_array($item); - } else { + } + + # If handle_perl_objects parameter was set, encode every object of any class in XML + elsif ($self->{handle_perl_objects} && + $item =~ /=HASH\(/ && + $ref =~ /[[:alnum:]]+/) { + push @text, "<value><perl_object>", $self->{serializer}->serialize ($item), "</perl_object></value>\n"; + } + + else { die "can't convert \`$item' to XML\n"; } @@ -439,6 +461,13 @@ sub end { $value = Frontier::RPC2::String->new($value); } } + + # Deserialize arbitrary perl objects. + elsif ($tag eq 'perl_object') { + my $ser = Data::Serializer->new (); + $value = $ser->deserialize ($value); + } + $expat->{'rpc_value'} = $value; } elsif ($state eq 'member_name') { $expat->{'rpc_member_name'}[-1] = $expat->{'rpc_text'};
Daemon.pm
Description: Perl program