AWS-Lambda-Quick

 view release on metacpan or  search on metacpan

INSTALL  view on Meta::CPAN

    % make install

On Windows platforms, you should use `dmake` or `nmake`, instead of `make`.

If your perl is system-managed, you can create a local::lib in your home
directory to install modules to. For details, see the local::lib documentation:
https://metacpan.org/pod/local::lib

The prerequisites of this distribution will also have to be installed manually. The
prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json` generated
by running the manual build process described above.

## Configure Prerequisites

This distribution requires other modules to be installed before this
distribution's installer can be run.  They can be found under the
"configure_requires" key of META.yml or the
"{prereqs}{configure}{requires}" key of META.json.

## Other Prerequisites

MANIFEST  view on Meta::CPAN

dist.ini
lib/AWS/Lambda/Quick.pm
lib/AWS/Lambda/Quick/CreateZip.pm
lib/AWS/Lambda/Quick/Processor.pm
lib/AWS/Lambda/Quick/Upload.pm
perlcriticrc
perltidyrc
t/00-report-prereqs.dd
t/00-report-prereqs.t
t/02zip.t
t/03process.t
t/lib/TestHelper/CreateTestFiles.pm
tidyall.ini
xt/author/00-compile.t
xt/author/eol.t
xt/author/mojibake.t
xt/author/no-tabs.t
xt/author/pod-spell.t
xt/author/pod-syntax.t
xt/author/portability.t
xt/author/test-version.t

lib/AWS/Lambda/Quick.pm  view on Meta::CPAN

our $VERSION = '1.0002';

use AWS::Lambda::Quick::Processor ();

sub import {
    shift;

    # where's the source code of the script calling us?
    my ( undef, $file, undef ) = caller;

    # process the whole thing
    my $proc = AWS::Lambda::Quick::Processor->new(
        src_filename => $file,
        @_,
    );
    my $url = $proc->process;
    print "$url\n" or die "problem with fh: $!";

    # and exit before we run the remainder of the script
    # (since that's meant to be run on AWS Lambda, and we're just
    # uploading at this time!)
    exit;
}

1;

lib/AWS/Lambda/Quick/Processor.pm  view on Meta::CPAN

sub selfkv {
    my $self = shift;
    my @computed_args;
    for my $key (@_) {
        my $val = $self->$key;
        push @computed_args, $key => $val if defined $val;
    }
    return @computed_args;
}

sub process {
    my $self = shift;

    AWS::Lambda::Quick::CreateZip->new(
        $self->selfkv(
            qw(
                extra_files
                src_filename
                zip_filename
                )
        ),

t/03process.t  view on Meta::CPAN

use Path::Tiny qw(path);
use lib path( $FindBin::Bin, 'lib' )->stringify;

use Test2::V0;

use HTTP::Tiny ();

use AWS::Lambda::Quick::Processor ();
use TestHelper::CreateTestFiles qw(populated_tempdir);

ok( 1, 'processor compiled' );

if ( $ENV{DO_AWS_TESTS} ) {
    my $tempdir      = populated_tempdir();
    my $zip_filename = path( $tempdir, 'handler.zip' );

    # upload;

    my $url = AWS::Lambda::Quick::Processor->new(
        src_filename => path( $tempdir, 'src', 'handler.pl' ),
        name         => 'aws-uploader-quick-test-suite-function',
        extra_files  => ['lib'],
    )->process;

    ## try to use

    my $response = HTTP::Tiny->new->get( $url . '?who=Everyone' );
    is( $response->{content}, 'Hello, Everyone', 'api works' );
}

done_testing;

xt/author/eol.t  view on Meta::CPAN

use Test::EOL;

my @files = (
    'lib/AWS/Lambda/Quick.pm',
    'lib/AWS/Lambda/Quick/CreateZip.pm',
    'lib/AWS/Lambda/Quick/Processor.pm',
    'lib/AWS/Lambda/Quick/Upload.pm',
    't/00-report-prereqs.dd',
    't/00-report-prereqs.t',
    't/02zip.t',
    't/03process.t',
    't/lib/TestHelper/CreateTestFiles.pm'
);

eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files;
done_testing;

xt/author/no-tabs.t  view on Meta::CPAN

use Test::NoTabs;

my @files = (
    'lib/AWS/Lambda/Quick.pm',
    'lib/AWS/Lambda/Quick/CreateZip.pm',
    'lib/AWS/Lambda/Quick/Processor.pm',
    'lib/AWS/Lambda/Quick/Upload.pm',
    't/00-report-prereqs.dd',
    't/00-report-prereqs.t',
    't/02zip.t',
    't/03process.t',
    't/lib/TestHelper/CreateTestFiles.pm'
);

notabs_ok($_) foreach @files;
done_testing;



( run in 0.312 second using v1.01-cache-2.11-cpan-8d75d55dd25 )