Group
Extension

Matches 13

ASP4 ( J/JO/JOHND/ASP4-1.087.tar.gz, JOHND, 2012; MetaCPAN )
ASP4/lib/ASP4.pm ( view source; MetaCPAN )
n and save 
it to the database.

=head2 $Config

The ASP4 C<$Config> object is stored in a simple JSON format on disk, and accessible
everywhere within your entire ASP4 application as the global C<$Co
ample project to get things going.

In the C<data_connections.main> section of C<conf/asp4-config.json> you should have
something like this:

  ...
    "main": {
      "dsn":              "DBI:mysql:d
ASP4 ( J/JO/JOHND/ASP4-1.087.tar.gz, JOHND, 2012; MetaCPAN )
ASP4/lib/ASP4/ErrorHandler/Remote.pm ( view source; MetaCPAN )
 __PACKAGE__->VARS;
use LWP::UserAgent;
use HTTP::Request::Common;
use HTTP::Date 'time2iso';
use JSON::XS;
use Data::Dumper;
require ASP4;

our $ua;

sub run
{
  my ($s, $context) = @_;
  
  my $erro
ndler::Remote - Send your errors someplace else via http.

=head1 SYNOPSIS

In your C<asp4-config.json>:

  ...
    "errors": {
      "error_handler":    "ASP4::ErrorHandler::Remote",
      "post_erro
ASP4 ( J/JO/JOHND/ASP4-1.087.tar.gz, JOHND, 2012; MetaCPAN )
ASP4/lib/ASP4/Error.pm ( view source; MetaCPAN )

package ASP4::Error;

use strict;
use warnings 'all';
use ASP4::HTTPContext;
use JSON::XS;


sub new
{
  my $class = shift;
  my ($err_str, %args);
  if( @_ )
  {
    if( @_ == 1 )
    {
      $err_s
{stacktrace},
    code          => $code,
    form_data     => encode_json($Form) || "{}",
    session_data  => eval { encode_json(\%session_data) } || "{}",
    http_referer  => $ENV{HTTP_REFERER},
 
acktrace

A string - defaults to the value of C<$@>.

=head2 form_data

JSON-encoded C<$Form> object.

=head2 session_data

JSON-encoded C<$Session> object.

=head2 http_referer

Default value is C<$E
ASP4 ( J/JO/JOHND/ASP4-1.087.tar.gz, JOHND, 2012; MetaCPAN )
ASP4/lib/ASP4/ErrorHandler.pm ( view source; MetaCPAN )
d1 NAME

ASP4::ErrorHandler - Default fatal error handler

=head1 SYNOPSIS

In your C<asp4-config.json>:

  ...
    "errors": {
      "error_handler":    "ASP4::ErrorHandler",
      "mail_errors_to": 
ASP4 ( J/JO/JOHND/ASP4-1.087.tar.gz, JOHND, 2012; MetaCPAN )
ASP4/lib/ASP4/API.pm ( view source; MetaCPAN )
ixtures.json' )
  {
    eval { require Data::Properties::JSON };
    $test_data = Data::Properties::JSON->new(
      properties_file => $config->web->application_root . '/etc/test_fixtures.json'
    )
ASP4 ( J/JO/JOHND/ASP4-1.087.tar.gz, JOHND, 2012; MetaCPAN )
ASP4/lib/ASP4/ConfigLoader.pm ( view source; MetaCPAN )
rict;
use warnings 'all';
use Carp 'confess';
use ASP4::ConfigFinder;
use ASP4::ConfigParser;
use JSON::XS;

our $Configs = { };


#====================================================================
$ifh, '<', $path
    or die "Cannot open '$path' for reading: $!";
  local $/;
  my $doc = decode_json( scalar(<$ifh>) );
  close($ifh);
  
  (my $where = $path) =~ s/\/conf\/[^\/]+$//;
  $Configs->{$
hed on a per-path basis.  Paths are full - i.e. C</usr/local/projects/mysite.com/conf/asp4-config.json> - 
so there should never be a clash between two different configurations on the
same web server,
ASP4 ( J/JO/JOHND/ASP4-1.087.tar.gz, JOHND, 2012; MetaCPAN )
ASP4/lib/ASP4/StaticHandler.pm ( view source; MetaCPAN )
g',
    png   => 'image/png',
    bmp   => 'image/bmp',
    gif   => 'image/gif',
    json  => 'application/x-json',
    css   => 'text/css',
    pdf   => 'application/x-pdf',
    js    => 'text/javas
ASP4 ( J/JO/JOHND/ASP4-1.087.tar.gz, JOHND, 2012; MetaCPAN )
ASP4/lib/ASP4/RequestFilter.pm ( view source; MetaCPAN )
onse->Redirect("/login/");
    }# end if()
  }
  
  1;# return true:

Then, in your C<asp4-config.json>:

  {
    ...
    "web": {
      ...
      "request_filters": [
        {
          "uri_match":
ASP4 ( J/JO/JOHND/ASP4-1.087.tar.gz, JOHND, 2012; MetaCPAN )
ASP4/lib/ASP4/SessionStateManager/Memcached.pm ( view source; MetaCPAN )


use strict;
use warnings 'all';
use base 'ASP4::SessionStateManager';
use Cache::Memcached;
use JSON::XS;

my $memd;

sub new
{
  my ($class, $r) = @_;
  my $s = bless { }, $class;
  my $conn = ASP4
ion_id
{
  my ($s, $id) = @_;
  
  my $ref = $memd->get( $id )
    or return;
  $s = bless decode_json($ref), ref($s) ? ref($s) : $s;
}# end verify_session_id()
*retrieve = \&verify_session_id;


sub 
  $s->{__lastMod} = time();
  $s->sign;
  
  my %clone = %$s;
  my $json = encode_json(\%clone);
  $memd->set( $s->{SessionID}, $json, $s->{__ttl} );
}# end save()


sub reset
{
  my $s = shift;
  
  
ASP4 ( J/JO/JOHND/ASP4-1.087.tar.gz, JOHND, 2012; MetaCPAN )
ASP4/lib/ASP4/ConfigNode/Web.pm ( view source; MetaCPAN )
gNode::Web;

use strict;
use warnings 'all';
use base 'ASP4::ConfigNode';
use Carp 'confess';
use JSON::XS;


sub new
{
  my $class = shift;
  
  my $s = $class->SUPER::new( @_ );
  $s->{handler_resol
ding: $!";
      local $/;
      my $json = eval { decode_json( scalar(<$ifh>) ) }
        or confess "Error parsing '$item->{include_routes}': $@";
      ref($json) eq 'ARRAY'
        or confess "Fil
e '$item->{include_routes}' should be an arrayref but it's a '@{[ ref($json) ]}' instead.";
      @$json;
    } : $_
  } @original;
  
  my $router = Router::Generic->new();
  map { $router->add_route
ASP4 ( J/JO/JOHND/ASP4-1.087.tar.gz, JOHND, 2012; MetaCPAN )
ASP4/lib/ASP4/Response.pm ( view source; MetaCPAN )
 to whatever you set your config->data_connections->session->cookie_domain to
in your asp4-config.json.  Otherwise defaults to C<$ENV{HTTP_HOST}>.

You can override the defaults by passing in a domain
ASP4 ( J/JO/JOHND/ASP4-1.087.tar.gz, JOHND, 2012; MetaCPAN )
ASP4/lib/ASP4/Config.pm ( view source; MetaCPAN )
    $conn->password
    );
  }# end foreach()

=head1 JSON Config File

ASP4::ASP keeps all of its configuration inside of C</conf/asp4-config.json>

Here is an example:

  {
    "system": {
      "po
ASP4 ( J/JO/JOHND/ASP4-1.087.tar.gz, JOHND, 2012; MetaCPAN )
ASP4/lib/ASP4/ConfigFinder.pm ( view source; MetaCPAN )
ConfigFinder;

use strict;
use warnings 'all';
use Cwd 'fastcwd';

our $CONFIGFILE = 'asp4-config.json';


sub config_path
{
  my $path = $CONFIGFILE;
  
  my $root = do { ($ENV{REMOTE_ADDR} || '') eq

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.