SIOC::Container - SIOC Container class


SIOC documentation Contained in the SIOC distribution.

Index


Code Index:

NAME

Top

SIOC::Container -- SIOC Container class

VERSION

Top

This documentation refers to SIOC::Container version 1.0.0.

SYNOPSIS

Top

   use SIOC::Container;

DESCRIPTION

Top

Container is a high-level concept used to group content Items together. The relationships between a Container and the Items that belong to it are described using sioc:container_of and sioc:has_container properties. A hierarchy of Containers can be defined in terms of parents and children using sioc:has_parent and sioc:parent_of.

Subclasses of Container can be used to further specify typed groupings of Items in online communities. Forum, a subclass of Container and one of the core classes in SIOC, is used to describe an area on a community Site (e.g., a forum or weblog) on which Posts are made. The SIOC Types Ontology Module contains additional, more specific subclasses of SIOC::Container.

CLASS ATTRIBUTES

Top

parent

A Container or Forum that this Container or Forum is a child of.

children

Child Containers or Forums that this Container or Forum is a parent of.

items

Items/Posts that this Container contains.

owner

A User that this Container is owned by.

subscribers

Users who are subscribed to this Container.

SUBROUTINES/METHODS

Top

parent([$new_parent])

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_child($new_child)

Adds a new value to the corresponding array attribute.

add_item($new_item)

Adds a new value to the corresponding array attribute.

owner([$new_owner])

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_subscriber($new_subscriber)

Adds a new value to the corresponding array attribute.

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::Container
# Container class for the SIOC ontology
###########################################################
#
# $Id: Container.pm 10 2008-03-01 21:38:39Z geewiz $
#

package SIOC::Container;

use strict;
use warnings;

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

use Moose;

extends 'SIOC';

### optional attributes

# parent container/forum
has 'parent' => (
    isa => 'SIOC::Container',
    is => 'rw',
    );

# child containers/forums
has 'children' => (
    isa => 'ArrayRef[SIOC::Container]',
    metaclass => 'Collection::Array',
    is => 'rw',
    default => sub { [] },
    provides => {
        'push' => 'add_child',
    },
    );

# contained items/posts
has 'items' => (
    isa => 'ArrayRef[SIOC::Item]',
    metaclass => 'Collection::Array',
    is => 'rw',
    default => sub { [] },
    provides => {
        'push' => 'add_item',
    },
    );

# user that owns this container
has 'owner' => (
    isa => 'SIOC::User',
    is => 'rw',
    );

# users that subscribe to this container
has 'subscribers' => (
    isa => 'ArrayRef[SIOC::User]',
    metaclass => 'Collection::Array',
    is => 'rw',
    default => sub { [] },
    provides => {
        'push' => 'add_subscriber',
    },
    );

### methods

after 'fill_template' => sub {
    my ($self) = @_;

    $self->set_template_var(parent => $self->parent);
    $self->set_template_var(children => $self->children);
    $self->set_template_var(items => $self->items);
    $self->set_template_var(owner => $self->owner);
    $self->set_template_var(subscribers => $self->subscribers);
};    
   
1;
__END__