'print' output on one line

2004-01-06 Thread Esposito, Anthony
I have a perl program ( with DBI ) which prints out a line to STDOUT
after every 100 database commits.  I would like the 'print' to just
refresh the current line every time but - not knowing how to get around
it - the program instead prints a new line every 100 commits like so:

 

INFO 3: start deleting rows.

Rows deleted: 100

Rows deleted: 200

Rows deleted: 300

Rows deleted: 400

.

.

.

INFO 4: delete_rows.pl program ended.

 

I would like the output to just stay on one line and just update the
count as the program proceeds.  So the output - when done - would just
be 

 

INFO 3: start deleting rows.

Rows deleted: 400

INFO 4: delete_rows.pl program ended.

 

Is there a 'print' option/escape character the sends the file pointer (
for STDOUT in this case ) back to the beginning of the line?

 

Here is the current code segment - the focus here is on the last 'print'
statement:

 

print "INFO 3: start deleting rows.\n";

while(($row_data) = $sth1->fetchrow) {

  if(! defined ($sth2->execute($row_data))) {   # execute DELETE

print "ERROR 4: execute of DELETE statement failed.\n";

exit(int 4);

  }

  $row_counter = $row_counter + 1;

  if($row_counter >= 100) {

$dbh->commit;

$rows_deleted = $rows_deleted + $row_counter;

print "Rows deleted: $rows_deleted\n";

$row_counter = 0;

}

}

print "INFO 4: $0 program ended.\n";

 

  Thanks for any help you can offer

 

Tony Esposito

Oracle Developer, Enterprise Business Intelligence

XO Communications

Plano, TX  75074

Work Phone: 972-516-5344

Work Cell: 972-670-6144

Email: [EMAIL PROTECTED] 

 



RE: 'print' output on one line

2004-01-06 Thread Esposito, Anthony
Errata:  The "last" print statement in the 'while' loop is the focus..

Tony Esposito
Oracle Developer, Enterprise Business Intelligence
XO Communications
Plano, TX  75074
Work Phone: 972-516-5344
Work Cell: 972-670-6144
Email: [EMAIL PROTECTED]


-Original Message-----
From: Esposito, Anthony 
Sent: Tuesday, January 06, 2004 2:54 PM
To: [EMAIL PROTECTED]
Subject: 'print' output on one line

I have a perl program ( with DBI ) which prints out a line to STDOUT
after every 100 database commits.  I would like the 'print' to just
refresh the current line every time but - not knowing how to get around
it - the program instead prints a new line every 100 commits like so:

 

INFO 3: start deleting rows.

Rows deleted: 100

Rows deleted: 200

Rows deleted: 300

Rows deleted: 400

.

.

.

INFO 4: delete_rows.pl program ended.

 

I would like the output to just stay on one line and just update the
count as the program proceeds.  So the output - when done - would just
be 

 

INFO 3: start deleting rows.

Rows deleted: 400

INFO 4: delete_rows.pl program ended.

 

Is there a 'print' option/escape character the sends the file pointer (
for STDOUT in this case ) back to the beginning of the line?

 

Here is the current code segment - the focus here is on the last 'print'
statement:

 

print "INFO 3: start deleting rows.\n";

while(($row_data) = $sth1->fetchrow) {

  if(! defined ($sth2->execute($row_data))) {   # execute DELETE

print "ERROR 4: execute of DELETE statement failed.\n";

exit(int 4);

  }

  $row_counter = $row_counter + 1;

  if($row_counter >= 100) {

$dbh->commit;

$rows_deleted = $rows_deleted + $row_counter;

print "Rows deleted: $rows_deleted\n";

$row_counter = 0;

}

}

print "INFO 4: $0 program ended.\n";

 

  Thanks for any help you can offer

 

Tony Esposito

Oracle Developer, Enterprise Business Intelligence

XO Communications

Plano, TX  75074

Work Phone: 972-516-5344

Work Cell: 972-670-6144

Email: [EMAIL PROTECTED] 

 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




RE: 'print' output on one line

2004-01-06 Thread Esposito, Anthony
I tried that already but it just gives me the final count at the end.  I would like 
the output to change - the row count, that is - as each 100 rows is committed with the 
final output - when the program ends - to be:

INFO 3: start deleting rows.

