Home News Forum Articles
  Welcome back Join CF
You are here You are here: Home | Forum | Any Perl Experts?


You are currently viewing our boards as a guest which gives you limited access to view most of the discussions, articles and other free features. By joining our Virgin Media community you will have full access to all discussions, be able to view and post threads, communicate privately with other members (PM), respond to polls, upload your own images/photos, and access many other special features. Registration is fast, simple and absolutely free so please join our community today.


Welcome to Cable Forum
Go Back   Cable Forum > Computers & IT > General IT Discussion

Any Perl Experts?
Reply
 
Thread Tools
Old 16-08-2007, 07:54   #1
Mr_love_monkey
Anyone can play guitar
 
Mr_love_monkey's Avatar
 
Join Date: Jun 2003
Location: London way
Age: 37
Services: Women for money
Posts: 8,023
Mr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny stars
Mr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny stars
Send a message via Yahoo to Mr_love_monkey
Question Any Perl Experts?

Hi,

I'm looking for a sample of perl code that will show usage of an xml-rpc client, making a call, but (and this is the bit I've got problems with) allowing custom cookies to be passed into the request.

I've done it in Java, and I've done it in Python - but my perl knowledge is limited....

Thanks
__________________
Cheap Domain Name Registration
And this is not my face, and this is not my life
And there is not a single thing here I can recognize
And this is all a dream, and none of you are real
Mr_love_monkey is offline   Reply With Quote
Advertisement
Old 16-08-2007, 10:15   #2
The Jackal
Inactive
 
Join Date: Oct 2006
Posts: 1,604
The Jackal has a bronzed appealThe Jackal has a bronzed appeal
The Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appeal
Re: Any Perl Experts?

xml-rpc : You wanna use SOAP ?

ok maybe this

http://www.blackperl.com/RPC::XML/

install the module...

perldoc RPC::XML

and away you go
The Jackal is offline   Reply With Quote
Old 16-08-2007, 10:42   #3
Mr_love_monkey
Anyone can play guitar
 
Mr_love_monkey's Avatar
 
Join Date: Jun 2003
Location: London way
Age: 37
Services: Women for money
Posts: 8,023
Mr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny stars
Mr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny stars
Send a message via Yahoo to Mr_love_monkey
Re: Any Perl Experts?

Quote:
Originally Posted by CrC-3rr0r View Post
xml-rpc : You wanna use SOAP ?
No, I want to use XML-RPC - which is different to soap

Quote:
Originally Posted by CrC-3rr0r View Post
ok maybe this

http://www.blackperl.com/RPC::XML/

install the module...

perldoc RPC::XML

and away you go
Yep, I can do that - but what I am looking for is an example of a client call, passing in a custom cookie - since by default xmlrpc doesn't really have a standard way of dealing with extra cookies in the request, so each implementation of it has it's own brand of hack to do it - as I say I've got it working java and python, but no idea for perl,,,,
__________________
Cheap Domain Name Registration
And this is not my face, and this is not my life
And there is not a single thing here I can recognize
And this is all a dream, and none of you are real
Mr_love_monkey is offline   Reply With Quote
Old 16-08-2007, 10:52   #4
The Jackal
Inactive
 
Join Date: Oct 2006
Posts: 1,604
The Jackal has a bronzed appealThe Jackal has a bronzed appeal
The Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appeal
Re: Any Perl Experts?

Quote:
Originally Posted by Mr_love_monkey View Post
Yep, I can do that - but what I am looking for is an example of a client call, passing in a custom cookie - since by default xmlrpc doesn't really have a standard way of dealing with extra cookies in the request


perl -MCPAN -e shell

cpan> install RPC::XML
..
.
some blurb...
.
.
Writing /usr/lib64/perl5/site_perl/5.8.0/auto/RPC/XML/.packlist
Appending installation info to /usr/lib64/perl5/5.8.0/x86_64-linux-thread-multi/perllocal.pod
/usr/bin/make install -- OK

cpan> quit

perldoc RPC::XML

Look at the authenticate method
http://search.cpan.org/src/JALDHAR/W...ce/Advogato.pm

