Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Strange math issue with Net::SFTP (Pari)

by tye (Cardinal)
on May 29, 2012 at 16:36 UTC ( #973066=note: print w/ replies, xml ) Need Help??


in reply to Strange math issue with Net::SFTP

I'd bet money that you aren't calling the code that you think you are calling.

Update: Right after I posted that, I realized that, although one of the items was quite normal, the other one could be overloaded and be enough to cause the problem. The crux of your problem can be found in http://cpansearch.perl.org/src/TURNSTEP/Net-SSH-Perl-1.34/lib/Net/SSH/Perl/Util/SSH2MP.pm. So the solution surely can be found in Math::Pari.

- tye        


Comment on Re: Strange math issue with Net::SFTP (Pari)
Re^2: Strange math issue with Net::SFTP (Pari)
by vendion (Scribe) on May 29, 2012 at 16:59 UTC

    So if the root of my problem is caused by Math::Pari then I should be able to convert it to a number and then calculate the percentage. I had trying messing with Math::Pari some the other day but had no such luck... I will keep trying.

      Ok so after changing my callback sub to this

      sub callback { my ( $sftp, $data, $offset, $size ) = @_; use Math::Pari qw( :DEFAULT PARI pari2num ); print 'offset is a: '; print ref $offset; print "\n"; $offset = pari2num($offset); print 'now offset is a: '; print ref $offset; print "\n"; print 'size is a: '; print ref $size; print "\n"; $size = pari2num($size); print 'now size is a: '; print ref $size; print "\n"; my $percent = ($offset/$size) * 100; print "percent=$percent\n"; return; }

      Things now start to make sense to me in the output:
      offset is a: now offset is a: offset=0 size is a: Math::Pari size is a: size=666974 percent=0 offset is a: now offset is a: offset=8192 size is a: Math::Pari size is a: size=666974 percent=1.22823378422547 offset is a: now offset is a: offset=16384 size is a: Math::Pari size is a: size=666974 percent=2.45646756845094

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://973066]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2014-10-25 16:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (146 votes), past polls