Rows deleted: 400

INFO 4: delete_rows.pl program ended.

In other words, as time goes by, you see on your screen:

INFO 3: start deleting rows.

Rows deleted: 100

then ( overwriting the above )

INFO 3: start deleting rows.

Rows deleted: 200

and so on until the end...

Tony Esposito
Oracle Developer, Enterprise Business Intelligence
XO Communications
Plano, TX  75074
Work Phone: 972-516-5344
Work Cell: 972-670-6144
Email: [EMAIL PROTECTED]


-Original Message-
From: Jenda Krynicky [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 06, 2004 2:59 PM
To: [EMAIL PROTECTED]
Subject: Re: 'print' output on one line

From: "Esposito, Anthony" <[EMAIL PROTECTED]>
> I have a perl program ( with DBI ) which prints out a line to STDOUT
> after every 100 database commits.  I would like the 'print' to just
> refresh the current line every time but - not knowing how to get
> around it - the program instead prints a new line every 100 commits
> like so:
> 
> INFO 3: start deleting rows.
> Rows deleted: 100
> Rows deleted: 200
> Rows deleted: 300
> Rows deleted: 400
> ...
> print "Rows deleted: $rows_deleted\n";

Use \r instead of \n:

print "Rows deleted: $rows_deleted\r";

> 
> $row_counter = 0;
> 
> }
> 
> }
> 
> print "INFO 4: $0 program ended.\n";

and don't forget to add a \n in front of the "INFO 4..."

HTH, Jenda

= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




RE: 'print' output on one line (thread closed)

2004-01-06 Thread Esposito, Anthony
Alright, gents, you and I were both right..."\r" works, as it should.
It turns out that these computers today - and Perl - are even faster than I thought.  
My test data set was only 300 rows so by the time the program ran - and deleted - 300 
rows the Perl program had only enough time to print the output once, making it 
'appear' to not work.  I had a suspicion that that may be the problem so I increased 
my test data set to 6000 and it worked fine.
Thanks all!

Close this thread.

:-)

Tony Esposito
Oracle Developer, Enterprise Business Intelligence
XO Communications
Plano, TX  75074
Work Phone: 972-516-5344
Work Cell: 972-670-6144
Email: [EMAIL PROTECTED]


-Original Message-----
From: Esposito, Anthony 
Sent: Tuesday, January 06, 2004 3:09 PM
To: Jenda Krynicky; [EMAIL PROTECTED]
Subject: RE: 'print' output on one line

I tried that already but it just gives me the final count at the end.  I would like 
the output to change - the row count, that is - as each 100 rows is committed with the 
final output - when the program ends - to be:

INFO 3: start deleting rows.

Rows deleted: 400

INFO 4: delete_rows.pl program ended.

In other words, as time goes by, you see on your screen:

INFO 3: start deleting rows.

Rows deleted: 100

then ( overwriting the above )

INFO 3: start deleting rows.

Rows deleted: 200

and so on until the end...

Tony Esposito
Oracle Developer, Enterprise Business Intelligence
XO Communications
Plano, TX  75074
Work Phone: 972-516-5344
Work Cell: 972-670-6144
Email: [EMAIL PROTECTED]


-Original Message-
From: Jenda Krynicky [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 06, 2004 2:59 PM
To: [EMAIL PROTECTED]
Subject: Re: 'print' output on one line

From: "Esposito, Anthony" <[EMAIL PROTECTED]>
> I have a perl program ( with DBI ) which prints out a line to STDOUT
> after every 100 database commits.  I would like the 'print' to just
> refresh the current line every time but - not knowing how to get
> around it - the program instead prints a new line every 100 commits
> like so:
> 
> INFO 3: start deleting rows.
> Rows deleted: 100
> Rows deleted: 200
> Rows deleted: 300
> Rows deleted: 400
> ...
> print "Rows deleted: $rows_deleted\n";

Use \r instead of \n:

print "Rows deleted: $rows_deleted\r";

> 
> $row_counter = 0;
> 
> }
> 
> }
> 
> print "INFO 4: $0 program ended.\n";

and don't forget to add a \n in front of the "INFO 4..."

HTH, Jenda

= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




RE: case and functions

2004-01-06 Thread Esposito, Anthony
There is no 'case' statement in Perl but it is easy to mimic such a construct.

