WWW::FMyLife::Item - Represents a single FMyLife.com Item


WWW-FMyLife documentation Contained in the WWW-FMyLife distribution.

Index


Code Index:

NAME

Top

WWW::FMyLife::Item - Represents a single FMyLife.com Item

VERSION

Top

Version 0.04

SYNOPSIS

Top

    my $fml = WWW::FMyLife::Item->new( {
        author => 'me',
        text   => 'Stuff',
    } );

    ...

EXPORT

Top

Nothing.

METHODS

Top

new

Create a new item which can be submitted to FML.

AUTHORS

Top

Sawyer X (XSAWYERX), <xsawyerx at cpan.org> Tamir Lousky (TLOUSKY), <tlousky at cpan.org>

BUGS

Top

Please report any bugs or feature requests to bug-www-fmylife at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-FMyLife.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc WWW::FMyLife

You can also look for information at:

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-FMyLife

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/WWW-FMyLife

* CPAN Ratings

http://cpanratings.perl.org/d/WWW-FMyLife

* Search CPAN

http://search.cpan.org/dist/WWW-FMyLife/

ACKNOWLEDGEMENTS

Top

COPYRIGHT & LICENSE

Top


WWW-FMyLife documentation Contained in the WWW-FMyLife distribution.

package WWW::FMyLife::Item;

use Moose;
use Moose::Util::TypeConstraints;

our $VERSION = '0.05';

subtype 'FMLAuthor'
    => as 'HashRef'
    => where { exists shift->{'content'} };

subtype 'FMLVote'
    => as 'HashRef'
    => where {
        my $ref = shift;
        ( exists $ref->{'deserved'}     && exists $ref->{'agree'}     ) &&
        ( $ref->{'deserved'} =~ /^\d+$/ && $ref->{'agree'} =~ /^\d+$/ )
    };

subtype 'EmptyComment'
    => as 'HashRef'
    => where {
        my $ref = shift;
        scalar keys %{$ref} == 0;
    };

has 'id'            => ( is => 'rw', isa => 'Int'              );
has 'author'        => ( is => 'rw', isa => 'FMLAuthor'        );
has 'date'          => ( is => 'rw', isa => 'Str'              );
has 'category'      => ( is => 'rw', isa => 'Str'              );
has 'text'          => ( is => 'rw', isa => 'Str'              );
has 'vote'          => ( is => 'rw', isa => 'HashRef'          );
has 'deserved'      => ( is => 'rw', isa => 'Int'              );
has 'agree'         => ( is => 'rw', isa => 'Int'              );
has 'comments'      => ( is => 'rw', isa => 'Int|EmptyComment' );
has 'comments_flag' => ( is => 'rw', isa => 'Bool'             );

no Moose;
__PACKAGE__->meta->make_immutable;

1;

__END__