1Date::Manip::Obj(3)   User Contributed Perl Documentation  Date::Manip::Obj(3)
2
3
4

NAME

6       Date::Manip::Obj - Base class for Date::Manip objects
7

SYNOPSIS

9       The Date::Manip::Obj class is the base class used for the following
10       Date::Manip classes:
11
12          Date::Manip::Base
13          Date::Manip::TZ
14          Date::Manip::Date
15          Date::Manip::Delta
16          Date::Manip::Recur
17
18       This module is not intended to be called directly and performs no
19       useful function by itself. Instead, use the various derived classes
20       which inherit from it.
21

DESCRIPTION

23       This module contains a set of methods used by all Date::Manip classes
24       listed above.
25
26       You should be familiar with the Date::Manip::Objects and
27       Date::Manip::Config documentation.
28
29       In the examples below, Date::Manip::Date objects will be used as
30       examples, but (unless otherwise stated), all of the classes listed
31       above have the same methods, and work in the same fashion.
32

METHODS FOR CREATING OBJECTS

34       new
35              $date = new Date::Manip::Date;
36              $date = new Date::Manip::Date \@opts;
37
38              $date = new Date::Manip::Date $string;
39              $date = new Date::Manip::Date $string,\@opts;
40
41           In order to create the first Date::Manip object, use any of the
42           forms listed above. They will all create a new Date::Manip::Date
43           object (with new Date::Manip::Base, and Date::Manip::TZ objects
44           embedded in it).
45
46           The Date::Manip::Date, Date::Manip::Delta, and Date::Manip::Recur
47           classes work in exactly the same way.
48
49           A set of options (described in the Date::Manip::Config
50           documentation) can be passed to the object to set configuration
51           variables.
52
53           In addition, a string can be passed in which will be parsed to form
54           the initial date stored in the object. Strings can also be passed
55           in to the Date::Manip::Delta and Date::Manip::Recur objects which
56           will be parsed to form initial values. In all cases, refer to the
57           parse method of the class.
58
59              $dmt = new Date::Manip::TZ;
60              $dmt = new Date::Manip::TZ \@opts;
61
62           If the first Date::Manip object you need is a Date::Manip::TZ
63           object, use either of the above calls. This will also create a
64           Date::Manip::Base object which will be embedded in the
65           Date::Manip::TZ object.
66
67           A set of options can be passed in as well, but there is no option
68           for passing in a string.
69
70              $dmb = new Date::Manip::Base;
71              $dmb = new Date::Manip::Base \@opts;
72
73           If you work with Date::Manip::Base objects directly, no other
74           object will be created. The options can be passed in here as well.
75
76           Once a Date::Manip::Date object (or any object in any other
77           Date::Manip class) is created, one of calls below should be used in
78           order to preserve cached data in the interest of performance and
79           memory usage.
80
81              $date = new Date::Manip::Date $obj;
82              $date = new Date::Manip::Date $obj,\@opts;
83
84              $date = new Date::Manip::Date $obj,$string;
85              $date = new Date::Manip::Date $obj,$string,\@opts;
86
87           $obj can be an object from any of the Date::Manip classes, but in
88           the interest of making efficient use of cached data, you should
89           pass in the highest level object available.
90
91           In other words, you should always pass in a Date::Manip::Date,
92           Date::Manip::Delta, or Date::Manip::Recur object if you have one.
93           In their absence, pass in a Date::Manip::TZ object. Pass in a
94           Date::Manip::Base object only if that is the only Date::Manip
95           object available.
96
97           The one caveat is if you are working with multiple configurations
98           as described in the Date::Manip::Objects document. In that case,
99           additional care should be taken to make sure that the correct
100           object is passed in.
101
102           If $obj is a Date::Manip::Date object, these lines can be expressed
103           equivalently as:
104
105              $date = $obj->new();
106              $date = $obj->new(\@opts);
107
108              $date = $obj->new($string);
109              $date = $obj->new($string,\@opts);
110
111           If @opts is passed in, new Date::Manip::Base and Date::Manip::TZ
112           objects will be created with the configuration specified, so you
113           should only do this if you explicitly want to work with multiple
114           configurations.
115
116           If you want to modify an existing configuration, you must use the
117           config method described below.
118
119       new_config
120              $obj2 = $obj1->new_config();
121              $obj2 = $obj1->new_config($string);
122              $obj2 = $obj1->new_config($string,@opts);
123              $obj2 = $obj1->new_config(@opts);
124
125           This creates a new instance with a new Date::Manip::Base object and
126           a separate set of config options (even if no config options are
127           included).
128
129       new_date
130       new_delta
131       new_recur
132              $date = $obj->new_date();
133              $date = $obj->new_date($string);
134              $date = $obj->new_date($string,@opts);
135              $date = $obj->new_date(@opts);
136
137           These create a new instance of the specified object. In this case,
138           $obj can be any of the Date::Manip classes, so a date can be
139           created from a delta:
140
141              $delta = new Date::Manip::Delta;
142              $date  = $delta->new_date();
143

OTHER METHODS

145       base
146              $dmb = $obj->base();
147
148           This returns the Date::Manip::Base object associated with the given
149           object.
150
151       config
152              $obj->config($var1,$val1,$var2,$val2,...);
153
154           This will set the value of any configuration variables. Please
155           refer to the Date::Manip::Config manual for a list of all
156           configuration variables and their description.
157
158       err
159              $err = $obj->err();
160
161           This will return the full error message if the previous operation
162           failed for any reason.
163
164              $obj->err(1);
165
166           will clear the error code.
167
168       is_date
169       is_delta
170       is_recur
171              $flag = $obj->is_date();
172
173           Returns 0 or 1, depending on the object. For example, a
174           Date::Manip::Date object returns 1 with the is_date method, and 0
175           for the other two.
176
177       tz
178              $dmb = $obj->tz();
179
180           This returns the Date::Manip::TZ object associated with the given
181           object.
182
183       version
184              $vers = $obj->version($flag);
185
186           This returns the version of Date::Manip.
187
188           If $flag is passed in, and $obj is not a Date::Manip::Base object,
189           the version and timezone information will be passed back.
190

KNOWN BUGS

192       None known.
193

BUGS AND QUESTIONS

195       Please refer to the Date::Manip::Problems documentation for information
196       on submitting bug reports or questions to the author.
197

SEE ALSO

199       Date::Manip        - main module documentation
200

LICENSE

202       This script is free software; you can redistribute it and/or modify it
203       under the same terms as Perl itself.
204

AUTHOR

206       Sullivan Beck (sbeck@cpan.org)
207
208
209
210perl v5.12.0                      2010-04-27               Date::Manip::Obj(3)
Impressum