TStanley has asked for the wisdom of the Perl Monks concerning the following question:

After a six year dry spell, I once again come before my brothers and sisters to seek help :)

I now have a project in front of me to read in a number of csv files from our system, then produce a single report of some kind, either in HTML or a csv format. I was leaning towards HTML, since I would be able to format results into a table and highlight a table cell that has a value that is not in line with our best practice specifications.

I am looking for suggestions on what modules I should be using to make this task as painless as possible. I haven't touched the perl interpreter in all this time, so I have my trusty Camel book right next to me to look up anything I have forgotten. And as always, thank you for any pointers in the right direction.


TStanley
--------
The only thing necessary for evil to flourish is for good men to do nothing -- Edmund Burke

Replies are listed 'Best First'.
Re: Module Recommendations
by choroba (Cardinal) on Jan 31, 2024 at 15:04 UTC
    I'd probably use Text::CSV_XS for reading the input and Template to output the HTML table.

    I usually keep an array of values plus coordinates of cells to highlight, so I can also output a plain text table with colour highlighting, using Text::Table and Term::ANSIColor.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
Re: Module Recommendations
by marto (Cardinal) on Jan 31, 2024 at 15:26 UTC

    At work I deliver high performance reporting, a Mojolicious::Lite app queries the database via user provided params, returning the data as json to the frontend (HTML5 Mojo template + Datatables.js). Not only is it super performant, it lets the end user sort by column, filter the results grid, remove columns and select rows to export as Excel, csv or PDF (example).

    Update: fat thumbs/typos

    Update 2: see DBD::CSV for a method to query your CSV file, if appropriate.

Re: Module Recommendations
by Anonymous Monk on Jan 31, 2024 at 15:05 UTC
    warnings, strict, Text::CSV, HTML::Tiny

    but HTML is not a data interchange format, use CSV output instead and add a new column "quality" or sth that is machine-readable

      HTML is not a data interchange format

      Absolutely this. By all means provide an HTML page of output as fancy and interactive as you like but also output the data in a format which can easily be parsed such as CSV, JSON, etc. Future you will be very happy you did.


      🦛

Re: Module Recommendations
by NERDVANA (Priest) on Jan 31, 2024 at 19:26 UTC
Re: Module Recommendations
by Bod (Parson) on Jan 31, 2024 at 15:16 UTC

    The first modules I would try are:

    Text::CSV::Simple to read the input
    Template to produce the output as HTML
    of PDF::API2 if I wanted PDF output...but that's a bit trickier.

    Update - all of the above I have used successfully for this kind of task within the last 12 months.