http://www.perlmonks.org?node_id=113703


in reply to making a spinner

PerlIsFun

Long time ago, i wrote something to transfer database table from Informix to Oracle, i used a spinner. It may help you.

sub transfer_Data { my $stn = shift; my $dtn = shift; $| = 1; my @spinner = ('|','/','-','\\'); my $ifmx_stmt = "select count(*) from $stn" ; my $sth_ifmx = $db_ifmx->prepare($ifmx_stmt); $sth_ifmx->execute; my $count = $sth_ifmx->fetchrow(); print "Total record number: $count \n\n"; $ifmx_stmt = "select * from $stn" ; $sth_ifmx = $db_ifmx->prepare($ifmx_stmt); $sth_ifmx->execute; my $rn = 1; while ( my @row = $sth_ifmx->fetchrow_array ) { my $ds = ''; for ( my $i = 0; $i <@row; $i++ ) { my $nd = trim($row[$i]); $nd =~ s/'/''/g; my $check = match_DateList($i); if ( $check ) { $ds .= "to_date('$nd', 'MM/DD/YYYY'),"; } else { $ds .= "'$nd',"; } } $ds =~ s/,$/)/; $ds =~ s/^/(/; my $orac_stmt = "insert into $dtn values " . $ds ; my $sth_orac = $db_orac->do($orac_stmt); print "Record: $rn $spinner[$rn%4]\r"; $rn++; } $sth_ifmx->finish; print "\nData Transfer is complete \n\n"; $| = 0; }
It may be too much. That is what i have.

Edit by tye