PetaMem has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks,
I'm writing a class for accessing/modifying trac contents via XML::RPC.
It's working ok when I create or update tickets, wiki etc. I also can get/download attachments. No problem. The problem appears as soon as I try to add attachments to a ticket. It seems base64-encoding the data is not enough. The call to the specific remote procedure gives a "object has no 'data' attribute error":
Unfortunately I do not quite understand the XML::RPC documentation and its talk about the CODEREF to create custom data types (which base64 and time seem to be). Has anyone an example of how to achieve feeding trac with binary data? Any help would be greatly appreciated.use XML::RPC; use MIME::Base64; my $xmlrpc = XML::RPC->new('https://user:pass@some.server.com/trac/pro +ject/xmlrpc'); my $result = $xmlrpc->call('ticket.putAttachment', 2, 'Filename', 'Some Description', encode_base64('data, data - it is always th +e data') ); Dumpering $result gives: $VAR1 = { 'faultString' => '\'\'str\' object has no attribute \'data\' +\' while executing \'ticket.putAttachment()\'', 'faultCode' => '2' };
Bye
PetaMem All Perl: MT, NLP, NLU
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Accessing Trac via XML::RPC
by Corion (Patriarch) on Jun 24, 2008 at 15:12 UTC | |
by PetaMem (Priest) on Jun 24, 2008 at 15:29 UTC | |
Re: Accessing Trac via XML::RPC
by pc88mxer (Vicar) on Jun 24, 2008 at 15:27 UTC |
Back to
Seekers of Perl Wisdom