Johannes la Poutré > HTTP-WebTest-Plugin-DateTest > HTTP::WebTest::Plugin::DateTest

Download:
HTTP-WebTest-Plugin-DateTest-1.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.01   Source  

NAME ^

HTTP::WebTest::Plugin::DateTest - Evaluate the "age" of embedded date strings in response body

VERSION ^

 Version 1.01 - $Revision: 1.8 $

Compatible with HTTP::WebTest 2.x API

SYNOPSIS ^

Not Applicable - see HTTP::WEBTEST

DESCRIPTION ^

This plugin provides a test for the age of a date string inside the response body. It supports anything Date::Parse can parse. There is limited support for other locales for which a Date::Language::* module exist. The Date::Languge and Date::Parse modules are part of the TimeDate distribution, available from a CPAN near you.

TEST PARAMETERS ^

NOTE: The following parameters date_start, date_end and date_maxage are lists, so they should be specified in order for multiple date tests.

date_start

Text string which marks the start of a date string in the returned page. The date string should look like anything that Date::Parse is able to understand. Leading/trailing whitespace is no problem

date_end

Text string which marks the end of a date string in the returned page. The date string should look like anything that Date::Parse is able to understand. Leading/trailing whitespace is no problem

date_maxage

Maximum age of the parsed date string in seconds. This is evaluated against the current time at runtime.

Format: N [units]

where N is a (floating point-) number, followed by one of these unit specifiers (case insensitive):

  s(econds) - default
  m(inutes)
  h(ours)
  d(ays)
  w(eeks)

The default is seconds. Only the first character is relevant, any leading text is ignored. An unknown unit specifier defaults to seconds.

date_locale

Global parameter for all date tests.

Specify the language in which the date string is written. Locales are taken from Date::Language::(Locale) modules (part of Date::Parse). The value of date_locale is normalized to Capitalized notation, so this parameter is not case sensitive.

WARNING: this works by literally translating the date string components to their English names. This fails if the notational conventions are very different (order of day, month, year etc.)

There are languages where abbreviated day- and month names are the same, notably Mardi and Mars in French, and Maandag and Maart in Dutch.

To work around the resulting ambiguity, all non-numerical components are stripped from the left side of the date string. This works for the common case where a weekday starts the string, but doesn't in some other cases.

Example (this will work):

 date_locale = 'French'

 "Mar 19 Mars 2002, 17:25"
   => "19 Mars 2002, 17:25"
   => "19 Mar 2002, 17:25"

Example (this will fail for languages other than English):

 "Mar 19, 2002 17:25"
   => "19, 2002 17:25"
   => (not parsable)

Note: the last notation is very uncommon in Dutch, so this assumption is generally no problem for this locale. YMMV!

COPYRIGHT ^

Copyright (c) 2002,2003 Johannes la Poutre. All rights reserved.

This module is free software. It may be used, redistributed and/or modified under the terms of the Perl Artistic License.

SEE ALSO ^

Date::Parse

HTTP::WebTest

HTTP::WebTest::API

HTTP::WebTest::Plugin

HTTP::WebTest::Plugins

syntax highlighting: