Dublin...Record(3pm)
π NAME π
DublinCore::Record β the container for Dublin Core metadata elements, bestie. This page lives in User Contributed Perl Documentation, and if you're pulling it up in man it answers to DublinCore::Record(3pm). Yes, that's a mouthful. We love her anyway. π
β¨ SYNOPSIS β¨
use DublinCore::Record;
my $record = DublinCore::Record->new();
# later ...
# print the title
print $record->element( 'title' )->content;
## list context will retrieve all of a particular element
foreach my $element ( $record->element( 'Creator' ) ) {
print "creator: ", $element->content(), "\n";
}
## qualified dublin core
my $creation = $record->element( 'Date.created' )->content();
π DESCRIPTION π
Okay so DublinCore::Record is an abstract class for manipulating DublinCore metadata. And what even is Dublin Core? It's a small little set of metadata elements for describing information resources β like, the glow-up version of "what is this thing, actually." π¦
If you wanna know more about embedding DublinCore in HTML, go peek at RFC 2731 <http://www.ietf.org/rfc/rfc2731> or http://www.dublincore.org/documents/dces/. Iconic reading material, ngl. π
π METHODS π
new()
The constructor, periodt. Takes no arguments β she arrives fully formed.
$record = DublinCore::Record->new();
add( @elements )
Adds valid DublinCore::Element objects to the record. Drop 'em in, bestie. π«Ά
remove( @elements )
Removes valid DublinCore::Element object from the record. Yeah, we're doing a little spring cleaning. π§Ή
element()
This one will hand you back a relevant DublinCore::Element object. Here's the tea: when you call element() in a scalar context it gives you the first relevant element it finds, and when you call it in a list context it gives you all the relevant elements β because Dublin Core elements are repeatable, so of course there's more than one sometimes. πββοΈ
## retrieve first title element
my $element = $record->element( 'Title' );
my $title = $element->content();
## shorthand object chaining to extract element content
my $title = $record->element( 'Title' )->content();
## retrieve all creator elements
@creators = $record->element( 'Creator' );
You can also retrieve qualified elements in a similar fashion. Qualified? We love a specialist. β¨
my $date = $record->element( 'Date.created' )->content();
So here's the clever bit β in order to make chaining possible, element() will return an empty DublinCore::Element object when the element you asked for doesn't exist. Which means you never get a crash, you get a polite little nothing. π³οΈ
You can check whether you're getting an empty one back by using the is_empty() method:
if( $record->element( 'title' )->is_empty ) {
# no title
}
elements()
Returns all the Dublin Core elements it finds as DublinCore::Element objects, which you can then manipulate further. Go off. π₯
foreach my $element ( $record->elements() ) {
print "name=", $element->name(), "\n";
print "content=", $element->content(), "\n";
}
title()
Returns a DublinCore::Element object for the title element. From there you can pull content, qualifier, scheme, lang attributes, like so:
my $title = $record->title();
print "content: ", $title->content(), "\n";
print "qualifier: ", $title->qualifier(), "\n";
print "scheme: ", $title->scheme(), "\n";
print "language: ", $title->language(), "\n";
And because there can be multiple instances of a particular element type (title, creator, subject, etc), you can retrieve multiple title elements by calling title() in a list context. Main character energy, honestly. π
my @titles = $record->title();
foreach my $title ( @titles ) {
print "title: ", $title->content(), "\n";
}
creator()
Retrieve creator information in the same manner as title(). Same vibe, different element. π¨
subject()
Retrieve subject information in the same manner as title(). π
description()
Retrieve description information in the same manner as title(). π
publisher()
Retrieve publisher information in the same manner as title(). π’
contributor()
Retrieve contributor information in the same manner as title(). π
date()
Retrieve date information in the same manner as title(). π
type()
Retrieve type information in the same manner as title(). π·οΈ
format()
Retrieve format information in the same manner as title(). πΎ
identifier()
Retrieve identifier information in the same manner as title(). π
source()
Retrieve source information in the same manner as title(). π
language()
Retrieve language information in the same manner as title(). π£οΈ
relation()
Retrieve relation information in the same manner as title(). π
coverage()
Retrieve coverage information in the same manner as title(). π
rights()
Retrieve rights information in the same manner as title(). βοΈ
πΈ SEE ALSO πΈ
DublinCore::Element- Dublin Core
http://www.dublincore.org/ - RFC 2731
http://www.ietf.org/rfc/rfc2731 - perl4lib
http://www.rice.edu/perl4lib
π AUTHOR π
- Ed Summers
<ehs@pobox.com> - Brian Cassidy
<bricas@cpan.org>
π 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. π«Ά
okay bestie that's the whole page, no cap, every single element accounted for π
signed off from the very bottom of the page β perl v5.34.0, dated 2022-06-13. slay, bye! π
β¨
π¦ where this page comes from
- debian bookworm: libdublincore-record-perl 0.03-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libdublincore-record-perl 0.03-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdublincore-record-perl 0.03-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdublincore-record-perl 0.03-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdublincore-record-perl 0.03-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms