Apache2-WebApp-Plugin-DateTime

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Perl module Apache2::WebApp::Plugin::DateTime

0.06
    - Migrated project SCM and code repository to Google Project hosting.
    - Updated POD and README artistic license URL in COPYRIGHT clause.
    - Changed each module version so that I can verify that the PAUSE packager/uploader script works as expected.
    - Updated license field in META.yml to fix 'License Unknown' issue on CPAN
    - Updated PREREQ_PM module versions in Makefile.PL
    - Updated module versions in META.yml requires field.

INSTALL  view on Meta::CPAN

Install this package from source:

  $ perl MakeFile.PL PREFIX=~/path/to/custom/dir LIB=~/path/to/custom/lib
  $ make
  $ make test
  $ make install


Perl one liner using CPAN.pm:

  $ perl -MCPAN -e 'install Apache2::WebApp::Plugin::DateTime'


Use of CPAN.pm in interactive mode:

  $ perl -MCPAN -e shell
  cpan> install Apache2::WebApp::Plugin::DateTime
  cpan> quit

Just like the manual installation of perl modules, the user may need root access
during this process to insure write permission is allowed within the intstallation
directory.


Install/Runtime issues (non-root)

Q. When running a script, I get the message "Can't locate loadable object for mod.."

MANIFEST  view on Meta::CPAN

INSTALL
LICENSE
MANIFEST
README
Changes
Makefile.PL
META.yml
lib/Apache2/WebApp/Plugin/DateTime.pm
t/001_load.t
t/002_basic.t
t/app/Basic/Test.pm
t/conf/extra.conf.in
t/conf/extra.last.conf.in
t/conf/startup.pl.in
t/conf/webapp.in
t/TEST.PL

META.yml  view on Meta::CPAN

--- #YAML:1.0
name: Apache2::WebApp::Plugin::DateTime
abstract: Common methods for dealing with Date/Time.
version: 0.07
author:
  - Marc S. Brooks <mbrooks@cpan.org>
license: perl
distribution_type: module
requires:
  Apache2::WebApp: 0.38
  Date::Calc: 5.4
  Date::Format: 2.22

Makefile.PL  view on Meta::CPAN


my @scripts = qw( t/TEST );

# accept the configs from command line
Apache::TestMM::filter_args();

# generate test scripts
Apache::TestMM::generate_script('t/TEST');

WriteMakefile(
    NAME         => 'Apache2::WebApp::Plugin::DateTime',
    VERSION_FROM => 'lib/Apache2/WebApp/Plugin/DateTime.pm', # finds \$VERSION
    AUTHOR       => 'Marc S. Brooks (mbrooks@cpan.org)',
    PREREQ_PM => {
        'Apache::Test'     => 0,
        'Apache2::WebApp'  => 0.38,
        'Date::Calc'       => 5.4,
        'Date::Format'     => 2.22,
        'Date::Manip'      => 5.54,
        'Params::Validate' => 0,
        'Time::ParseDate'  => 2003.0211,
    },

README  view on Meta::CPAN

NAME
    Apache2::WebApp::Plugin::DateTime - Plugin providing Date/Time methods

SYNOPSIS
      my $obj = $c->plugin('DateTime')->method( ... );     # Apache2::WebApp::Plugin::DateTime->method()

        or

      $c->plugin('DateTime')->method( ... );

DESCRIPTION
    Common methods for dealing with Date/Time.

PREREQUISITES
    This package is part of a larger distribution and was NOT intended to be
    used directly. In order for this plugin to work properly, the following
    packages must be installed:

      Apache2::WebApp
      Date::Calc
      Date::Format
      Date::Manip
      Params::Validate
      Time::ParseDate

INSTALLATION
    From source:

      $ tar xfz Apache2-WebApp-Plugin-DateTime-0.X.X.tar.gz
      $ perl MakeFile.PL PREFIX=~/path/to/custom/dir LIB=~/path/to/custom/lib
      $ make
      $ make test
      $ make install

    Perl one liner using CPAN.pm:

      $ perl -MCPAN -e 'install Apache2::WebApp::Plugin::DateTime'

    Use of CPAN.pm in interactive mode:

      $ perl -MCPAN -e shell
      cpan> install Apache2::WebApp::Plugin::DateTime
      cpan> quit

    Just like the manual installation of Perl modules, the user may need
    root access during this process to insure write permission is allowed
    within the installation directory.

OBJECT METHODS
  days_between_dates
    Return the total days between dates.

      my $date1 = 'Sun Oct 18 15:14:48 2009';     # then and
      my $date2 = localtime(time);                # now

      my $delta = $c->plugin('DateTime')->days_between_dates( $date1, $date2 );

  format_time
    Convert seconds-since-epoch to a human readable format.

      my $date = $c->plugin('DateTime')->format_time( $unix_time, '%a %b %d %T %Y' );

    See Date::Format for character conversion specification.

SEE ALSO
    Apache2::WebApp, Apache2::WebApp::Plugin, Date::Calc, Date::Format,
    Date::Manip, Params::Validate, Time::ParseDate

AUTHOR
    Marc S. Brooks, <mbrooks@cpan.org> - <http://mbrooks.info>

lib/Apache2/WebApp/Plugin/DateTime.pm  view on Meta::CPAN

#----------------------------------------------------------------------------+
#
#  Apache2::WebApp::Plugin::DateTime - Plugin providing Date/Time methods
#
#  DESCRIPTION
#  Common methods for dealing with Date/Time.
#
#  AUTHOR
#  Marc S. Brooks <mbrooks@cpan.org>
#
#  This module is free software; you can redistribute it and/or
#  modify it under the same terms as Perl itself.
#
#----------------------------------------------------------------------------+

package Apache2::WebApp::Plugin::DateTime;

use strict;
use base 'Apache2::WebApp::Plugin';
use Date::Calc qw( Date_to_Days Delta_Days Today );
use Date::Manip;
use Params::Validate qw( :all );
use POSIX qw( strftime );
use Time::ParseDate;

our $VERSION = 0.07;

lib/Apache2/WebApp/Plugin/DateTime.pm  view on Meta::CPAN

    my ( $self, $params ) = @_;
    return $self;
}

