WWW::Mailchimp - Perl wrapper around the Mailchimp v1.3 API
use strict; use WWW::Mailchimp my $mailchimp = WWW::Mailchimp->new(apikey => $apikey); # defaults ( datacenter => 'us1', timeout => 5, output_format => 'json', api_version => 1.3 ) my $campaigns = $mailchimp->campaigns; my $lists = $mailchimp->lists; my $subscribers = $mailchimp->listMembers( $lists->{data}->[0]->{id} ); my $ok = $mailchimp->listSubscribe( id => $lists->{data}->[0]->{id}, email_address => 'foo@bar.com', update_existing => 1, merge_vars => [ FNAME => 'foo', LNAME => 'bar' ] );
WWW::Mailchimp is a simple Perl wrapper around the Mailchimp API v1.3.
It is as simple as creating a new WWW::Mailchimp object and calling ->method Each key/value pair becomes part of a query string, for example:
$mailchimp->listSubscribe( id => 1, email_address => 'foo@bar.com' );
results in the query string
?method=listSubscribe&id=1&email_address=foo@bar.com # apikey, output, etc are tacked on by default. This is also uri_escaped
Currently, this module is hardcoded to JSON::from_json the result of the LWP request. This should be changed to be dependent on the output_format. Patches welcome.
I am also rather sure handling of merge_vars can be done better. If it isn't working properly, you can always use a key of 'merge_vars[FNAME]', for example.
Mail::Chimp::API - Perl wrapper around the Mailchimp v1.2 API using XMLRPC
Justin Hunter <justin.d.hunter@gmail.com>
Fayland Lam
This software is copyright (c) 2011 by Justin Hunter
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install WWW::Mailchimp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Mailchimp
CPAN shell
perl -MCPAN -e shell install WWW::Mailchimp
For more information on module installation, please visit the detailed CPAN module installation guide.