/usr/share/perl5/DublinCore/Element.pm is in libdublincore-record-perl 0.03-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | package DublinCore::Element;
=head1 NAME
DublinCore::Element - Class for representing a Dublin Core element
=head1 SYNOPSIS
my $element = DublinCore::Element->new( \%info );
print "content: ", $element->content(), "\n";
print "qualifier: ", $element->qualifier(), "\n";
print "language: ", $element->language(), "\n";
print "scheme: ", $element->scheme(), "\n";
=head1 DESCRIPTION
DublinCore::Record methods such as element(), elements(), title(), etc return
DublinCore::Element objects as their result. These can be queried
further to extract an elements content, qualifier, language, and schema. For a
definition of these attributes please see RFC 2731 and
L<http://www.dublincore.org>.
=cut
use base qw( Class::Accessor );
use strict;
use warnings;
our $VERSION = '0.03';
__PACKAGE__->mk_accessors( qw( name qualifier content language scheme is_empty ) );
=head1 METHODS
=head2 new()
The constructor. Take a hashref of input arguments.
=cut
sub new {
my $class = shift;
my $self = $class->SUPER::new( @_ );
bless $self, $class;
$self->is_empty( 1 );
return $self;
}
=head2 content()
Gets and sets the content of the element.
## extract the element
my $title = $record->element( 'title' );
print $title->content();
## or you can chain them together
print $record->element( 'title' )->content();
=head2 qualifier()
Gets and sets the qualifier used by the element.
=head2 language()
Gets and sets the language of the content in element.
=head2 scheme()
Gets and sets the scheme used by the element.
=head2 name()
Gets and sets the element name (title, creator, date, etc).
=head2 is_empty()
Gets and sets the "empty" status of an element. This is useful when
using DublinCore::Record's element() method.
To see if the record has an creator elements:
if( $record->element( 'creator' )->is_empty ) {
# no creators
}
=head2 set()
This function overrides the default set() behavior in order to remove the
is_empty flag.
=cut
sub set {
my $self = shift;
$self->SUPER::set( 'is_empty' => 0 ) if $self->is_empty;
$self->SUPER::set( @_ );
}
=head1 SEE ALSO
=over 4
=item * DublinCore::Record
=back
=head1 AUTHOR
=over 4
=item * Ed Summers E<lt>ehs@pobox.comE<gt>
=item * Brian Cassidy E<lt>bricas@cpan.orgE<gt>
=back
=head1 COPYRIGHT AND LICENSE
Copyright 2007 by Ed Summers, Brian Cassidy
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
1;
|