Perl Library for Amazon SQS

Sample Code & Libraries>Perl Library for Amazon SQS
Community Contributed Software

  • Amazon Web Services provides links to these packages as a convenience for our customers, but software not authored by an "@AWS" account has not been reviewed or screened by AWS.
  • Please review this software to ensure it meets your needs before using it.

Perl Library for Amazon SQS

Details

Submitted By: Elena@AWS
AWS Products Used: Amazon SQS
Language(s): Perl
License: Apache License 2.0
Created On: March 1, 2008 12:04 AM GMT
Last Updated: April 9, 2009 4:24 AM GMT
Download

About this Library

  • Based on the 2009-02-01 API version.

What's New?

  • 2009-04-08: Support for access control API
  • 2008-12-26: Url and utf8 encoding fix for signature version 2
  • 2008-12-17: Support for snature version 2, https endpoint
  • 2008-02-29: Initial Release

Prerequisites

  • Amazon SQS Account (http://aws.amazon.com/queue).
  • Perl 5.6.0 or newer (http://www.perl.org/)
  • Depending on the version of PERL you are using, you may need to install additional packages. To install additional packages, run following command:
    • perl -MCPAN -e 'install Digest::SHA'
    • perl -MCPAN -e 'install XML::Simple'
    • perl -MCPAN -e 'install Bundle::LWP'
    • perl -MCPAN -e 'install Crypt::SSLeay'

Package Content

Directory Overview
src Source distribution of library.

Quick Start

Library comes with code samples for each available service API. To get started with the library, follow these steps:
  1. Extract the amazon-queue-2009-02-01-perl-library.zip file into a working directory.
  2. Edit desired sample. For example: src/Amazon/SQS/Samples/CreateQueueSample.pl


    • Set AWS Access Key ID and AWS Secret Access Key
    •  my $AWS_ACCESS_KEY_ID        = "<Your Access Key ID>";
       my $AWS_SECRET_ACCESS_KEY    = "<Your Secret Access Key>";
                      


    • Set request parameters. For example, find following pre-generated snippet:
    •  use Amazon::SQS::Model::CreateQueueRequest;
       # @TODO: set action. Action can be passed as Amazon::SQS::Model::CreateQueueRequest
       # object or hash of parameters
       # invokeCreateQueue($service, $action);
                      


    • And set action with QueueName parameter:
    •  use Amazon::SQS::Model::CreateQueueRequest;
       my $action = Amazon::SQS::Model::CreateQueueRequest->new;
       invokeCreateQueue($service, $action->withQueueName("MyQueue"));
                      

  3. Run CreateQueue sample:
  4.    perl src/Amazon/SQS/Samples/CreateQueueSample.pl
                
  5. You should see the output similar to the following:


  6.     CreateQueueResponse
            CreateQueueResult
                QueueUrl
                    https://queue.amazonaws.com/1234/MyQueue
            ResponseMetadata
                RequestId
                    95cdcb68-f46c-400b-8265-8c2de2a5c475
                

  7. Experiment with samples. When ready, install library in the perl include path and use it.

Notes

You can use alternative hash-based interface with the library. For example, instead of:

    my $action = Amazon::SQS::Model::CreateQueue->new;
    $action->setQueueName("MyQueue");
    my $response = $service->createQueue($action);
        
You can write:
    my $response = $service->createQueue({QueueName => "MyQueue"});
        

Happy coding!

Comments, Questions or Feedback

If you have any comments, questions or feedback on the library, please visit the Amazon SQS discussion forums.

Comments

Correction to the mentioned sample on this page
The sample should read CreateQueueRequest instead of CreateQueue, hence the correct version is: use Amazon::SQS::Model::CreateQueueRequest; my $action = Amazon::SQS::Model::CreateQueue->new; invokeCreateQueue($service, $action->withQueueName("twitter-users-to-process"));
aws9 on April 9, 2009 4:24 AM GMT
We are temporarily not accepting new comments.
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.