ww has asked for the wisdom of the Perl Monks concerning the following question:
Problem (between my ears, no doubt): a runtime error not caught with perl -c FN:
C:\>perl -c D:\_STM_work\htmFROMstm16(sms+).pl D:\_STM_work\htmFROMstm16(sms+).pl syntax OK C:\>D:\_STM_work\htmFROMstm16(sms+).pl Global symbol "$skedhash" requires explicit package name (did you forg +et to declare "my $skedhash"?) at D:\_STM_work\htmFROMSTM16.pl line 65. BEGIN not safe after errors--compilation aborted at D:\_STM_work\htmFROMSTM16.pl line 66.
code (irrelevant lines redacted for brevity):
#! /usr/bin/perl use warnings; use strict; use feature qw'say'; use DBI; my ($link_id, $events_item, $events_type, $events_longdesc, $starttime +, $endtime, $location, $who, $note, $extra, %skedhash, $skedhash); # %skedhash & $skedhash declared! my $FH_out; # get data from db # LN12 ... (irrelevant) $select->execute or die $DBI::errstr; # Create html #LN27 # ... (irrelevant) sub sked { #LN44 no warnings "uninitialized"; %skedhash = @_; say "In sub 'sked'"; say "LN50: \$link_id, \$events_item, \$events_type, \$starttime, \$endtime, \$location, \$who, \$note, \$extra: $skedhash{'li +nk_id'}, $skedhash{'events_item'}, $skedhash{'starttime'}, $skedhash{ +'endtime'}, $skedhash{'where'}, $skedhash{'who'}, \n $skedhash{'note'}, +\n $skedhash{'extra'} $skedhash{'events_longdesc'} \n"; if ($skedhash{'who'} ne '') { $skedhash{'who'} = 'Hosted by ' . $skedhash{'who'}; } print $FH_out "<tr> <td><b>$skedhash{'$events_item'} </b> <i>$skedhash{'$events_type'} </i> $skedhash +{'who'}<br> $skedhash{'starttime'} - $skedhash{'endtime'} $skedhash{'location'} </td> <td><b>$skedhash{'events_longdesc'}</b></td> </tr>"; use warnings "all"; } ### END sub sked() ######## my $sql = qq/SELECT events.link_id, events.item, events.type, events.l +ongdesc, times.starttime, times.endtime, times.location, times.who +, times.note, times.extra FROM events, times WHERE events.link_id = times.link_id ORDER BY starttime/; # LN65 my $sth = $db->prepare($sql); # LN66 $sth->execute(); while ( my ($events_link_id, $events_item, $events_type, $events_longd +esc, $starttime, $endtime, $location, $who, $note, $extra) = $sth->fetchrow_array ) { my %skedrow = ( 'events_link_id' => $events_link_id, 'events_item' => $events_item, 'events_type' => $events_type, 'events_longdesc' => $events_longdesc, 'starttime' => $starttime, 'endtime' => $endtime, 'location' => $location, 'who' => $who, 'note' => $note, 'extra' => $extra ); ....
Maybe it's too much Christmas cheer, but the headache here is too early to be a hangover.
But I did!!!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: runtime error not caught by compilation check???
by LanX (Saint) on Dec 26, 2016 at 03:27 UTC | |
|
Re: runtime error not caught by compilation check???
by ww (Archbishop) on Dec 26, 2016 at 14:37 UTC | |
by LanX (Saint) on Dec 26, 2016 at 14:55 UTC | |
|
Re: runtime error not caught by compilation check???
by beech (Parson) on Dec 26, 2016 at 03:29 UTC | |
|
Re: runtime error not caught by compilation check???
by Marshall (Canon) on Dec 26, 2016 at 03:44 UTC | |
|
Re: runtime error not caught by compilation check???
by ww (Archbishop) on Jan 01, 2017 at 12:48 UTC |