CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
error messages

 



limner
Novice

Mar 12, 2014, 3:32 AM

Post #1 of 4 (2488 views)
error messages Can't Post

i've done a script but at the end it give me those errors (the work the script should do is well done, even the script gives those errors...)


Repl '' has gone away already at C:/strawberry/perl/site/lib/MozRepl/RemoteObject.pm line 1187 during global destruction.

Repl '' has gone away already at C:/strawberry/perl/site/lib/MozRepl/RemoteObject.pm line 1187 during global destruction.

Repl '' has gone away already at C:/strawberry/perl/site/lib/MozRepl/RemoteObject.pm line 1187 during global destruction.

Repl '' has gone away already at C:/strawberry/perl/site/lib/MozRepl/RemoteObject.pm line 1187 during global destruction.

(in cleanup) Can't call method "cmd" on an undefined value at C:/strawberry/perl/site/lib/MozRepl/Client.pm line 186 during global destruction.

(in cleanup) Can't call method "execute" on an undefined value at C:/strawberry/perl/site/lib/MozRepl.pm line 372 during global destruction.

(in cleanup) Can't call method "cmd" on an undefined value at C:/strawberry/perl/site/lib/MozRepl/Client.pm line 186 during global destruction.

(in cleanup) Can't call method "cmd" on an undefined value at C:/strawberry/perl/site/lib/MozRepl/Client.pm line 186 during global destruction.

(in cleanup) Can't call method "cmd" on an undefined value at C:/strawberry/perl/site/lib/MozRepl/Client.pm line 186 during global destruction.


Laurent_R
Veteran / Moderator

Mar 12, 2014, 3:09 PM

Post #2 of 4 (2286 views)
Re: [limner] error messages [In reply to] Can't Post

This seems to be happening during the final cleanup, once the script has completed. This is why you get your correct results.

I can't say more not having seen the script, but I am not sure I would be able to say more even if I had seen the script, as I don't rememb er having seen these errors before. It would still be good to post your script or, at least, give more information about it.


limner
Novice

Mar 13, 2014, 7:33 AM

Post #3 of 4 (2225 views)
Re: [limner] error messages [In reply to] Can't Post

This is the script:

Code
#!C:\strawberry\perl\bin\perl 
use WWW::Mechanize::Firefox;
use Text::Unaccent;
use Win32::Process::List;
use Win32::Process;
use Win32;
use Win32::Process::Kill;
use DBI;
use CGI;



require "C:\\app\\Limner\\procedure\\esamina_bookings\\conndb\\coord_database.pl";
coord::head4();




require "C:\\app\\Limner\\procedure\\esamina_bookings\\conndb\\tns_sbeauty.pl";
tns::head3();
$dbh=$tns::dbh1;








$gruppo=$ARGV[0]; ### Gruppo da elaborare (G01 - G02 ecc ecc)
$yyyymm=$ARGV[1]; ### Periodo da elaborare tipo yyyy-mm (Es 2014-06)