I dunno man, why do you want to use perl and this old has been RPC::XML ?
The Jackal is offline   Reply With Quote
Old 16-08-2007, 11:05   #5
Mr_love_monkey
Anyone can play guitar
 
Mr_love_monkey's Avatar
 
Join Date: Jun 2003
Location: London way
Age: 37
Services: Women for money
Posts: 8,023
Mr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny stars
Mr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny stars
Send a message via Yahoo to Mr_love_monkey
Re: Any Perl Experts?

Quote:
Originally Posted by CrC-3rr0r View Post
Thanks I'll take a look

Quote:
Originally Posted by CrC-3rr0r View Post
I dunno man, why do you want to use perl and this old has been RPC::XML ?
well, Perl wouldn't be my choice, but it has a wide user base in the bank here, and as I've provided an xml-rpc interface into the system I'm writing for them, I need to provide some examples of how to access it in as many languages as possible.

As for why xml-rpc, it's lightweight, doesn't have the irritations that soap has, and lets me do somethings I wouldn't be able to do with soap (due to our authentication model).
__________________
Cheap Domain Name Registration
And this is not my face, and this is not my life
And there is not a single thing here I can recognize
And this is all a dream, and none of you are real
Mr_love_monkey is offline   Reply With Quote
Old 16-08-2007, 11:34   #6
The Jackal
Inactive
 
Join Date: Oct 2006
Posts: 1,604
The Jackal has a bronzed appealThe Jackal has a bronzed appeal
The Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appeal
Re: Any Perl Experts?

Hmmmmm well I've stopped using perl prefer to do this kind of stuff over j2ee nowadays.
The Jackal is offline   Reply With Quote
Old 16-08-2007, 11:43   #7
Mr_love_monkey
Anyone can play guitar
 
Mr_love_monkey's Avatar
 
Join Date: Jun 2003
Location: London way
Age: 37
Services: Women for money
Posts: 8,023
Mr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny stars
Mr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny stars
Send a message via Yahoo to Mr_love_monkey
Re: Any Perl Experts?

Quote:
Originally Posted by CrC-3rr0r View Post
Hmmmmm well I've stopped using perl prefer to do this kind of stuff over j2ee nowadays.
yeah, the serverside is all done in java, as I say, the first client was java, since the aim was to the provide a wrapper API, and then plug it into eclipse(spit!) - but as I say, perl is big here, still big in a lot of places - had IBM here the other day trying to sell us some software which is was perl based.
__________________
Cheap Domain Name Registration
And this is not my face, and this is not my life
And there is not a single thing here I can recognize
And this is all a dream, and none of you are real
Mr_love_monkey is offline   Reply With Quote
Old 16-08-2007, 11:50   #8
The Jackal
Inactive
 
Join Date: Oct 2006
Posts: 1,604
The Jackal has a bronzed appealThe Jackal has a bronzed appeal
The Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appeal
Re: Any Perl Experts?

Heh I'm sure we had the eclipse discussion be4 :p

I like me eclipse.

Yeh lot of banks still have that sybase/perl transact layer. Good luck with it
The Jackal is offline   Reply With Quote
Old 16-08-2007, 12:19   #9
Mr_love_monkey
Anyone can play guitar
 
Mr_love_monkey's Avatar
 
Join Date: Jun 2003
Location: London way
Age: 37
Services: Women for money
Posts: 8,023
Mr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny stars
Mr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny stars
Send a message via Yahoo to Mr_love_monkey
Re: Any Perl Experts?

Quote:
Originally Posted by CrC-3rr0r View Post
Heh I'm sure we had the eclipse discussion be4 :p

I like me eclipse.
I'd like it a lot more if it didn't keep crashing on me... and plug ins are all well and good, in theory, but all it seems to do is give Joe Bloggs on the street ample oppportunity to crash my IDE with unfailing regularity...

