Sleep::Request - A Sleep request.


Sleep documentation Contained in the Sleep distribution.

Index


Code Index:

NAME

Top

Sleep::Request - A Sleep request.

DESCRIPTION

Top

CLASS METHODS

Top

new

Constructor. Needs three arguments: request, the apache request; db, a database object; and vars, an array with the variables parsed from the URL.

METHODS

Top

id

Returns the first variable from vars.

decode($data)

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

data

Return the parsed data object.

BUGS

Top

If you find a bug, please let the author know.

COPYRIGHT

Top

AUTHOR

Top

Peter Stuifzand <peter@stuifzand.eu>


Sleep documentation Contained in the Sleep distribution.

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 { request => $request, db => $db, vars => \@vars }, $klass;

    return $self;
}

sub id {
    my $self = shift;
    return $self->{vars}->[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__