Tony Esposito
Oracle Developer, Enterprise Business Intelligence
XO Communications
Plano, TX  75074
Work Phone: 972-516-5344
Work Cell: 972-670-6144
Email: [EMAIL PROTECTED]


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 06, 2004 4:08 PM
To: [EMAIL PROTECTED]
Subject: case and functions

Yo.

I read in Learning Perl that there are no such constructs like a case statement.  Is 
there 
something similar or did I misread this?  Also what about functions and 
function calls, do these exits or does the subroutines replace these?

thanks 

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: 'print' output on one line

2004-01-06 Thread Esposito, Anthony
Very helpful...thank you

Tony Esposito
Oracle Developer, Enterprise Business Intelligence
XO Communications
Plano, TX  75074
Work Phone: 972-516-5344
Work Cell: 972-670-6144
Email: [EMAIL PROTECTED]


-Original Message-
From: R. Joseph Newton [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 06, 2004 5:07 PM
To: Esposito, Anthony
Cc: Jenda Krynicky; [EMAIL PROTECTED]
Subject: Re: 'print' output on one line

"Esposito, Anthony" wrote:

> I tried that already but it just gives me the final count at the end.  I would like 
> the output to change - the row count, that is - as each 100 rows is committed with 
> the final output - when the program ends - to be:

Try turning autoflush on:

Greetings! C:\>perl -w
{
  local $| = 1;
  print "Hello, there\r";
  sleep 2;
  print "Well, bye for now\r";
  sleep 2;
}

^Z
Hello, there

[two seconds later...]
Greetings! C:\>perl -w
{
  local $| = 1;
  print "Hello, there\r";
  sleep 2;
  print "Well, bye for now\r";
  sleep 2;
}

^Z
Well, bye for now

HTH,

Joseph


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




RE: PERL debuggers

2004-01-07 Thread Esposito, Anthony
There is Open Perl IDE.  Check out http://open-perl-ide.sourceforge.net.
Unfortunately, it is for Windows only.

HTH  :-)

Tony Esposito
Oracle Developer, Enterprise Business Intelligence
XO Communications
Plano, TX  75074
Work Phone: 972-516-5344
Work Cell: 972-670-6144
Email: [EMAIL PROTECTED]


-Original Message-
From: Wiggins d Anconia [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 07, 2004 2:29 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: PERL debuggers

> 
> Are there any free PERL debuggers?
> 
> I once came across pvdb (a vi-aware front-end for the PERL debugger
> developed by Tom Christainsen), but I never got it to work.
> 

perldoc perldebtut
perldoc perldebug

Have you had a look at those?

http://danconia.org

p.s. perldoc -q '"Perl"'

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: upgrading perl to 5.6 from 5.005_03 question?

2004-02-02 Thread Esposito, Anthony
Instead of upgrading why not just install Perl 5.6 in a separate directory..just a 
thought!  

Tony Esposito
Oracle Developer, Enterprise Business Intelligence
XO Communications
Plano, TX  75074
Work Phone: 972-516-5344
Work Cell: 972-670-6144
Email: [EMAIL PROTECTED]


-Original Message-
From: Rob Dixon [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 02, 2004 12:50 PM
To: [EMAIL PROTECTED]
Subject: Re: upgrading perl to 5.6 from 5.005_03 question?

Ravi Malghan wrote:
>
> I have perl 5.005_03 on solaris 2.8 which was
> installed with the OS. I would like to upgrade it to
> 5.6. Should I pkgrm the existing perl before I install
> the new perl ? or is there any other recommended way
> to upgrade.

Hi Ravi.

What do you mean by

> Should I pkgrm the existing perl

If you have any Perl software that may rely on the current
version of Perl, then you should be careful. OTOH, if this is a
new installation without any Perl programs, then install a
recognised version of Perl as soon as you can. A version
'installed with the OS' isn't a safe place to start.

Rob





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




HTTP

2004-05-26 Thread Esposito, Anthony
Any help for a script downloading files from a http site?

 

Tony Esposito

Oracle Developer, Enterprise Business Intelligence

XO Communications

Plano, TX  75074

Work Phone: 972-516-5344

Work Cell: 972-670-6144

Email: [EMAIL PROTECTED]