SIOC::Item - SIOC Item class


SIOC documentation Contained in the SIOC distribution.

Index


Code Index:

NAME

Top

SIOC::Item -- SIOC Item class

VERSION

Top

The initial template usually just has:

This documentation refers to SIOC::Item version 0.0.1.

SYNOPSIS

Top

   use <Module::Name>;

   # Brief but working code example(s) here showing the most common usage(s)
   # This section will be as far as many users bother reading, so make it as
   # educational and exemplary as possible.

DESCRIPTION

Top

SIOC::Item is a high-level concept for content items. It has subclasses that further specify different types of Items. One of these subclasses (which plays an important role in SIOC) is SIOC::Post, used to describe articles or messages created within online community Sites. The SIOC Types Ontology Module describes additional, more specific subclasses of sioc:Item.

Items can be contained within Containers.

CLASS ATTRIBUTES

Top

created

Details the date and time when a resource was created.

This attribute is required and must be set in the creation of a class instance with new().

creator

This is the User who made this Item.

This attribute is required and must be set in the creation of a class instance with new().

modified

Details the date and time when a resource was modified.

modifier

A User who modified this Item.

view_count

The number of times this Item, Thread, User profile, etc. has been viewed.

about

Specifies that this Item is about a particular resource, e.g., a Post describing a book, hotel, etc.

container

The Container to which this Item belongs.

parent_posts

Links to Items or Posts which this Item or Post is a reply to.

reply_posts

Points to Items or Posts that are a reply or response to this Item or Post.

ip_address

The IP address used when creating this Item. This can be associated with a creator. Some wiki articles list the IP addresses for the creator or modifiers when the usernames are absent.

previous_by_date

Previous Item or Post in a given Container sorted by date.

next_by_date

Next Item or Post in a given Container sorted by date.

previous_version

Links to a previous revision of this Item or Post.

next_version

Links to the next revision of this Item or Post.

SUBROUTINES/METHODS

Top

created([$new_creation_date])

Accessor for the attribute of the same name. Call without argument to read the current value of the attribute; sets attribute when called with new value as argument.

creator([$new_creator])

Accessor for the attribute of the same name. Call without argument to read the current value of the attribute; sets attribute when called with new value as argument.

modified([$new_modified_date])

Accessor for the attribute of the same name. Call without argument to read the current value of the attribute; sets attribute when called with new value as argument.

modifier([$new_modifier])

Accessor for the attribute of the same name. Call without argument to read the current value of the attribute; sets attribute when called with new value as argument.

view_count($new_count)

Accessor for the attribute of the same name. Call without argument to read the current value of the attribute; sets attribute when called with new value as argument.

about([$new_about])

Accessor for the attribute of the same name. Call without argument to read the current value of the attribute; sets attribute when called with new value as argument.

container([$new_container])

Accessor for the attribute of the same name. Call without argument to read the current value of the attribute; sets attribute when called with new value as argument.

add_parent_post($post)

Adds a new value to the corresponding array attribute.

add_reply_post

Adds a new value to the corresponding array attribute.

ip_address([$new_ip])

Accessor for the attribute of the same name. Call without argument to read the current value of the attribute; sets attribute when called with new value as argument.

previous_by_date([$post])

Accessor for the attribute of the same name. Call without argument to read the current value of the attribute; sets attribute when called with new value as argument.

next_by_date([%post])

Accessor for the attribute of the same name. Call without argument to read the current value of the attribute; sets attribute when called with new value as argument.

previous_version([$post])

Accessor for the attribute of the same name. Call without argument to read the current value of the attribute; sets attribute when called with new value as argument.

next_version([$post])

Accessor for the attribute of the same name. Call without argument to read the current value of the attribute; sets attribute when called with new value as argument.

DIAGNOSTICS

Top

For diagnostics information, see the SIOC base class.

CONFIGURATION AND ENVIRONMENT

Top

This module doesn't need configuration.

DEPENDENCIES

Top

This module depends on the following modules:

INCOMPATIBILITIES

Top

There are no known incompatibilities.

BUGS AND LIMITATIONS

Top

There are no known bugs in this module.

Please report problems via the bug tracking system on the perl-SIOC project website: http://developer.berlios.de/projects/perl-sioc/.

Patches are welcome.

AUTHOR

Top

Jochen Lillich <geewiz@cpan.org>

LICENSE AND COPYRIGHT

Top


SIOC documentation Contained in the SIOC distribution.

###########################################################
# SIOC::Item
# Item class for the SIOC ontology
###########################################################
#
# $Id: Item.pm 10 2008-03-01 21:38:39Z geewiz $
#

package SIOC::Item;

use strict;
use warnings;

use version; our $VERSION = qv(1.0.0);

use Moose;
use MooseX::AttributeHelpers;

extends 'SIOC';

### required attributes

has 'created' => (
    isa => 'Str',
    is => 'rw',
    required => 1,
);

has 'creator' => (
    isa => 'SIOC::User',
    is => 'rw',
    required => 1,
);

### optional attributes

has 'modified' => (
    isa => 'Str',
    is => 'rw'
);

has 'modifier' => (
    isa => 'SIOC::User',
    is => 'rw',
);

has 'view_count' => (
    isa => 'Num',
    is => 'rw',
);

has 'about' => (
    isa => 'Str',
    is => 'rw',
);

has 'container' => (
    isa => 'SIOC::Container',
    is => 'rw',
);

has 'parent_posts' => (
    isa => 'ArrayRef[SIOC::Item]',
    metaclass => 'Collection::Array',
    is => 'rw',
    default => sub { [] },
    provides => {
        'push' => 'add_parent_post',
    },
);

has 'reply_posts' => (
    isa => 'ArrayRef[SIOC::Item]',
    metaclass => 'Collection::Array',
    is => 'rw',
    default => sub { [] },
    provides => {
        'push' => 'add_reply_post',
    },
);

has 'ip_address' => (
    isa => 'Str',
    is => 'rw',
);

has 'previous_by_date' => (
    isa => 'SIOC::Item',
    is => 'rw',
);

has 'next_by_date' => (
    isa => 'SIOC::Item',
    is => 'rw',
    );

has 'previous_version' => (
    isa => 'SIOC::Item',
    is => 'rw',
);

has 'next_version' => (
    isa => 'SIOC::Item',
    is => 'rw',
);

### methods

after 'fill_template' => sub {
    my ($self) = @_;
    
    $self->set_template_var(created => $self->created);
    $self->set_template_var(creator => $self->creator);
};

1;
__END__