ok, I think you're going to have to explain to me what's going on here, if you don't mind :
Code:
sub _authenticate()
{
  my ($self) = @_;

  my $result = $self->{'client'}->send_request('authenticate', 
    RPC_STRING($self->{'user'}), RPC_STRING($self->{'pass'}));
  croak $result unless ref $result;
  croak $result->code . ': ' . $result->string 
    if ref $result eq 'RPC::XML::fault';
  $self->{'cookie'} = $result->value;
}
__________________
Cheap Domain Name Registration
And this is not my face, and this is not my life
And there is not a single thing here I can recognize
And this is all a dream, and none of you are real
Mr_love_monkey is offline   Reply With Quote
Old 16-08-2007, 13:11   #10
The Jackal
Inactive
 
Join Date: Oct 2006
Posts: 1,604
The Jackal has a bronzed appealThe Jackal has a bronzed appeal
The Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appeal
Re: Any Perl Experts?

Soz was away for lunch...

take a looksie @ perldoc RPC::XML::Client

use the following example to get up n running.


NAME
RPC::XML::Client - An XML-RPC client class

SYNOPSIS
require RPC::XML;
require RPC::XML::Client;

$cli = RPC::XML::Client->new('http://www.localhost.net/RPCSERV');
$resp = $cli->send_request('system.listMethods');

print ref $resp ? join(', ', @{$resp->value}) : "Error: $resp";

DESCRIPTION
This is an XML-RPC client built upon the RPC::XML data classes, and

---------- Post added at 14:11 ---------- Previous post was at 14:08 ----------

#!/usr/bin/perl

require RPC::XML;
require RPC::XML::Client;

$cli = RPC::XML::Client->new('http://www.localhost.net/RPCSERV');
$cli->send_request('authenticate',RPC_STRING('user'),RP C_STRING('pass'));
$resp = $cli->send_request('system.listMethods');

print ref $resp ? join(', ', @{$resp->value}) : "Error: $resp";

EDIT : I made up the authenticate line try it with and without the RPC_STRING wrapper
The Jackal is offline   Reply With Quote
Old 17-08-2007, 14:56   #11
Mr_love_monkey
Anyone can play guitar
 
Mr_love_monkey's Avatar
 
Join Date: Jun 2003
Location: London way
Age: 37
Services: Women for money
Posts: 8,023
Mr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny stars
Mr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny stars
Send a message via Yahoo to Mr_love_monkey
Re: Any Perl Experts?

Quote:
Originally Posted by CrC-3rr0r View Post
<snip/>
$cli = RPC::XML::Client->new('http://www.localhost.net/RPCSERV');
$cli->send_request('authenticate',RPC_STRING('user'),RP C_STRING('pass'));
$resp = $cli->send_request('system.listMethods');
ok, got it roughly working now - your one above was showing how to pass parameters into the rpc call, which wasn't what I was looking to do just then, i needed to add in a custom cookie into the httprequest - like thus:

Code:
#!/usr/bin/perl

require RPC::XML;
require RPC::XML::Client;
require HTTP::Request;

$cli = RPC::XML::Client->new('http://myserver.com:1234/xmlrpc');
$req = $cli->request;
$req->push_header(Cookie=>'rpcUser=MlM');
$resp = $cli->simple_request('rpcServer.discoverInterface');

print ref $resp ? join(', ', @{$resp->value}) : "Error: $resp";

Thanks for your help
__________________
Cheap Domain Name Registration
And this is not my face, and this is not my life
And there is not a single thing here I can recognize
And this is all a dream, and none of you are real
Mr_love_monkey is offline   Reply With Quote
Old 20-08-2007, 09:36   #12
The Jackal
Inactive
 
Join Date: Oct 2006
Posts: 1,604
The Jackal has a bronzed appealThe Jackal has a bronzed appeal
The Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appealThe Jackal has a bronzed appeal
Re: Any Perl Experts?

Quote:
Originally Posted by Mr_love_monkey View Post
Thanks for your help
Nice, I was just guessing on the auth method as I have not used the module before
The Jackal is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Google Search




All times are GMT. The time now is 01:29.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Copyright © 2003 - 2012, Cable Forum.
(server9.cableforum.co.uk)

SEO by vBSEO 3.3.2