Skip to content

Instantly share code, notes, and snippets.

@tron1point0
Created May 11, 2012 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tron1point0/2660763 to your computer and use it in GitHub Desktop.
Save tron1point0/2660763 to your computer and use it in GitHub Desktop.
package Magento;
use v5.14;
use warnings;
use Carp;
use XML::RPC;
sub new {
my ($class,$uri,$user,$pass) = @_;
my $client = XML::RPC->new("$uri/api/xmlrpc/");
my $session = $client->call(login => $user, $pass);
bless { client => $client, session => $session }, $class;
}
sub AUTOLOAD {
my ($this,@args) = @_;
my $fn = our $AUTOLOAD;
$fn =~ s/.*://;
$fn =~ s/_([^_]+)$/.$1/;
$this->{client}->call(call => $this->{session},$fn,\@args);
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment