A perl distribution builder for ServerCentral perl projects.
To build a module named SCN-Module-Foo ...
cd SCN-Module-Foo
distify SCN-Module-Foo| https://github.com/mcsnolte/Mojo-Pg-DBIC/commit/4f9d48cf52e6aecd782f1e2e20e1e1ae07a795a3#r17468260 | |
| https://gist.github.com/ribasushi/032fbb8b58e2b0d62fae#file-gistfile1-txt-L474-L490 | |
| I'm leaving these here because I keep thinking that they ARE here and they aren't ... until now. |
| sub _html_to_pdf { | |
| my $cb = ref $_[-1] eq 'CODE' ? pop : undef; | |
| my ($c, $html, $opts) = @_; | |
| $opts||={}; | |
| require PDF::WebKit; | |
| PDF::WebKit->configure(sub { | |
| # default `which wkhtmltopdf` | |
| my $exe= $c->executable( 'wkhtmltopdf' ); | |
| $_->wkhtmltopdf($exe); | |
| }); |
| use Mojolicious::Lite -signatures; | |
| use CommonMark; | |
| # server markdown from markdown/ within app's home | |
| my $root = app->home->child('markdown'); | |
| get '/*file' => sub ($c) { | |
| #TODO handle traversal attacks | |
| my $path = $root->child($c->stash('file')); |
| #!/bin/bash | |
| PID=$(pgrep -f 'ssh -D') | |
| CMD=$1 | |
| if [[ $CMD == '--stop' ]] | |
| then | |
| if [[ ! "$PID" ]] | |
| then | |
| echo 'socks proxy is not running'; |
| use Mojo::Base -strict, -signatures; | |
| use Mojolicious; | |
| use Mojo::IOLoop; | |
| use Mojo::Server::Daemon; | |
| use Mojo::UserAgent; | |
| # mock external websocket application | |
| # waits 5s after connection then sends time and closes | |
| my $external = Mojolicious->new; |
| diff --git a/lib/Mojo/Promise.pm b/lib/Mojo/Promise.pm | |
| index 0c66018db..db09a0033 100644 | |
| --- a/lib/Mojo/Promise.pm | |
| +++ b/lib/Mojo/Promise.pm | |
| @@ -185,6 +185,7 @@ sub _defer { | |
| my $cbs = $self->{status} eq 'resolve' ? $self->{resolve} : $self->{reject}; | |
| @{$self}{qw(cycle resolve reject)} = (undef, [], []); | |
| + $self->{handled} = 1 if $self->{status} eq 'reject' && @{ $cbs || [] }; | |
| $self->ioloop->next_tick(sub { $_->(@$result) for @$cbs }); |
| $ git diff | |
| diff --git a/t/mojo/promise_async_await.t b/t/mojo/promise_async_await.t | |
| index 049253e47..084ad8de3 100644 | |
| --- a/t/mojo/promise_async_await.t | |
| +++ b/t/mojo/promise_async_await.t | |
| @@ -79,6 +79,13 @@ async sub test_two { | |
| return $text; | |
| } | |
| +async sub returns_promise { |
| #!/usr/bin/env perl | |
| use Mojolicious::Lite -signatures; | |
| #app->defaults({text => 'Hello World'}); | |
| #get '/'; | |
| #get '/' => { text => 'Hello World' }; | |
| get '/' => sub ($c) { |
| my ($time, $ticket_ids) = await Mojo::Promise->all( | |
| $redis->get_p("department:$id:tickets:refresh"), | |
| $redis->smembers_p("department:$id:tickets"), | |
| ); | |
| return [] unless @{ $ticket_ids->[0] }; | |
| my @tickets = await Mojo::Promise->all(map { $self->get($_) } @{ $ticket_ids->[0] }); | |
| return ( | |
| [map { $_->[0] } @tickets], | |
| $time->[0], |