Mojo::Cloudflare - Talk with the Cloudflare API using Mojo::UserAgent
0.03
Mojo::Cloudflare is an (async) client for the CloudFlare API.
use Mojo::Cloudflare; my $cf = Mojo::Cloudflare->new( email => 'sample@example.com', key => '8afbe6dea02407989af4dd4c97bb6e25', zone => 'example.com', ); # add a record $cf->record({ content => 'mojolicio.us', name => 'direct.example.pm', type => 'CNAME', })->save; # retrieve and update records for my $record ($cf->records->all) { warn $record->name; $record->ttl(1)->save; # update a record } # update a record $cf->record({ content => 'mojolicio.us', id => 'some_id_fom_cloudflare', # <-- cause update instead of insert name => 'direct.example.pm', type => 'CNAME', })->save;
Holds the endpoint where we communicate. Default is https://www.cloudflare.com/api_json.html.
$str = $self->email; $self = $self->email($str);
The e-mail address associated with the API key.
$str = $self->key; $self = $self->key($str);
This is the API key made available on your Account page.
$str = $self->zone; $self = $self->zone($str);
The zone (domain) to act on.
Will be deprecated. Use "save" in Mojo::Cloudflare::Record instead.
Will be deprecated. Use "delete" in Mojo::Cloudflare::Record instead.
$record_obj = $self->record(\%record_construction_args);
Returns a Mojo::Cloudflare::Record object.
$records_obj = $self->records($offset); $self = $self->records($offset, sub { my($self, $err, $records_obj) = @_; });
Used to retrieve Mojo::Cloudflare::Record objects. The return value will be a Mojo::Cloudflare::RecordSet object.
$offset is optional and defaults to "all", which will retrieve all the DNS records instead of the limit of 180 set by CloudFlare.
$offset
Copyright (C) 2014, Jan Henning Thorsen
This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.
Jan Henning Thorsen - jhthorsen@cpan.org
jhthorsen@cpan.org
To install Mojo::Cloudflare, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo::Cloudflare
CPAN shell
perl -MCPAN -e shell install Mojo::Cloudflare
For more information on module installation, please visit the detailed CPAN module installation guide.