WARNING SCRIPT PROBLEM
$@ = Can't locate YAML.pm in @INC (@INC contains: /home/kellob5/public_html/cgi-bin /home/kellob5/perl5/lib/perl5 /home/kellob5/perl5/lib/perl5/x86_64-linux-thread-multi /home/kellob5/perl/usr/local/lib64/perl5 /home/kellob5/perl/usr/local/share/perl5 /home/kellob5/perl/usr/lib64/perl5/vendor_perl /home/kellob5/perl/usr/share/perl5/vendor_perl /home/kellob5/perl/usr/lib64/perl5 /home/kellob5/perl/usr/share/perl5 /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at (eval 5) line 7. BEGIN failed--compilation aborted at (eval 5) line 7.
$last_eval_warn =
$os =

Script follows...
line numcode
1print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" ' . "\n" . ' "http://www.w3.org/TR/html4/loose.dtd"> ' . "\n" . '<html> ' . "\n" . ' <head> ' . "\n" . ' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> ' . "\n" . ' <link rel="stylesheet" type="text/css" href="http://www.kellobowitz.net/wedding/wedding.css"> ' . "\n" . ' <title>Pictures n\' Stuff</title> ' . "\n" . ' <base target="_blank"> ' . "\n" . '</head> ' . "\n" . '<body> ' . "\n" . ' <h2>Pictures</h2> ' . "\n" . ' ' . "\n";
2
3use piclist qw(readPicLists);
4use CGI;
5use Date::Parse;
6use Time::Local;
7use YAML qw(LoadFile);
8use HTML::Entities qw(encode_entities);
9
10
11my $pdir = "../wedding/pics";
12my $maxW = 350;
13
14sub genForm {
15 my $pdata = shift;
16 my $os = "";
17 $os .= "<form name=\"groupchoice\" method=\"post\" target=\"mwind\" action=\"http://www.kellobowitz.net/cgi-bin/dp.pl\">\n";
18 $os .= " <input type=\"hidden\" name=\"file\" value=\"wedding/pics.phtml\"/>\n";
19 $os .= " <select name=\"whichgroup\" onChange=\"javascript:this.form.submit()\">\n";
20 $os .= " <option value=\"__undef\">Please Choose</option>\n";
21 foreach my $g (sort { $pdata->{$a}{title} cmp
22 $pdata->{$b}{title} } keys %{$pdata}) {
23 $os .= " <option value=\"" . $g . "\">" . $pdata->{$g}{title} . "</option>\n";
24 }
25 $os .= " </select>\n";
26 $os .= " <input type=\"submit\" name=\"bobthesubmitbutton\" value=\"showem\"/>\n";
27 $os .= "</form>\n";
28 return $os;
29}
30
31sub date2int {
32 my $a = shift;
33
34 if ($a =~ /:/) {
35 my ($date,$time) = split(/\s/,$a);
36 $date =~ s/:/-/g;
37 my $at = str2time($date . " " . $time);
38 if (!defined($at)) { $at = 0; };
39 return $at;
40 } else {
41 my $ac = $a; $ac =~ s/,//;
42 my ($aw, $ad) = split(/\s/,$ac);
43 $aw = lc($aw);
44 my $at = undef;
45 if (defined($ad) && ($ad =~ /^\d+$/)) {
46 if ($aw =~ /spri/) {
47 $at = timelocal(0, 0, 0, ,21 ,2, $ad);
48 } elsif ($aw =~ /wint/) {
49 $at = timelocal(0, 0, 0, ,21 ,11, $ad);
50 } elsif ($aw =~ /summ/) {
51 $at = timelocal(0, 0, 0, ,21 ,5, $ad);
52 } elsif ($aw =~ /fall/) {
53 $at = timelocal(0, 0, 0, ,21 ,8, $ad);
54 } else {
55 $at = str2time($a);
56 }
57 } else {
58 $at = str2time($a);
59 }
60 if (!defined($at)) { $at = 0; };
61 return $at;
62 }
63}
64
65sub dateComp2 {
66 my $a = shift;
67 my $b = shift;
68 return (date2int($a) <=> date2int($b));
69}
70
71sub showPics {
72 my $pdata = shift;
73 my $wg = shift;
74 my $os = "";
75
76 my $ct = 0;
77
78 $os .= "<p>Showing pictures from the \"" .
79 $pdata->{$wg}{title} .
80 "\" group.</p>\n";
81
82 if (defined($pdata->{$wg}{note}) && length($pdata->{$wg}{note})) {
83 $os .= "<p>" . $pdata->{$wg}{note} . "</p>\n";
84 }
85
86 $os .= '<table class="hotels" align="center">';
87 $os .= ' <tr><td width="33%"></td><td width="33%"></td><td width="33%"></td></tr>' . "\n";
88 foreach my $pic (sort { my $as = $pdata->{$wg}{pics}{$a}{date};
89 my $bs = $pdata->{$wg}{pics}{$b}{date};
90 my $r = dateComp2($as,$bs);
91 return $r;
92 } keys %{$pdata->{$wg}{pics}}) {
93 my $picd = $pdata->{$wg}{pics}{$pic};
94 my $eo = ($ct++ % 2);
95 my $w = $picd->{width};
96 my $h = $picd->{height};
97 my $scale = 100;
98
99 my $newW = $w;
100 if ($w > $maxW) { $scale = 100 * ($maxW/$w); $newW = $maxW; }
101 my $newH = int(($scale * $h / 100) + 0.5);
102 $scale = int($scale);
103
104
105 $os .= ' <tr>' . "\n";
106 if ($eo) {
107 $os .= ' <td width="33%"></td>' . "\n";
108 }
109
110 $os .= ' <td colspan="2" width="66%" align="' .
111 # ($eo ? "right" : "left") . '">' . "\n";
112 ($eo ? "center" : "center") . '">' . "\n";
113 $os .= " <img src=\"" . $pdir . "/" . $picd->{file} . "\" alt=\"" .
114 encode_entities($picd->{caption}) . "\"";
115
116 if ($scale != 100) {
117 $os .= " width=\"" . $newW. "\" height=\"" . $newH. "\"";
118 }
119 $os .= "/><br/>\n";
120
121 if (length($picd->{caption})) {
122 $os .= "“" . $picd->{caption} . "”<br/>";
123 }
124 $os .= "<font class=\"pic_photographer\">";
125 if (length($picd->{photographer})) {
126 $os .= "© " . $picd->{photographer} . ", ";
127 }
128 if (length($picd->{date})) {
129 if ($picd->{date} =~ /:/) {
130 $picd->{date} =~ s/\s\d+:\d+:\d+\s*$//;
131 $picd->{date} =~ s/:/\//g;
132 }
133 $os .= $picd->{date} . ", ";
134 }
135
136 if ($os =~ /, $/) { chop $os; chop $os; $os .= " ";};
137
138 $os .= "</font>";
139
140 if (length($picd->{bigfile})) {
141 $os .= "<a class=\"pic_enlarge\" href=\"http://www.kellobowitz.net/wedding/pics/" .
142 $picd->{bigfile} . "\">[enlarge]</a>";
143 }
144
145 $os .= ' </td>' . "\n";
146 if (!$eo) {
147 $os .= ' <td width="33%"></td>' . "\n";
148 }
149
150 $os .= ' </tr>' . "\n";
151
152 }
153 $os .= '</table>' . "\n";
154
155 return $os;
156}
157
158sub addYAMLLists {
159 my $pdata = shift;
160 my $dir = shift;
161 opendir(D,$dir);
162 my @yfiles = grep { /\.yaml$/ } readdir D;
163 closedir(D);
164 return $pdata;
165}
166
167my $pdata = readPicLists("../wedding/pics");
168#addYAMLLists($pdata,'../wedding/pics');
169
170my $q;
171if (defined($cgiparams)) {
172 $q = $cgiparams;
173} else {
174 $q = new CGI;
175}
176
177my $wg = $q->param('whichgroup');
178
179print ' ' . "\n" . '' . ((defined($wg) && ($wg ne "__undef")) ? showPics($pdata,$wg) : "") . ' ' . "\n" . '<br/> ' . "\n" . '<table class="hotels" align="center"> ' . "\n" . ' <tr valign="top"> ' . "\n" . ' <td valign="top" align="right" width="50%">We\'ve divided our photos into groups. Please select a group to see:</td> ' . "\n" . ' <td valign="top">' . (genForm($pdata)) . '</td> ' . "\n" . ' </tr> ' . "\n" . '</table> ' . "\n" . '<p>Also, you can check our professional wedding photos at <a href="http://www.pictage.com">pictage.com</a>. You must enter the wedding name "Keller/Jacobowitz", and create an account to see the pictures.</p> ' . "\n" . ' ' . "\n" . '</body> ' . "\n" . '</html> ' . "\n";