Apache-FastForward

 view release on metacpan or  search on metacpan

examples/basic/Demo.pm  view on Meta::CPAN

    
    my $user = $r->user();
    defined( $user ) or $user = 'anonymous';
        
    $r->send_http_header( 'text/plain' );

    # Template initialisation
    my $sheet = tie my %sheet, 'Apache::FastForward::Spreadsheet';
    my %csv_atr = (
        'quote_char'  => '"',
        'escape_char' => '"',
        'sep_char'    => ';',
        'binary'      => 1 );
 
    $sheet->LoadTemplate( '/var/www/demo/books.csv', \%csv_atr);
  
    $r->ParseBody();

    unless ( $r->IsDefinedTable( 'item', 'quantity' ) ){

	    print $sheet->DumpAsCSV( \%csv_atr );

examples/ebay/eBay.pm  view on Meta::CPAN

sub handler {
    
    my $r = Apache::FastForward->new( shift );

    $r->send_http_header( 'text/plain' );

    # Template initialisation
    my $sheet = tie my %sheet, 'Apache::FastForward::Spreadsheet';
    my %csv_atr = (
        'quote_char'  => '"',
        'escape_char' => '"',
        'sep_char'    => ';',
        'binary'      => 1 );
    
     
    $sheet->LoadTemplate( '/var/www/ebay/FF4eBay-tmpl--v4.csv', \%csv_atr);

    # If IP numbers in a sheet are used (eg for testing with VMware and/or dhcp) 
    # it can spare updating the template each time a dhcp lease ends
    my $c = $r->connection();
    my $local_addr = $c->local_addr();

lib/Apache/FastForward.pm  view on Meta::CPAN

#   [1] Input: $r for mod_perl subclassing ('r' or '_r' magic name)

    my $class = shift;
    my $r = shift;
     
    my $self = {};
    $self->{VERSION} = $VERSION;
    $self->{r} = $r; 
    $self->{csv} = Text::CSV_XS->new( {
                    'quote_char'  => '"',
                    'escape_char' => '"',
                    'sep_char'    => ';',
                    'binary'      => 1 } ); # Needed by encoding of non ASCI characters!
    $self->{tables} = undef;    
    bless ( $self, $class );
    return $self
}

sub ParseBody {

# Contract:

lib/Apache/FastForward/Spreadsheet.pm  view on Meta::CPAN

=head1 NAME

Apache::FastForward::Spreadsheet 

=head1 SYNOPSIS

 my $t1 = tie my %t1, 'Spreadsheet';
 
 my %csv_atr = (
        'quote_char'  => '"',
        'escape_char' => '"',
        'sep_char'    => ';',
        'binary'      => 1 );
 
 $t1->LoadTemplate( './t1.csv', \%csv_atr);
 
 $t1{'A3'} = 'BZDYL';
 print $t1{'3,1'};
 print $t1->DumpAsCSV( \%csv_atr );
 print $t2->RowCount(), "\n";
 



( run in 0.373 second using v1.01-cache-2.11-cpan-c21f80fb71c )