Kazuhiro Sera > Text-CSV-BulkData-0.06 > Text::CSV::BulkData

Download:
Text-CSV-BulkData-0.06.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.06   Source  

NAME ^

Text::CSV::BulkData - generate csv file with bulk data

SYNOPSIS ^

  use Text::CSV::BulkData;

  my $output_file_1 = "/your/dir/example.dat";
  my $format_1 = "0907000%04d,JPN,160-%04d,type000%04d,0120444%04d,2008041810%02d00,2008041811%02d00\n";
  my $pattern_1 = [undef,'*2*2','-2','*2+1','%60-1','%60-40'];

  my $gen = Text::CSV::BulkData->new($output_file_1, $format);

  my $pattern_1 = [undef,'*2','-2','*2+1'];
  $gen->initialize
      ->set_pattern($pattern_1)
      ->set_start(59)
      ->set_end(62)
      ->make;

  my $output_file_2 = "/your/dir/yetanotherfile.dat";
  my $format_2  = "0907000%04d,JPN,160-%04d,type000%04d,0120444%04d,20080418%02d0000,20080419%02d0000\n";
  my $pattern_2 = [undef,'/10','*3/2','%2', '%24-1','23'];

  $gen->set_output_file($output_file_2)
      ->set_format($format_2)
      ->set_pattern($pattern_2)
      ->set_start(239)
      ->set_end(241)
      ->make;

This sample generates following csv file.

/your/dir/example.dat

  09070000059,JPN,160-0236,type0000057,01204440119,20080418105800,20080418111900
  09070000060,JPN,160-0240,type0000058,01204440121,20080418105900,20080418112000
  09070000061,JPN,160-0244,type0000059,01204440123,20080418100000,20080418112100
  09070000062,JPN,160-0248,type0000060,01204440125,20080418100100,20080418112200

/your/dir/yetanotherfile.dat

  09070000239,JPN,160-0023,type0000358,01204440001,20080418220000,20080419230000
  09070000240,JPN,160-0024,type0000360,01204440000,20080418230000,20080419230000
  09070000241,JPN,160-0024,type0000361,01204440001,20080418000000,20080419230000

DESCRIPTION ^

Text::CSV::BulkData is a Perl module which generates csv files with bulk data.

You can modify incremented values with using addition(+), subtraction(-), multiplication(*), division(/) and residue(%).

Precedence of operators is '*', '/', '%', '+', '-'.

The right of the decimal point are truncated.

Beginning with no operators means fixed value(integer or string).

SEE ALSO ^

None

AUTHOR ^

Kazuhiro Sera, <webmaster@seratch.ath.cx>

COPYRIGHT AND LICENSE ^

Copyright (C) 2008 by Kazuhiro Sera

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: