Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    Data::Tabular::Dumper 0.08

    Download button

    No screenshots available
    Downloads: 344  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Philip Gwyn | More programs
    Perl Artistic License / FREE
    July 20th, 2009, 06:59 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Data::Tabular::Dumper description

    Seamlessly dump tabular data to XML, CSV and XLS

    Data::Tabular::Dumper is a Perl module that aims to make it easy to turn tabular data into as many file formats as possible. This is useful when you need to provide data that folks will then process further. Because you don't really know what format they want to use, you can provide as many as possible, and let them choose which they want.

    Tabular data means data that has 2 dimensions, like a list of lists, a hash of lists, a list of hashes or a hash of hashes.

    You may also dump 3 dimentional data; in this case, each of the top-level elements are called pages and each sub-element is independent.

    While it might seem desirable to give an example for each data type, this would be onerous to maintain. Please look at the tests to see what a given data object yields.

    SYNOPSIS

     use Data::Tabular::Dumper;

     $date=strftime('%Y%m%d', localtime);

     my $dumper = Data::Tabular::Dumper->open(
     XML => [ "$date.xml", "data" ],
     CSV => [ "$date.csv", {} ],
     Excel => [ "$date.xls" ]
     );

     # $data is a 2-d or 3-d data structure
     $data = {
     '0-monday' => { hits=>30, misses=>5, GPA=>0.42 },
     '1-tuesday' => { hits=>17, misses=>3, GPA=>0.17 },
     };

     $dumper->dump( $data );


     ## If you want more control :
     $dumper->page_start( "My Page" );

     # what each field is called
     $dumper->fields([qw(uri hits bytes)]);

     # now output the data
     foreach my $day (@$month) {
     $dumper->write($day);
     }

     $dumper->page_end( "My Page" );
     # sane shutdown
     $dumper->close();


    This would produce the following XML :

     < ?xml version="1.0" encoding="iso-8859-1"? >
     < access >
     < My_Page >
     < page >
     < uri >/index.html< /uri >
     < hits>4000
     < bytes >5123412< /bytes >
     < /page >
     < page >
     < uri >/something/index.html< /uri >
     < hits >400< /hits >
     < bytes >51234< /bytes >
     < /page >
     < /My_Page >
     < !-- more page tags here -- >
     < /access >



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    tabular data | dump tabular data | Perl module | Perl | tabular | data

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM