deprecated/buildtools/buildsystemtools/lib/XML/XQL/Date.pm
author kelvzhu
Wed, 27 Oct 2010 16:03:51 +0800
changeset 662 60be34e1b006
parent 655 3f65fd25dfd4
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
655
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     1
############################################################################
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     2
# Copyright (c) 1998 Enno Derksen
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     3
# All rights reserved.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     4
# This program is free software; you can redistribute it and/or modify it
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     5
# under the same terms as Perl itself. 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     6
############################################################################
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     7
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     8
package XML::XQL::Date;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     9
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    10
use vars qw(@ISA);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    11
@ISA = qw( XML::XQL::PrimitiveType );
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    12
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    13
use strict;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    14
use Carp;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    15
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    16
BEGIN
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    17
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    18
    # Date::Manip relies on setting of $TZ. 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    19
    unless (defined $ENV{TZ})
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    20
    {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    21
	$ENV{TZ} = "EST5EDT";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    22
	warn "XML::XQL::Date - setting timezone \$ENV{TZ} to EST5EDT (east coast USA.) Set your TZ environment variable to avoid this message.";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    23
    }
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    24
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    25
use Date::Manip;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    26
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    27
BEGIN {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    28
    # add date() implementation to XQL engine.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    29
    XML::XQL::defineFunction ("date", \&XML::XQL::Date::date, 1, 1, 1);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    30
};
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    31
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    32
use overload 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    33
    'fallback' => 1,		# use default operators, if not specified
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    34
    '<=>' => \&compare,		# also takes care of <, <=, ==, != etc.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    35
    'cmp' => \&compare,		# also takes care of le, lt, eq, ne, etc.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    36
    '""'  => \&yyyymmddhhmmss;	# conversion to string uses yyyymmddhhmmss
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    37
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    38
sub new
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    39
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    40
    my $class = shift;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    41
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    42
    my (%args);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    43
    if (@_ < 2)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    44
    {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    45
	my $str = @_ ? $_[0] : "";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    46
	%args = (String => $str);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    47
    }
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    48
    else
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    49
    {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    50
	%args = @_;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    51
    }
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    52
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    53
    my $self = bless \%args, $class;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    54
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    55
    if (@_ < 2)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    56
    {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    57
	my $date = $self->createInternal (@_ ? $_[0] : "now");
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    58
	$date = "" unless isValidDate ($date);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    59
	$self->{Internal} = $date;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    60
    }
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    61
    $self;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    62
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    63
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    64
sub createInternal
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    65
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    66
    my ($self, $str) = @_;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    67
    Date::Manip::ParseDate ($str);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    68
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    69
# From Date::Manip:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    70
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    71
# 2 digit years fall into the 100 year period given by [ CURR-N,
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    72
# CURR+(99-N) ] where N is 0-99.  Default behavior is 89, but other useful
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    73
# numbers might be 0 (forced to be this year or later) and 99 (forced to be
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    74
# this year or earlier).  It can also be set to "c" (current century) or
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    75
# "cNN" (i.e.  c18 forces the year to bet 1800-1899).  Also accepts the
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    76
# form cNNNN to give the 100 year period NNNN to NNNN+99.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    77
#$Date::Manip::YYtoYYYY=89;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    78
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    79
# Use this to force the current date to be set to this:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    80
#$Date::Manip::ForceDate="";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    81
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    82
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    83
sub isValidDate		# static method
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    84
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    85
    my ($date) = @_;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    86
    return 0 unless defined $date;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    87
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    88
    my $year = substr ($date, 0, 4) || 0;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    89
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    90
    $year > 1500;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    91
#?? arbitrary limit - years < 100 cause problems in Date::Manip
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    92
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    93
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    94
sub ymdhms
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    95
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    96
    my $self = shift;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    97
    if (@_)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    98
    {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    99
	my ($y, $mon, $d, $h, $m, $s) = @;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   100
#?? implement
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   101
    }
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   102
    else
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   103
    {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   104
#?? test: x skips a character. Format: "YYYYMMDDhh:mm::ss"
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   105
	return () unless length $self->{Internal};
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   106
#	print "ymhds " . $self->{Internal} . "\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   107
	unpack ("A4A2A2A2xA2xA2", $self->{Internal});
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   108
    }
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   109
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   110
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   111
sub yyyymmddhhmmss
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   112
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   113
    my ($self) = @_;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   114
    my ($y, $mon, $d, $h, $m, $s) = $self->ymdhms;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   115
    
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   116
    $y ? "$y-$mon-${d}T$h:$m:$s" : "";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   117
    # using Date::Manip::UnixDate is a bit too slow for my liking
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   118
#?? could add support for other formats
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   119
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   120
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   121
sub xql_toString
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   122
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   123
#?? use $_[0]->{String} or 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   124
    $_[0]->yyyymmddhhmmss;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   125
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   126
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   127
sub xql_compare
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   128
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   129
    my ($self, $other) = @_;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   130
    my $type = ref ($self);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   131
    if (ref ($other) ne $type)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   132
    {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   133
	my $str = $other->xql_toString;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   134
	# Allow users to plug in their own Date class
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   135
	$other = eval "new $type (\$str)";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   136
#?? check result?
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   137
    }
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   138
#print "date::compare self=" . $self->{Internal} . " other=" . $other->{Internal}. "\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   139
    $self->{Internal} cmp $other->{Internal};
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   140
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   141
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   142
sub xql_setSourceNode
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   143
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   144
    $_[0]->{SourceNode} = $_[1];
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   145
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   146
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   147
sub xql_sourceNode
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   148
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   149
    $_[0]->{SourceNode};
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   150
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   151
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   152
sub xql_setValue
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   153
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   154
    my ($self, $val) = @_;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   155
    $self->{Internal} = $self->createInternal ($val);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   156
    $self->{String} = $val;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   157
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   158
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   159
# The XQL date() function
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   160
sub date	# static method
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   161
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   162
    my ($context, $listref, $text) = @_;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   163
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   164
    $text = XML::XQL::toList ($text->solve ($context, $listref));
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   165
    my @result = ();
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   166
    for my $val (@$text)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   167
    {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   168
	# Using xql_new allows users to plug-in their own Date class
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   169
	my $date = XML::XQL::xql_new ("date", $val->xql_toString);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   170
#	print "date $val " . XML::XQL::d($val) . " " . $date->xql_toString . "\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   171
	push @result, $date;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   172
    }
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   173
    \@result;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   174
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   175
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   176
1; # module return code
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   177
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   178
__END__
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   179
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   180
=head1 NAME
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   181
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   182
XML::XQL::Date - Adds an XQL::Node type for representing and comparing dates and times
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   183
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   184
=head1 SYNOPSIS
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   185
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   186
 use XML::XQL;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   187
 use XML::XQL::Date;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   188
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   189
 my $query = new XML::XQL::Query (Expr => "doc//timestamp[. < date('12/31/1999')]");
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   190
 my @results = $query->solve ($doc);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   191
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   192
=head1 DESCRIPTION
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   193
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   194
This package uses the L<Date::Manip> package to add an XQL node type 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   195
(called XML::XQL::Date) that can be used to represent dates and times. 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   196
The Date::Manip package can parse almost any date or time format imaginable.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   197
(I tested it with Date::Manip 5.33 and I know for sure that it doesn't work 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   198
with 5.20 or lower.)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   199
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   200
It also adds the XQL B<date> function which creates an XML::XQL::Date 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   201
object from a string. See L<XML::XQL::Tutorial> for a description of the date()
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   202
function.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   203
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   204
You can plug in your own Date type, if you don't want to use Date::Manip 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   205
 for some reason. See L<XML::XQL> and the XML::XQL::Date source file for
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   206
more details.