├── config.yml
├── SourceyStart.sh
├── public
├── onandoff_626x626.jpg
└── manifest.webmanifest
├── manifest.yml
├── README.md
├── app.pl
├── SourceyBuild.sh
└── views
└── index.tt
/config.yml:
--------------------------------------------------------------------------------
1 | charset: "UTF-8"
2 |
--------------------------------------------------------------------------------
/SourceyStart.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | DANCER_PORT=$PORT ./app.pl
3 |
--------------------------------------------------------------------------------
/public/onandoff_626x626.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imyaman/cf-sample-app-perl-dancer2/HEAD/public/onandoff_626x626.jpg
--------------------------------------------------------------------------------
/manifest.yml:
--------------------------------------------------------------------------------
1 | ---
2 | applications:
3 | - name: perl-dancer2-imyaman
4 | buildpack: https://github.com/imyaman/sourcey-buildpack
5 | instances: 1
6 | memory: 256M
7 | random-route: true
8 |
--------------------------------------------------------------------------------
/public/manifest.webmanifest:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Web On and Off",
3 | "short_name": "On and Off",
4 | "start_url": "index.html",
5 | "display": "standalone",
6 | "background_color": "#fff",
7 | "description": "A simply readable Hacker News app.",
8 | "icons": [{
9 | "src": "onandoff_626x626.jpg",
10 | "sizes": "626x626",
11 | "type": "image/jpg"
12 | }]
13 | }
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | * Use your cf API URL.
2 | * Change the app name in manifest.yml.
3 | * The app name will be used for URL. Ex) http://perl-dancer2-imyaman.youre.space
4 |
5 |
6 | ```
7 |
8 | $ cf login -a https://api.cf.youre.space # Use your cf API URL
9 |
10 | $ git clone https://github.com/imyaman/cf-sample-app-perl-dancer2
11 |
12 | $ cd cf-sample-app-perl-dancer2
13 |
14 | $ vi manifest.yml # Change the app name
15 |
16 | $ cf push
17 | ```
18 |
--------------------------------------------------------------------------------
/app.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env perl
2 |
3 | use Dancer2;
4 |
5 | get '/' => sub {
6 | my $err;
7 | template 'index.tt', {
8 | 'err' => $err,
9 | };
10 | };
11 |
12 | get '/hello/:name' => sub {
13 | return "Why, hello there " . params->{name};
14 | };
15 |
16 | get '/envs' => sub {
17 | my $self = shift;
18 | my ($key, $envstring);
19 | for $key (keys %ENV){
20 | $envstring .= "$key : $ENV{$key}
\n";
21 | }
22 | return $envstring;
23 | };
24 |
25 | start;
26 |
--------------------------------------------------------------------------------
/SourceyBuild.sh:
--------------------------------------------------------------------------------
1 | # if you want to see what happens in more detail
2 | #SOURCEY_VERBOSE=1
3 |
4 | # if you want to force sourcey to rebuild everything
5 | #SOURCEY_REBUILD=1
6 |
7 | # create a copy of perl
8 | buildPerl 5.26.0
9 |
10 | # and this one is entirely unrelated, and just here
11 | # to show how to build a library. we do not actually need
12 | # it for the example code in app-simple.pl to work
13 | #buildAuto https://ftp.postgresql.org/pub/source/v9.5.1/postgresql-9.5.1.tar.bz2
14 |
15 | # build the Dacner2 perl module
16 | # this calles cpanm internally ...
17 | buildPerlModule http://search.cpan.org/CPAN/authors/id/G/GO/GONZUS/HTTP-XSCookies-0.000016.tar.gz Dancer2
18 |
--------------------------------------------------------------------------------
/views/index.tt:
--------------------------------------------------------------------------------
1 |
2 |
3 |