$hotels=$dbh->prepare(" SELECT id_sito_booking ,id_hotel ,nome
FROM lista_hotel
where upper(attivo) = 'Y'
and gruppo = '$gruppo'
order by id_hotel asc ");
$hotels->execute();








while (@rowhotel = $hotels->fetchrow_array)
{

# $resetta="n";


$data1=$dbh->prepare(" select to_char(sysdate,'yyyy-mm')
,to_char(sysdate+1,'dd')
from dual ");
$data1->execute();
@rg1 = $data1->fetchrow_array;

$test=$rg1[0];
$na=$rg1[1];



$data2=$dbh->prepare(" select case when $test = $yyyymm then to_number($na)
else 1
end
from dual ");
$data2->execute();
@rg2 = $data2->fetchrow_array;

$ng=$rg2[0];


$data3=$dbh->prepare(" select to_number(to_char(last_day(to_date('01-$yyyymm','dd-yyyy-mm')),'dd'))
from dual ");

$data3->execute();
@rg3 = $data3->fetchrow_array;

$nmax=$rg3[0];




while( $ng <= $nmax )
{

my $mech = WWW::Mechanize::Firefox->new( launch => 'C:\Program Files (x86)\Mozilla Firefox\firefox.exe'
,tab => 'current' );

$dt_in=$dbh->prepare(" select to_char(to_date('$yyyymm-$ng','yyyy-mm-dd'),'yyyy-mm-dd')
from dual ");
$dt_in->execute();
$chin= $dt_in->fetchrow_array;


$dt_out=$dbh->prepare(" select to_char(to_date('$yyyymm-$ng','yyyy-mm-dd')+1,'yyyy-mm-dd')
from dual ");
$dt_out->execute();
$chout= $dt_out->fetchrow_array;


$id_sito=$rowhotel[0];
$ch_in=$chin;
$ch_out=$chout;
$id_h=$rowhotel[1];
$res=$resetta;

print STDERR "sito=$id_sito ch-in=$ch_in ch-out=$ch_out id_hotel=$id_h periodo=$yyyymm ng=$ng nmax=$nmax \n";






$nomefile=$dbh->prepare(" select 'bkg_'||'$ch_in'||'_'||'$id_h'||'.temp'
,'bkg_'||'$ch_in'||'_'||'$id_h'||'.html'
from dual ");
$nomefile->execute();
@nfile= $nomefile->fetchrow_array;


$tfile=$nfile[0]; p
$hfile=$nfile[1];

$dirro="C:\\app\\Limner\\procedure\\esamina_bookings\\htmlfiles\\tab_html_files\\";


$dest=join("",$dirro,$tfile);

$url_base="http://www.booking.com/hotel/it/";

#$url="$url_base$id_sito?checkin=$ch_in&checkout=$ch_out";

@in=split('-' ,$ch_in);
@out=split('-' ,$ch_out);

$dd_ch_in=@in[2];
$yyyymm_ch_in=join('-' ,@in[0] ,@in[1]);

$dd_ch_out=@out[2];
$yyyymm_ch_out=join('-' ,@out[0] ,@out[1]);

$url="$url_base$id_sito?checkin_monthday=$dd_ch_in&checkin_year_month=$yyyymm_ch_in&checkout_monthday=$dd_ch_out&checkout_year_month=$yyyymm_ch_out";

$mech->save_url( $url ,$dest );






$FILE_TEMP="C:\\app\\Limner\\procedure\\esamina_bookings\\htmlfiles\\tab_html_files\\$tfile";
$FILE_DEF ="C:\\app\\Limner\\procedure\\esamina_bookings\\htmlfiles\\tab_html_files\\$hfile";

open my $INFILE ,'<' ,$FILE_TEMP;
open my $OUTFILE ,'>' ,$FILE_DEF;

$n=0;

while (my $line = <$INFILE>) {
$linea_def=unac_string("UTF-8",$line);
$lung=length($linea_def);
if ($lung > 3950)
{ @linee_multiple = split(' ',$linea_def);
foreach my $valur (@linee_multiple)
{ ++$n;
print $OUTFILE $n." 1701Limner1701 ".$valur."\n"; }
}
else
{ ++$n;
print $OUTFILE $n." 1701Limner1701 ".$linea_def; }
}

close $INFILE;
close $OUTFILE;









$ng=$ng+1;

}
}



(This post was edited by FishMonger on Mar 13, 2014, 7:45 AM)


Laurent_R
Veteran / Moderator

Mar 13, 2014, 10:56 AM

Post #4 of 4 (2185 views)
Re: [limner] error messages [In reply to] Can't Post

I would suggest that you add these two lines at the beginning of your program:

Code
use strict; 
use warnings;

and that you declare all your variables (including object names) with the my operator within the smallest lexical scope possible for each, instead of using scores of global variables. This way, they will be deallocated as soon as they are no longer useful (fall out of scope), and it is quite likely that the error messages you see will disappear (some at least). And you should to the same thing in programs that you require.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives