Group
Extension

Matches 4

Sleep ( S/ST/STUIFZAND/Sleep-0.0.4.tar.gz, STUIFZAND, 2008; MetaCPAN )
Sleep/lib/Sleep.pm ( view source; MetaCPAN )

=head1 VERSION

0.0.4

=head1 LIMITATIONS

Currently the only supported mime-type is application/json.

=head1 SEE ALSO

L<Sleep::Handler|Sleep::Handler>, L<Sleep::Resource|Sleep::Resource>,
L<Sleep:
Sleep ( S/ST/STUIFZAND/Sleep-0.0.4.tar.gz, STUIFZAND, 2008; MetaCPAN )
Sleep/lib/Sleep/Response.pm ( view source; MetaCPAN )
package Sleep::Response;

use strict;
use warnings;

use Carp;
use JSON::XS;

sub new {
    my $klass = shift;
    my $args = shift || {};

    my $self = bless { %$args }, $klass;

    return $self;
ub encode {
    my $self = shift;
    my $as = shift;

    if ($as eq 'application/json') {
        return encode_json($self->data());
    }
    
    croak "Can't encode";
}

1;

__END__

=head1 NAME
Sleep ( S/ST/STUIFZAND/Sleep-0.0.4.tar.gz, STUIFZAND, 2008; MetaCPAN )
Sleep/lib/Sleep/Handler.pm ( view source; MetaCPAN )
equest->new($r, $db, @vars);

    my $method = lc $r->method();

    my $mime_type = 'application/json';

    if ($method =~ m/^get|post|put|delete$/) {
        if ($method eq 'get') {
            my 
Sleep ( S/ST/STUIFZAND/Sleep-0.0.4.tar.gz, STUIFZAND, 2008; MetaCPAN )
Sleep/lib/Sleep/Request.pm ( view source; MetaCPAN )
package Sleep::Request;

use strict;
use warnings;

use JSON::XS;

sub new {
    my $klass   = shift;
    my $request = shift;
    my $db      = shift;
    my @vars    = @_;

    my $self = bless { re
rs}->[0];
}

sub decode {
    my $self = shift;
    my $data = shift;

    $self->{data} = decode_json($data);

    return;
}

sub data {
    my $self = shift;
    return $self->{data};
}

1;

__END__
DS 

=over 4

=item id

Returns the first variable from C<vars>.

=item decode($data)

Parses the JSON data in C<$data> to a perl representation. Retrieve this value using C<data>.

=item data

Return

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