1;

__END__

=head1 NAME

Apache2::WebApp::Plugin::DateTime - Plugin providing Date/Time methods

=head1 SYNOPSIS

  my $obj = $c->plugin('DateTime')->method( ... );     # Apache2::WebApp::Plugin::DateTime->method()

    or

  $c->plugin('DateTime')->method( ... );

=head1 DESCRIPTION

Common methods for dealing with Date/Time.

=head1 PREREQUISITES

This package is part of a larger distribution and was NOT intended to be used 
directly.  In order for this plugin to work properly, the following packages
must be installed:

lib/Apache2/WebApp/Plugin/DateTime.pm  view on Meta::CPAN

  Date::Calc
  Date::Format
  Date::Manip
  Params::Validate
  Time::ParseDate

=head1 INSTALLATION

From source:

  $ tar xfz Apache2-WebApp-Plugin-DateTime-0.X.X.tar.gz
  $ perl MakeFile.PL PREFIX=~/path/to/custom/dir LIB=~/path/to/custom/lib
  $ make
  $ make test
  $ make install

Perl one liner using CPAN.pm:

  $ perl -MCPAN -e 'install Apache2::WebApp::Plugin::DateTime'

Use of CPAN.pm in interactive mode:

  $ perl -MCPAN -e shell
  cpan> install Apache2::WebApp::Plugin::DateTime
  cpan> quit

Just like the manual installation of Perl modules, the user may need root access during
this process to insure write permission is allowed within the installation directory.

=head1 OBJECT METHODS

=head2 days_between_dates

Return the total days between dates.

  my $date1 = 'Sun Oct 18 15:14:48 2009';     # then and
  my $date2 = localtime(time);                # now

  my $delta = $c->plugin('DateTime')->days_between_dates( $date1, $date2 );

=head2 format_time

Convert seconds-since-epoch to a human readable format.

  my $date = $c->plugin('DateTime')->format_time( $unix_time, '%a %b %d %T %Y' );

See L<Date::Format> for character conversion specification.

=head1 SEE ALSO

L<Apache2::WebApp>, L<Apache2::WebApp::Plugin>, L<Date::Calc>, L<Date::Format>,
L<Date::Manip>, L<Params::Validate>, L<Time::ParseDate>

=head1 AUTHOR

t/001_load.t  view on Meta::CPAN


use strict;
use warnings FATAL => 'all';

# t/001_load.t - check module loading

use Apache::Test qw( :withtestmore );
use Test::More;

BEGIN {
    use_ok('Apache2::WebApp::Plugin::DateTime');
}

my $obj = new Apache2::WebApp::Plugin::DateTime;

isa_ok( $obj, 'Apache2::WebApp::Plugin::DateTime' );

done_testing();

t/app/Basic/Test.pm  view on Meta::CPAN


use strict;
use warnings FATAL => 'all';

sub days_between_dates {
    my ( $self, $c ) = @_;

    my $date1 = 'Sun Oct 18 15:14:48 2009';
    my $date2 = 'Sat Oct 31 15:14:48 2009';

    my $delta = $c->plugin('DateTime')->days_between_dates( $date1, $date2 );

    $self->_success($c) if ($delta == 13);
}

sub format_time {
    my ( $self, $c ) = @_;

    my $result = $c->plugin('DateTime')->format_time('110811606', '%a %b %d %T %Y');

    $self->_success($c) if ($result eq 'Fri Jul 06 06:00:06 1973');
}

sub _success {
    my ( $self, $c ) = @_;

    $c->request->content_type('text/html');

    print "success";



( run in 0.417 second using v1.01-cache-2.11-cpan-05444aca049 )