| 1 | # perl | ||
| 2 | # | ||
| 3 | # Minimal report example, data rows given as hash reference | ||
| 4 | # | ||
| 5 | # PORF Perl Open Report Framework | ||
| 6 | # | ||
| 7 | # Ralf Peine, Wed May 14 10:39:48 2014 | ||
| 8 | # | ||
| 9 | #------------------------------------------------------------------------------ | ||
| 10 | |||
| 11 | use warnings; | ||
| 12 | use strict; | ||
| 13 | |||
| 14 | use Report::Porf::Framework; | ||
| 15 | |||
| 16 | sub run_example { | ||
| 17 | my $person_rows = shift; # Param1: Reference to list of hashes | ||
| 18 | my $format = shift; # Param2: Optional: format of report | ||
| 19 | |||
| 20 | $format = 'text' unless $format; | ||
| 21 | |||
| 22 | my $count_rows = scalar @{$person_rows}; | ||
| 23 | my $out_file_name = "result_presentation_mini_${count_rows}.${format}"; | ||
| 24 | |||
| 25 | # --- Write A Report In 4+n Statements ! --------------------------- | ||
| 26 | |||
| 27 | my $report_framework = Report::Porf::Framework::get(); | ||
| 28 | my $report = $report_framework->create_report($format); | ||
| 29 | |||
| 30 | $report->configure_column (-header => 'Vorname', -value_named => 'Prename' ); | ||
| 31 | $report->conf_col (-h => 'Nachname', -val_nam => 'Surname'); | ||
| 32 | $report->cc (-h => 'Alter', -vn => 'Age'); | ||
| 33 | |||
| 34 | $report->configure_complete(); | ||
| 35 | $report->write_all($person_rows, $out_file_name); | ||
| 36 | |||
| 37 | # --- return count of entries --------------------------- | ||
| 38 | |||
| 39 | return ($count_rows); | ||
| 40 | } | ||
| 41 | |||
| 42 | 1; |