AWS-Lambda

 view release on metacpan or  search on metacpan

author/build-paws-layer-al2023.sh  view on Meta::CPAN


PERL_VERSION=$1
TAG=$2
PLATFORM=$3

OPT="$ROOT/.perl-layer/$PERL_VERSION-paws.al2023"
DIST="$ROOT/.perl-layer/dist"
set -uex

# sanity check of required tools
command -v parallel # GNU parallel

# clean up
rm -rf "$OPT-$PLATFORM"
mkdir -p "$OPT-$PLATFORM/lib/perl5/site_perl"
rm -f "$DIST/perl-$TAG-paws-al2023-$PLATFORM.zip"

DOCKER_PLATFORM=linux/unknown
case $PLATFORM in
    "x86_64") DOCKER_PLATFORM=linux/amd64;;
    "arm64") DOCKER_PLATFORM=linux/arm64;;

author/publish-perl-runtime-archives.pl  view on Meta::CPAN

        if ($force) {
            $object = decode_json(`$cmd`);
            die "exit: $!" if $! != 0;
        }
    } else {
        say STDERR "s3://shogo82148-lambda-perl-runtime-us-east-1/$key is already updated";
    }
    return $object;
}

sub run_command {
    my @cmd = @_;
    say STDERR "Executing: @cmd";
    if ($force) {
        my $code = system(@cmd);
        die "exit: $code" if $! != 0;
    }
}

sub publish {
    my ($suffix, $arch, $arch_suffix) = @_;

author/publish-perl-runtime-archives.pl  view on Meta::CPAN

    for my $zip(glob "$FindBin::Bin/../.perl-layer/dist/perl-*-$suffix-$arch.zip") {
        chomp(my $sha256 = `openssl dgst -sha256 -r "$zip" | cut -d" " -f1`);
        my $name = basename($zip, '.zip');
        next unless $name =~ /^perl-([0-9]+)-([0-9]+)-/;
        my $perl_version = "$1.$2";

        head_or_put("$name/$sha256.zip", $zip);
        my $metadata = encode_json({
            url => "https://shogo82148-lambda-perl-runtime-us-east-1.s3.amazonaws.com/$name/$sha256.zip",
        });
        run_command("echo '$metadata' | aws --region 'us-east-1' s3 cp --content-type application/json - s3://shogo82148-lambda-perl-runtime-us-east-1/$name.json");
    }
}

if ($force) {
    say STDERR "FORCE TO DEPLOY";
} else {
    say STDERR "DRY RUN";
}

publish("runtime-al2023", "x86_64");

author/publish-perl-runtimes.pl  view on Meta::CPAN

        if ($force) {
            $object = decode_json(`$cmd`);
            die "exit: $!" if $! != 0;
        }
    } else {
        say STDERR "$zip in s3://shogo82148-lambda-perl-runtime-$region/$key is already updated";
    }
    return $object;
}

sub run_command {
    my @cmd = @_;
    say STDERR "Executing: @cmd";
    if ($force) {
        my $code = system(@cmd);
        die "exit: $code" if $! != 0;
    }
}

sub publish {
    my ($suffix, $arch, $arch_suffix) = @_;

author/publish-perl-runtimes.pl  view on Meta::CPAN

        my $perl_version = "$1.$2";
        my $stack = $perl_version =~ s/[.]/-/r;
        for my $region(@$regions) {
            $pm->start("$region/$perl_version") and next;
            say STDERR "$region/$perl_version: START";
            my $object = head_or_put($region, "perl-$stack-$suffix$arch_suffix.zip", $zip, $md5);
            my $version = $object->{VersionId} // 'UNKNOWN';
            my $stack_name = "lambda-$stack-$suffix$arch_suffix" =~ s/_/-/r;

            say STDERR "deploying stack $stack_name in $region...";
            run_command('aws', '--region', $region, 'cloudformation', 'deploy',
                '--stack-name', $stack_name,
                '--template-file', "$FindBin::Bin/cfn-layer-$suffix-$arch.yml",
                '--parameter-overrides', "PerlVersion=$perl_version", "Name=perl-$stack-$suffix$arch_suffix", "ObjectVersion=$version");
            say STDERR "$region/$perl_version: DONE";
            $pm->finish(0);
        }
    }

    $pm->wait_all_children;
}

examples/cgi/README.md  view on Meta::CPAN

# An example of CGI Application

It is an example of [Common Gateway Interface](https://en.wikipedia.org/wiki/Common_Gateway_Interface) application.
Demo program comes from [WwwCounter](https://www.tohoho-web.com/soft/wwwcounter/readme.html) authored by [杜甫々](https://www.tohoho-web.com/wwwwho.html)(tohoho).

The example is built as [AWS Serverless Application Model](https://aws.amazon.com/serverless/sam/)(SAM).
Install SAM CLI and run the following commands.

```console
make build
sam deploy --guide
```

examples/cgi/WwwCounter/style3.css  view on Meta::CPAN

 *   .cm : comment
 *   .success : success
 *   .info : information
 *   .warning : warning
 *   .caution : caution
 *   .index-title: index-title
 * Code
 *   .tab : tab
 *   .c : code box
 *   .c2 : code box with tab
 *   .dos : dos command
 * Table
 *   .tb0 : table
 *   .tb1 : table
 *   .vl : table vertical line (with .tb1)
 * Reset
 *   .reset : reset
 */

/* Font */
body {



( run in 2.246 seconds using v1.01-cache-2.11-cpan-d8267643d1d )