Retry: With the script test.pl given below

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

#!/usr/bin/perl -w
use strict;
use warnings;
use Config::YAML::Tiny;
use Dbc::Schema;

my $usage=<<END;
usage $0 config_file
END
die $usage unless ($ARGV[0]);


my ($s, $conf ) = get_schema($ARGV[0]); 

        my $href2 = {
                  '+select' => ['ComUser.nom' , 'ComCred.nom_credit'], 
                        '+as' => [qw/nom nom_credit/],
                  order_by => 't_create', 
                  join => ['ComCred', 'ComUser']};


        my $href = {id_commande => {'<' => 60}};

my $rs1 = $s->resultset('Commande')->search_rs($href, $href2);
my $i;
while ( my $doc = $rs1->next) {
        print "user: ", $doc->get_column('nom'), " credit : ", 
$doc->get_column('nom_credit'), " titre: ", $doc->get_column('titre'), "\n";
        #last if ($i++ == 3);

}

print "count1:  ", $rs1->count , "\n";

sub get_schema {
        my $config = shift;
         my $cfg = Config::YAML::Tiny->new(config=>$config);
        my $dsn = $cfg->get_dsn . ";" . $cfg->get_database . ";" . 
($cfg->get_socket?$cfg->get_socket:"");
        #$dsn = 
"DBI:mysql:host=localhost;database=dokpe_i02;mysql_socket=/opt/lampp/var/mysql/mysql.sock";
        my $gladefiles;

        if ($ENV{PAR_TEMP}){
                $gladefiles = $ENV{PAR_TEMP}. "/inc/" . $cfg->get_gladefiles;
                $cfg->set_gladefiles($gladefiles);    
        }

        #$globals->{ConnectionName}= $conn->{Name};
        my $s =  Dbc::Schema->connect(
                $dsn,
                $cfg->get_usr,
                $cfg->get_psw,
                      {
                PrintError => 0,
                RaiseError => 1,
                AutoCommit => 1,
                mysql_enable_utf8=>1
            }
        );
        return ($s, $cfg);
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

and

U:\docs\perl\dokpe_i02_dbc>pp -v 3 -o test test.pl


I got
C:\strawberry\perl\site\bin/pp: Packing test.pl
C:\strawberry\perl\site\bin/pp: Writing PAR on 
C:\Users\rappazf\LOCALS~1\Temp\ppYSfpk.par

... and things stop here.

Thanks for any help on packaging this.

François

> -----Original Message-----
> From: RAPPAZ Francois [mailto:francois.rap...@unifr.ch]
> Sent: vendredi, 8. août 2014 16:50
> To: par@perl.org
> Subject: packaging a script that uses DBIx::Class
> 
> Hi
> 
> I wrote an application using DBIx::Class to access data on mysql. The
> script work well (atlast) but the packaging with pp hangs: the "pp:
> Writing PAR on C:\Users\ ... " when verbose is on stay for 20 minutes,
> whereas the same application using sql and DBI is packed in a few
> minutes.
> 
> I suspect it's because DBIC use a lot of "use base '...'" and
> "__PACKAGE__->load_namespaces()" commands
> 
> My script calls "use Dbc::Schema;"
> 
> which is the only call to the Dbix::Class stuff.
> 
> The Dbc/Schema.pm file is 7 lines long:
> 
> use utf8;
> package Dbc::Schema;
> use strict;
> use warnings;
> use base 'DBIx::Class::Schema';
> __PACKAGE__->load_namespaces;
> __PACKAGE__->load_namespaces(  default_resultset_class => 'ResultSet',
> );
> 
> 
> My call to pp is basically
> 
> set file=cmd_dokpe_dbc
> set dir=dokpe_i02_dbc
> set inputfile=cmdui.pl
> pp -v 3 -B -a glade -I C:\strawberry\c\bin\ @ppopts.txt -o %file%.par
> %inputfile%
> 
> Thanks for any advices on correcting this (I'm on w7)
> 
> François Rappaz
> 
> Centre de documentation de la Faculté des Sciences Université de
> Fribourg DokPe - Dokumentationszentrum der Naturwissenschaftlichen
> Fakultät Universität Freiburg Pérolles CH-1700 Fribourg Switzerland
> http://www.unifr.ch/dokpe/
> Tel.: 41 (0)26 300 92 60
> Fax.: 41 (0)26 300 97 30
> 
> 

Reply via email to