Apache2-REST

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

author:              
    - Jerome Eteve <jerome@eteve.net>
generated_by:        ExtUtils::MakeMaker version 6.42
distribution_type:   module
requires:     
    Apache2::Log:                  2.000001
    Apache2::Request:              2.08
    Class::AutoAccess:             0.02
    Digest::MD5:                   2.33
    HTTP::Status:                  1.28
    JSON::XS:                      2.2222
    REST::Client:                  118
    Test::More:                    0
    XML::Simple:                   2.14
    YAML:                          0.68
meta-spec:
    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
    version: 1.3

Makefile.PL  view on Meta::CPAN

    AUTHOR              => 'Jerome Eteve <jerome@eteve.net>',
    VERSION_FROM        => 'lib/Apache2/REST.pm',
    ABSTRACT_FROM       => 'lib/Apache2/REST.pm',
    PL_FILES            => {},
    EXE_FILES           => [ 'bin/restclient' ],
    PREREQ_PM => {
        'Test::More' => 0,
        'Class::AutoAccess' => 0.02 ,
        'Apache2::Request' => 2.08 ,
        'Apache2::Log'     => 2.000001,
        'JSON::XS' => 2.2222 ,
        'XML::Simple' => 2.14 ,
        'YAML' => 0.68 ,
        'REST::Client' => 118,
        'HTTP::Status' => 1.28,
        'Digest::MD5' => 2.33,
    },
    dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
    clean               => { FILES => 'Apache2-REST-*' },
);

lib/Apache2/REST/Writer/bin.pm  view on Meta::CPAN

package Apache2::REST::Writer::bin ;
use strict ;

use JSON::XS ;

use Data::Dumper ;

=head1 NAME

Apache2::REST::Writer::bin - Apache2::REST::Response Writer for binary

=head1 DESCRIPTION

This writer returns the binary part of the response.

lib/Apache2/REST/Writer/json.pm  view on Meta::CPAN

package Apache2::REST::Writer::json ;
use strict ;

use JSON::XS ;

use Data::Dumper ;

=head1 NAME

Apache2::REST::Writer::json - Apache2::REST::Response Writer for json

=cut

=head2 new

lib/Apache2/REST/Writer/json.pm  view on Meta::CPAN

Returns the response as json UTF8 bytes for output.

=cut

sub asBytes{
    my ($self,  $resp ) = @_ ;
    
    #Shallow unblessed copy of response
    # JSON wont output blessed object not implementing the TO_JSON request
    my %resp = %$resp ;
    my $coder = JSON::XS->new->allow_blessed(0)->utf8;
    ## These are bytes. This is correct.
    return $coder->encode(\%resp) ;
    
}

1;



( run in 0.525 second using v1.01-cache-2.11-cpan-4d50c553e7e )