LRpt

 view release on metacpan or  search on metacpan

lib/LRpt/XMLReport.pm  view on Meta::CPAN

  

=head1 COMMAND LINE SWITCHES

=over 4

=item --selects=file

Optional. Name of a selects file (see doc). They are included in the 
report for a select of corresponding name. If selects are not given, report
will not contain selects.

=item --diffs

Switches working mode to read output of B<lcsvdiff.pl>. If not given
the working mode is reading I<csv> files from a directory

=item --keys_file=keys_file

File name containing row key definitions.

=back

=head1 HOW IS THIS MANUAL ORGANIZED

On this page you will find details on C<LRpt::XMLReport> package. You also find
details on how to use B<LReport> tools for reporting. 

Firstly you will find a list all methods provided by the class.

Then I will show you a step by step example, in which I will explain you
what can be done and how it can be done. 

Then I will give some additional details, which I did not include in
the example to avoid making it too complex.

On the end I will describe existing XSLT stylesheets for converting I<XML>
reports to other formats. Currently only conversion to RTF is available.

=head1 METHODS

In this sections you will find a more or less complete listing of all
methods provided by the package. 

=cut

########################################################################

=head2 C<create_report>

  create_report( @ARGV );

Main public function. The only one exported. See 
L</COMMAND LINE SWITCHES> for meaning of parameters.

=cut

########################################################################
sub create_report
{
    local ( @ARGV ) = @_;
    my @key       = ();
    my @key_cols  = ();
    my $keys_file;
    my $global_keys;
    my $help = "";
    GetOptions( "selects=s" => \$stmt_fname,
                "diffs" => \$diffs,
                "help" => \$help,
                "key=s"      => \@key,
                "key_cols=s"  => \@key_cols,
                "keys_file=s" => \$keys_file,
                "global_keys" =>  \$global_keys );

    if( $help ){
        print_usage();
    }

    if( @key or $keys_file or @key_cols ){
        $rkeys_rdr = LRpt::RKeysRdr->new( 'fname'    => $keys_file,
                                      'key'      => \@key,
                                      'key_cols' => \@key_cols,
                                      'global_keys' => $global_keys );
    }

    if( $diffs ){
        load_diffs();
    }else{
        load_csvs();
    }
    generate_report();
    print "\n";
}

########################################################################

=head2 C<load_diffs>

  load_diffs();

Loads input data from files generated by L<C<LRpt::CSVDiff>|LRpt::CSVDiff>
module.

=cut

########################################################################
sub load_diffs
{
    my $line = undef;
    my $file = "";
    my $config = LRpt::Config->new();
    my $ext = $config->get_value( 'ext' );
    MAIN: while( $line = <> ){
        if( $line =~ /lcsvdiff (\S+) (\S+)/ ){
            $file = $1;
            my $name = basename( $file );
            $name =~ s/\.$ext$//; 
            $line = load_one_select( $name );
            redo MAIN;
        }elsif( !$line ){
            return;



( run in 1.455 second using v1.01-cache-2.11-cpan-ceb78f64989 )