xxwhirlpool
·
2026-05-26
1#!/usr/bin/env perl
2
3use 5.38.2;
4use strict;
5use warnings;
6
7use Template;
8use File::Slurp;
9use File::Copy;
10
11sub usage {
12 die("Usage: iconshare.pl [DIR]\n");
13}
14
15my ($icon_dir) = @ARGV;
16
17if (not defined $icon_dir) {
18 usage
19}
20
21my @icons = read_dir($icon_dir, prefix => 1);
22
23mkdir("out");
24
25if ( -d "out" ) {
26 foreach my $icon (@icons) {
27 copy($icon, "out") or die "copy failed: $!";
28 }
29} else {
30 die("directory cannot be created: out, $!");
31}
32
33my %data = (
34 title => "gallery",
35 icons => \@icons,
36);
37
38my $tt = Template->new({
39 INCLUDE_PATH => "./templates",
40 INTERPOLATE => 1,
41}) or die "$Template::ERROR\n";
42
43my $htmlfile = "out/gallery.html";
44$tt->process("iconshare.tt", \%data, $htmlfile) or die $tt->error(), "\n";