DAIA::Entity - Abstract base class of Department, Institution, Storage, and Limitation


DAIA documentation Contained in the DAIA distribution.

Index


Code Index:

NAME

Top

DAIA::Entity - Abstract base class of Department, Institution, Storage, and Limitation

PROPERTIES

Top

id

A persistent identifier for the entity (optional). Must be an URI (xs:anyURI).

content

A simple name describing the entity. Be default the empty string is used.

href

An URL linking to the entity (optional).

AUTHOR

Top

Jakob Voss <jakob.voss@gbv.de>

LICENSE

Top

Copyright (C) 2009-2010 by Verbundzentrale Goettingen (VZG) and Jakob Voss

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.


DAIA documentation Contained in the DAIA distribution.
package DAIA::Entity;

use strict;
use Data::Validate::URI qw(is_uri is_web_uri);
use base 'DAIA::Object';
our $VERSION = '0.29';

our %PROPERTIES = (
    content => { 
        default => '', 
        filter => sub { defined $_[0] ? "$_[0]" : "" }
    },
    href => {
        filter => sub { my $v = "$_[0]"; $v =~ s/^\s+|\s$//g; is_web_uri($v) ? $v : undef; }
    },
    id => {
        filter => sub { my $v = "$_[0]"; $v =~ s/^\s+|\s$//g; is_uri($v) ? $v : undef; }
    }
);

sub _buildargs { 
    shift;
    return @_ % 2 ? (content => @_) : @_;
}

1;