Shinichiro Sato > Time-List-0.09 > Time::List::Rows

Download:
Time-List-0.09.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.09   Source   Latest Release: Time-List-0.12

NAME ^

Time::List::Rows - Perl extention to output time list

VERSION ^

This document describes Time::List::Rows version 0.09.

SYNOPSIS ^

    use Time::List;
    use Time::List::Constant;
    $start_time = "2013-01-01 00:00:00";
    $end_time = "2013-01-01 04:00:00";
    $time_list_rows = Time::List->new(
        input_strftime => '%Y-%m-%d %H:%M:%S',
        output_strftime => '%Y-%m-%d %H:%M:%S',
        time_unit => DAY ,
        output_type => ROWS ,
    )->get_list($start_time , $end_time);
    
    my $data = {
        "2013-01-01 00:00:00" => {id => 1 , name => 'aaa'},
        "2013-01-01 01:00:00" => {id => 2 , name => 'bbb'},
        "2013-01-01 02:00:00" => {id => 3 , name => 'ccc'},
        "2013-01-01 03:00:00" => {id => 4 , name => 'ddd'},
    };
    $time_list_rows->set_rows_from_datetime($data);

    # get array with data
    my $array = $time_list_rows->get_array();
    # [
    #   {output_time => "2013-01-01 00:00:00", id => 1 , name => 'aaa'},
    #   {output_time => "2013-01-01 01:00:00", id => 2 , name => 'bbb'},
    #   {output_time => "2013-01-01 02:00:00", id => 3 , name => 'ccc'},
    #   {output_time => "2013-01-01 03:00:00", id => 4 , name => 'ddd'},
    # ]

    # get hash with data
    my $hash = $time_list_rows->get_hash();
    # {
    #    "2013-01-01 00:00:00" => {id => 1 , name => 'aaa'},
    #    "2013-01-01 01:00:00" => {id => 2 , name => 'bbb'},
    #    "2013-01-01 02:00:00" => {id => 3 , name => 'ccc'},
    #    "2013-01-01 03:00:00" => {id => 4 , name => 'ddd'},
    # }

DESCRIPTION ^

    This module is create time list library

INTERFACE ^

Functions

set_rows_from_datetime

Two or more values are set. It is ignored when the date does not match.

    my $data = {
        "2013-01-01 00:00:00" => {id => 4 , name => 'aaa'},
        "2013-01-01 01:00:00" => {id => 5 , name => 'bbb'},
        "2013-01-01 02:00:00" => {id => 6 , name => 'ccc'},
        "2013-01-01 03:00:00" => {id => 7 , name => 'ddd'},
    };
    $time_list_rows->set_rows_from_datetime($data);

set_rows_from_unixtime

    # overwrite previous set_rows
    my $data = {
        1356966000 => {id => 1 , name => 'aaa'},
        1357052400 => {id => 2 , name => 'bbb'},
        1357138800 => {id => 3 , name => 'ccc'},
        1357225200 => {id => 4 , name => 'ddd'},
    };
    $time_list_rows->set_rows_from_unixtime($data);

set_row_from_datetime

    $time_list_rows->set_rows_from_datetime("2013-01-01 00:00:00" => {id => 4 , name => 'aaa'});

get_row_from_datetime

    my $row = $time_list_rows->get_rows_from_datetime("2013-01-01 00:00:00");
    # $row => {id => 4 , name => 'aaa'}

set_row_from_unixtime

    $time_list_rows->set_rows_from_unixtime(1356966000 => {id => 1 , name => 'aaa'});

get_row_from_unixtime

    my $row = $time_list_rows->get_rows_from_unixtime(1356966000);
    # $row => {id => 1 , name => 'aaa'}

get_array

    # get array with data
    my $array = $time_list_rows->get_array();
    # [
    #   {output_time => "2013-01-01 00:00:00", id => 1 , name => 'aaa'},
    #   {output_time => "2013-01-01 01:00:00", id => 2 , name => 'bbb'},
    #   {output_time => "2013-01-01 02:00:00", id => 3 , name => 'ccc'},
    #   {output_time => "2013-01-01 03:00:00", id => 4 , name => 'ddd'},
    # ]

get_hash

    # get hash with data
    my $hash = $time_list_rows->get_hash();
    # {
    #    "2013-01-01 00:00:00" => {id => 1 , name => 'aaa'},
    #    "2013-01-01 01:00:00" => {id => 2 , name => 'bbb'},
    #    "2013-01-01 02:00:00" => {id => 3 , name => 'ccc'},
    #    "2013-01-01 03:00:00" => {id => 4 , name => 'ddd'},
    # }

DEPENDENCIES ^

Perl 5.8.1 or later.

BUGS ^

All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT.

SEE ALSO ^

perl

AUTHOR ^

<<Shinichiro Sato>> <<<s2otsa59@gmail.com>>>

LICENSE AND COPYRIGHT ^

Copyright (c) 2013, <<Shinichiro Sato>>. All rights reserved.

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

syntax highlighting: