-
Notifications
You must be signed in to change notification settings - Fork 0
/
Collection.pm
44 lines (35 loc) · 1.26 KB
/
Collection.pm
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
package Page::Story::Magic::Collection;
use v5.8.8;
use strict;
use warnings;
use Exporter qw(import);
use Page::File qw(file_path);
use Page::HTML qw(list);
use Page::People qw(people_list);
our $VERSION = "1.0";
our @EXPORT_OK = qw(collection_magic);
sub media_class {
my ($class, $title) = @_;
my $add_title = $title && $title =~ /^[yt1]/ ? 'title ' : '';
return qq(class="$add_title$class");
}
sub collection_magic {
my $magic;
for (qw(massmarket trade hardcover cd cassette lp ff brd dvd vhs dgt)) {
$magic->{"${_}s"} = media_class($_);
$magic->{$_} = media_class($_, 'yes');
}
my @people = (qw(authors musicians comedians artists), 'actors', 'producers and directors');
for my $group (@people) {
my $file = $group;
$file =~ s/ /_/g;
my $people_file = file_path('People', ucfirst "$file.txt");
$magic->{$group} = sub { list(3, 'u', people_list($people_file), { 'class' => 'three' }) };
}
return $magic;
}
# Version 1.0.
# Depends on Page::File, Page::HTML, Page::People, and Exporter
# This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See https://dev.perl.org/licenses/artistic.html.
# Copyright © 2020, Lady Aleena (aleena@cpan.org). All rights reserved.
1;