On 10 September 2016 at 15:48, Norbert Preining <[email protected]> wrote: > On Sat, 10 Sep 2016, Gavin Smith wrote: >> sub expand_today($) >> { >> my $self = shift; >> if ($self->get_conf('TEST')) { >> return {'text' => 'a sunny day'}; >> } >> my($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) >> = localtime(time); >> $year += ($year < 70) ? 2000 : 1900; >> return $self->gdt('{month} {day}, {year}', >> { 'month' => $self->gdt($MONTH_NAMES[$mon]), >> 'day' => $mday, 'year' => $year }); >> } > > Indeed, this is really strange. > >> >> This is perl 5, version 18, subversion 1 (v5.18.1) built for > > 5.22 here, but running a test file: > #!/usr/bin/perl > > $^W = 1; > use strict; > > sub expand_today($) > { > my $self = shift; > my($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) > = localtime(time); > $year += ($year < 70) ? 2000 : 1900; > return $year; > } > > my $foo = expand_today(42); > print "returned $foo\n"; > > did work without any problem. So maybe there is something protecting > $year in the way it is called? > > I have absolutely no idea, sorry.
Could you try editing the "expand_today" function in tp/Texinfo/Common.pm and change the name of the $year variable, for example to $yearxx, and see if you get an error message like Global symbol "$yearxx" requires explicit package name ?
