# Copyright 2009 Kevin Ryde
# This file is part of Tie-TZ.
#
# Tie-TZ is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3, or (at your option) any later
# version.
#
# Tie-TZ is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with Tie-TZ. If not, see .
package Test::POSIX::TzsetNotImplemented;
use strict;
use warnings;
use POSIX ();
sub Test::POSIX::TzsetNotImplemented_tzset {
require Carp;
Carp::croak("POSIX::tzset not implemented on this architecture");
}
# POSIX.xs doesn't autoload its funcs does it? only its constants?
# Give tzset() an initial run just in case.
eval { POSIX::tzset() };
{ no warnings 'redefine';
*POSIX::tzset = \&Test::POSIX::TzsetNotImplemented_tzset;
}
1;
=head1 NAME
Test::POSIX::TzsetNotImplemented - fake POSIX::tzset "not implemented"
=head1 SYNOPSIS
perl -Idevel -MTest::POSIX::TzsetNotImplemented ...
=head1 DESCRIPTION
B
C sets C to a fake
function which croaks with
POSIX::tzset not implemented on this architecture
as per the error you get on old systems without C. The idea is to
exercise code which might depend on C or adapt itself to that
function not available.
Even in the absense of C it's possible setting C<$ENV{'TZ'}> still
influences the timezone, in fact that's so on most systems. So
C doesn't stop timezones working
altogether, just the C function.
You must have C<-MTest::POSIX::TzsetNotImplemented> or C