view release on metacpan or search on metacpan
{
"abstract" : "lightweight web application framework",
"author" : [
"Tokuhiro Matsuno <tokuhirom@gmail.com>"
],
"dynamic_config" : 0,
"generated_by" : "Minilla/v3.1.29",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
---
abstract: 'lightweight web application framework'
author:
- 'Tokuhiro Matsuno <tokuhirom@gmail.com>'
build_requires:
Test::More: '0.98'
Test::Requires: '0.06'
configure_requires:
Module::Build::Tiny: '0.035'
dynamic_config: 0
generated_by: 'Minilla/v3.1.29, CPAN::Meta::Converter version 2.150010'
license: perl
[](https://travis-ci.org/tokuhirom/Amon)
# NAME
Amon2 - lightweight web application framework
# SYNOPSIS
package MyApp;
use parent qw/Amon2/;
use Amon2::Config::Simple;
sub load_config { Amon2::Config::Simple->load(shift) }
# DESCRIPTION
Amon2 is simple, readable, extensible, **STABLE**, **FAST** web application framework based on [Plack](https://metacpan.org/pod/Plack).
# METHODS
## CLASS METHODS for `Amon2` class
- my $c = MyApp->context();
Get the context object.
- MyApp->set\_context($c)
README.mkdn view on Meta::CPAN
Amon2 - Yet another web application framework
============================================
- Supports PSGI/Plack.
- Thin layer.
- Lightweight.
Full document available on http://amon.64p.org/
eg/Hello/htdocs/static/css/main.css view on Meta::CPAN
/* reset.css */
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {margin:0...
body {line-height:1.5;}
table {border-collapse:separate;border-spacing:0;}
caption, th, td {text-align:left;font-weight:normal;}
table, td, th {vertical-align:middle;}
blockquote:before, blockquote:after, q:before, q:after {content:"";}
blockquote, q {quotes:"" "";}
a img {border:none;}
/* main */
html,body {height:100%;}
lib/Amon2.pm view on Meta::CPAN
die $@ if $@;
}
1;
__END__
=encoding utf-8
=head1 NAME
Amon2 - lightweight web application framework
=head1 SYNOPSIS
package MyApp;
use parent qw/Amon2/;
use Amon2::Config::Simple;
sub load_config { Amon2::Config::Simple->load(shift) }
=head1 DESCRIPTION
Amon2 is simple, readable, extensible, B<STABLE>, B<FAST> web application framework based on L<Plack>.
=head1 METHODS
=head2 CLASS METHODS for C<< Amon2 >> class
=over 4
=item my $c = MyApp->context();
Get the context object.
lib/Amon2/Plugin/Web/WebSocket.pm view on Meta::CPAN
code => sub {
my $respond = shift;
eval {
my $h = AnyEvent::Handle->new( fh => $fh );
$ws->{send_message} = sub {
my $message = shift;
$message = Protocol::WebSocket::Frame->new($message)
->to_bytes;
$h->push_write($message);
};
my $frame = Protocol::WebSocket::Frame->new();
$h->push_write( $hs->to_string );
$ws->send_message($_) for @messages;
$h->on_read(
sub {
$frame->append( $_[0]->rbuf );
while ( my $message = $frame->next ) {
$ws->call_receive_message( $c, $message );
}
}
);
$h->on_error(
sub {
$ws->call_error($c);
}
);
$h->on_eof(
lib/Amon2/Setup/Asset/Blueprint.pm view on Meta::CPAN
* Copyright (c) 2007-Present. See LICENSE for more info.
* See README for instructions on how to use Blueprint.
* For credits and origins, see AUTHORS.
* This is a compressed file. See the sources in the \'src\' directory.
----------------------------------------------------------------------- */
/* reset.css */
html {margin:0;padding:0;border:0;}
body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside...
article, aside, details, figcaption, figure, dialog, footer, header, hgroup, menu, nav, section {display:block;}
body {line-height:1.5;background:white;}
table {border-collapse:separate;border-spacing:0;}
caption, th, td {text-align:left;font-weight:normal;float:none !important;}
table, th, td {vertical-align:middle;}
blockquote:before, blockquote:after, q:before, q:after {content:\'\';}
blockquote, q {quotes:"" "";}
a img {border:none;}
:focus {outline:0;}
share/flavor/Basic/lib/__PATH__/Web.pm view on Meta::CPAN
}
# for your security
__PACKAGE__->add_trigger(
AFTER_DISPATCH => sub {
my ( $c, $res ) = @_;
# http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx
$res->header( 'X-Content-Type-Options' => 'nosniff' );
# http://blog.mozilla.com/security/2010/09/08/x-frame-options/
$res->header( 'X-Frame-Options' => 'DENY' );
# Cache control.
$res->header( 'Cache-Control' => 'private' );
},
);
1;
share/flavor/Basic/tmpl/index.tx view on Meta::CPAN
</p>
</div>
</section>
<hr />
<section>
<h1 style="text-align: center;">Amon2 is right for you if ...</h1>
<ul>
<li>You need exceptional performance.</li>
<li>You want a framework with a small footprint.</li>
<li>You want a framework that requires nearly zero configuration.</li>
</ul>
</section>
<hr />
<section>
<h1>Documents?</h1>
<p>Complete docs are available on <a href="http://amon.64p.org/">amon.64p.org</a></p>
<p>And there are module specific docs on <a href="https://metacpan.org/release/Amon2">CPAN</a></p>
</section>
share/flavor/Large/lib/__PATH__/__MONIKER__.pm view on Meta::CPAN
}
# for your security
__PACKAGE__->add_trigger(
AFTER_DISPATCH => sub {
my ( $c, $res ) = @_;
# http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx
$res->header( 'X-Content-Type-Options' => 'nosniff' );
# http://blog.mozilla.com/security/2010/09/08/x-frame-options/
$res->header( 'X-Frame-Options' => 'DENY' );
# Cache control.
$res->header( 'Cache-Control' => 'private' );
},
);
1;
share/flavor/Large/t/07_mech_links.t view on Meta::CPAN
use utf8;
use t::Util;
use Plack::Test;
use Plack::Util;
use Test::More;
use Test::Requires 'Test::WWW::Mechanize::PSGI', 'HTML::TokeParser';
my %link_tags = (
a => 'href',
area => 'href',
frame => 'src',
iframe => 'src',
link => 'href',
script => 'src',
);
sub _extract_links {
my $mech = shift;
my @links;
my $parser = HTML::TokeParser->new( \( $mech->content ) );
while ( my $token = $parser->get_tag( keys %link_tags ) ) {
t/600_plugins/013_websocket.t view on Meta::CPAN
on_connect => sub {
my $hs = Protocol::WebSocket::Handshake::Client->new(url => "ws://$host:$port");
$handle->push_write($hs->to_string);
},
);
$handle->on_read( sub {
my $h = shift;
like $h->rbuf, qr/Upgrade/;
my $frame = Protocol::WebSocket::Frame->new('client-send');
$h->push_write($frame->to_bytes);
delete $h->{rbuf};
$h->on_read( sub {
my $frame = Protocol::WebSocket::Frame->new($_[0]->rbuf);
is $frame->next,'server-send';
$cv->send;
undef $handle;
},
);
},
);
$cv->recv;
};