1DateTime::TimeZone::LocUasle(r3)Contributed Perl DocumenDtaatteiToinme::TimeZone::Local(3)
2
3
4

NAME

6       DateTime::TimeZone::Local - Determine the local system's time zone
7

VERSION

9       version 1.70
10

SYNOPSIS

12         my $tz = DateTime::TimeZone->new( name => 'local' );
13
14         my $tz = DateTime::TimeZone::Local->TimeZone();
15

DESCRIPTION

17       This module provides an interface for determining the local system's
18       time zone. Most of the functionality for doing this is in OS-specific
19       subclasses.
20

USAGE

22       This class provides the following methods:
23
24   DateTime::TimeZone::Local->TimeZone()
25       This attempts to load an appropriate subclass and asks it to find the
26       local time zone. This method is called by when you pass "local" as the
27       time zone name to "DateTime:TimeZone->new()".
28
29       If your OS is not explicitly handled, you can create a module with a
30       name of the form "DateTime::TimeZone::Local::$^O". If it exists, it
31       will be used instead of falling back to the Unix subclass.
32
33       If no OS-specific module exists, we fall back to using the Unix
34       subclass.
35
36       See DateTime::TimeZone::Local::Unix, DateTime::TimeZone::Local::Win32,
37       and DateTime::TimeZone::Local::VMS for OS-specific details.
38

SUBCLASSING

40       If you want to make a new OS-specific subclass, there are several
41       methods provided by this module you should know about.
42
43   $class->Methods()
44       This method should be provided by your class. It should provide a list
45       of methods that will be called to try to determine the local time zone.
46
47       Each of these methods is expected to return a new "DateTime::TimeZone"
48       object if it determines the time zone.
49
50   $class->FromEnv()
51       This method tries to find a valid time zone in an %ENV value. It calls
52       "$class->EnvVars()" to determine which keys to look at.
53
54       To use this from a subclass, simply return "FromEnv" as one of the
55       items from "$class->Methods()".
56
57   $class->EnvVars()
58       This method should be provided by your subclass. It should return a
59       list of env vars to be checked by "$class->FromEnv()".
60
61   $class->_IsValidName($name)
62       Given a possible time zone name, this returns a boolean indicating
63       whether or not the name looks valid. It always return false for "local"
64       in order to avoid infinite loops.
65

EXAMPLE SUBCLASS

67       Here is a simple example subclass:
68
69         package DateTime::TimeZone::SomeOS;
70
71         use strict;
72         use warnings;
73
74         use base 'DateTime::TimeZone::Local';
75
76
77         sub Methods { qw( FromEnv FromEther ) }
78
79         sub EnvVars { qw( TZ ZONE ) }
80
81         sub FromEther
82         {
83             my $class = shift;
84
85             ...
86         }
87

AUTHOR

89       Dave Rolsky <autarch@urth.org>
90
92       This software is copyright (c) 2014 by Dave Rolsky.
93
94       This is free software; you can redistribute it and/or modify it under
95       the same terms as the Perl 5 programming language system itself.
96
97
98
99perl v5.16.3                      2014-06-01      DateTime::TimeZone::Local(3)
Impressum