To access CloudAMQP from Perl you can use Net::RabbitMQ. Download and unzip the Net::RabbitMQ files. Locate the Makefile.PL file and install Net::RabbitMQ by running following commands in the terminal:

perl Makefile.PL
make
make test
make install

Code example Publish and Subscribe

The following code snippet show how to connect, publish and consume a message via CloudAMQP.

use Net::RabbitMQ;
my $mq = Net::RabbitMQ->new;

$mq->connect("localhost", { user => "guest", password => "guest", vhost => "/" })
  or die "Can't connect to RabbitMQ\n";

$channel = 1;
$exchange = 'my_exchange';
$queuename = 'my_queue';
$routing_key = '';

$mq->channel_open($channel);

$mq->exchange_declare($channel, $exchange);
$mq->queue_declare($channel, $queuename, { 
    passive => 0, 
    durable => 1, 
    exclusive => 0, 
    auto_delete => 0 
  });

$mq->queue_bind($channel, $queuename, $exchange, $routing_key);
$mq->publish($channel, $routing_key, 'Hello CloudAMQP!', { exchange => $exchange });
$mq->consume($channel, $queuename);

my $rv = {};
$rv = $mq->recv();
print "$rv->{body}\n";

Futher documentation can be found here: Net::RabbitMQ documentation or by entering following command in the terminal perldoc Net::RabbitMQ

Alternative clients

RabbitFoot
an asynchronous and multi-channel AMQP client using Coro and AnyEvent::RabbitMQ
Net::AMQP
Net::AMQP - Advanced Message Queue Protocol (de)serialization and representation