#! /usr/bin/perl
use warnings;
use strict;
use feature qw'say';
use DBI;
# source: New1229dbWithDblQuotes.sqlite; output: 1231STM.htm
# TBD: see pod at LN 150
BEGIN { warn "Exe:$^X , Ver:$^V , File:$0 \n" }
# get data from db
my $db = 'DBI'->connect('dbi:SQLite:dbname=New1229dbWithDblQuotes.sqlite', q(), q(), {
RaiseError => 1,
});
my $select = $db->prepare(<< '__SQL__');
SELECT events.item, events.type, events.note, events.longdesc, times.starttime, times.endtime, times.place, times.who, times.note, times.extra
FROM events, times
WHERE times.starttime LIKE "2016-08-0_ %"
AND events.link_id = times.link_id
ORDER BY times.starttime
__SQL__
my ($link_id, $events_item, $events_type, $events_note, $events_longdesc, $starttime, $endtime, $place, $who, $note, $extra, %skedhash, $skedhash, $FH_out);
my $old_daymarker = '2016-08-03'; # 1 day before ofcl CVN start; flag for day dividers; see Ln 74 et seq
my $daymarker; # tested (in truncated form) for equality to $old_daymarker
$select->execute or die $DBI::errstr;
# Create html #LN 32
my $file="1231STM.htm";
open ($FH_out, ">", $file) or die "Can not open $file", $!;
# masthead
print $FH_out <<__HEADER__;
Doublequotetest
2017 Stellafane Convention Schedule
__HEADER__
print $FH_out <<__STARTTABLE__;
Event, Type, Host or Moderator, When & Where
\n
Additional Info
\n
\n
__STARTTABLE__
####################################################
sub sked { #LN 67
no warnings "uninitialized";
%skedhash = @_;
if ($skedhash{'who'} ne '') {
$skedhash{'who'} = "Hosted by $skedhash{'who'}";
}
# next LN = 74
$daymarker = substr $skedhash{"starttime"}, 0, 10; # truncate to date element only; omit time
if ( $daymarker !~ /$old_daymarker.*/ ) {
$old_daymarker = $daymarker; # update the flag
# daymarker used in Date::Day (needs an array mm,dd,yyyy or string: mm,dd,yyyy ##
my @orig = split /-/, $skedhash{"starttime"}, 3; # split only first 3 elements
my @fixed;
push @fixed, $orig[1];
push @fixed, $orig[2];
push @fixed, $orig[0];
my $newday;
$newday = &day(@fixed);
use Date::Day;
my $display_date = "$orig[1]-$orig[2]-$orig[0]";
my $STM_day = &day(@fixed); # 3 or 4 letter day !!Date::Day needs array mm,dd,yyyy ###
my $ID_day;
$ID_day = qq[]; # for anchor;
say $FH_out <<__DAYDIVIDER__;
';
### End of program
close $FH_out;
=head TBD:
make html table of events by type of event by:
SELECT link_id, item, type FROM events ORDER BY type;
40|Collimation and Maintenance of a Cassegrain-Type System|A
41|Taking ATM Techniques To The APO Level|A
...
12|Hartness House Workshop: Sub-Arcsecond Spatial Resolution Imaging|W
44|Stellafane New Horizons Project|Y
45|’Scope Making For Teens|Y
.... (and, similarly, a table of 'types)...