Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^2: Library problems with XML::Compile::WSDL11 and Math::BigInt

by space_monk (Chaplain)
on Jan 06, 2011 at 19:33 UTC ( #880916=note: print w/replies, xml ) Need Help??

in reply to Re: Library problems with XML::Compile::WSDL11 and Math::BigInt
in thread Library problems with XML::Compile::WSDL11 and Math::BigInt

Math::BigInt is v1.99 There are no modifications to the official libraries.
  • Comment on Re^2: Library problems with XML::Compile::WSDL11 and Math::BigInt

Replies are listed 'Best First'.
Re^3: Library problems with XML::Compile::WSDL11 and Math::BigInt
by ikegami (Pope) on Jan 06, 2011 at 20:09 UTC

    Then how is $@ getting printed? And how is "SCALAR" getting added after the second slash or how is "/SCALAR" added to @c?

    It's has to be that line based on the number of messages you get, the presence of "qw/Math::BigInt::FastCalc", the line number inside the eval at which it occurs, and the resulting failure to load any backends.

    Please post the import sub from the file given by perldoc -l Math::BigInt.

    perl -ne'print if /^sub import/.../^sub/' `perldoc -l Math::BigInt`

    For what it's worth, I don't get the error.

    $ for q in \ > XML::Compile \ > XML::Compile::WSDL11 \ > Math::BigInt \ > Math::BigInt::FastCalc > do > perl -M$q -le'print "$ARGV[0] ", $ARGV[0]->VERSION' $q > done XML::Compile 1.21 XML::Compile::WSDL11 2.21 Math::BigInt 1.99 Math::BigInt::FastCalc 0.24 $ perl -v | grep version This is perl 5, version 12, subversion 2 (v5.12.2) built for i686-linu +x $ perl -le' > use XML::Compile::WSDL11; > use XML::Compile::SOAP11; > use Math::BigInt; > print "ok"; > ' ok
      I'm not sure how the /SCALARS end up there Import sub as requested
      sub import { my $self = shift; $IMPORT++; # remember we did import() my @a; my $l = scalar @_; my $warn_or_die = 0; # 0 - no warn, 1 - warn, 2 - die for ( my $i = 0; $i < $l ; $i++ ) { if ($_[$i] eq ':constant') { # this causes overlord er load to step in overload::constant integer => sub { $self->new(shift) }, binary => sub { $self->new(shift) }; } elsif ($_[$i] eq 'upgrade') { # this causes upgrading $upgrade = $_[$i+1]; # or undef to disable $i++; } elsif ($_[$i] =~ /^(lib|try|only)\z/) { # this causes a different low lib to take care... $CALC = $_[$i+1] || ''; # lib => 1 (warn on fallback), try => 0 (no warn), only => 2 (di +e on fallback) $warn_or_die = 1 if $_[$i] eq 'lib'; $warn_or_die = 2 if $_[$i] eq 'only'; $i++; } else { push @a, $_[$i]; } } # any non :constant stuff is handled by our parent, Exporter if (@a > 0) { require Exporter; $self->SUPER::import(@a); # need it for subclasses $self->export_to_level(1,$self,@a); # need it for MBF } # try to load core math lib my @c = split /\s*,\s*/,$CALC; foreach (@c) { $_ =~ tr/a-zA-Z0-9://cd; # limit to sane characters } push @c, \'FastCalc', \'Calc' # if all fail, try these if $warn_or_die < 2; # but not for "only" $CALC = ''; # signal error foreach my $l (@c) { # fallback libraries are "marked" as \'string', extract string if +nec. my $lib = $l; $lib = $$l if ref($l); next if ($lib || '') eq ''; $lib = 'Math::BigInt::'.$lib if $lib !~ /^Math::BigInt/i; $lib =~ s/\.pm$//; if ($] < 5.006) { # Perl < 5.6.0 dies with "out of memory!" when eval("") and ':co +nstant' is # used in the same script, or eval("") inside import(). my @parts = split /::/, $lib; # Math::BigInt => Math + BigInt my $file = pop @parts; $file .= '.pm'; # BigInt => require File::Spec; $file = File::Spec->catfile (@parts, $file); eval { require "$file"; $lib->import( @c ); } } else { eval "use $lib qw/@c/;"; } if ($@ eq '') { my $ok = 1; # loaded it ok, see if the api_version() is high enough if ($lib->can('api_version') && $lib->api_version() >= 1.0) { $ok = 0; # api_version matches, check if it really provides anything we nee +d for my $method (qw/ one two ten str num add mul div sub dec inc acmp len digit is_one is_zero is_even is_odd is_two is_ten zeros new copy check from_hex from_oct from_bin as_hex as_bin as_oct rsft lsft xor and or mod sqrt root fac pow modinv modpow log_int gcd /) { if (!$lib->can("_$method")) { if (($WARN{$lib}||0) < 2) { require Carp; Carp::carp ("$lib is missing method '_$method'"); $WARN{$lib} = 1; # still warn about the lib } $ok++; last; } } } if ($ok == 0) { $CALC = $lib; if ($warn_or_die > 0 && ref($l)) { require Carp; my $msg = "Math::BigInt: couldn't load specified math lib(s), fa +llback to $lib"; Carp::carp ($msg) if $warn_or_die == 1; Carp::croak ($msg) if $warn_or_die == 2; } last; # found a usable one, break } else { if (($WARN{$lib}||0) < 2) { my $ver = eval "\$$lib\::VERSION" || 'unknown'; require Carp; Carp::carp ("Cannot load outdated $lib v$ver, please upgrade"); $WARN{$lib} = 2; # never warn again } } } } if ($CALC eq '') { require Carp; if ($warn_or_die == 2) { Carp::croak ("Couldn't load specified math lib(s) and fallback d +isallowed"); } else { Carp::croak ("Couldn't load any math lib(s), not even fallback t +o"); } } # notify callbacks foreach my $class (keys %CALLBACKS) { &{$CALLBACKS{$class}}($CALC); } # Fill $CAN with the results of $CALC->can(...) for emulating lower +math lib # functions %CAN = (); for my $method (qw/ signed_and signed_or signed_xor /) { $CAN{$method} = $CALC->can("_$method") ? 1 : 0; } # import done } sub from_hex

        Do you change $SIG{__DIE__}, by any chance? A buggy $SIG{__DIE__} handler could explain the output.

        I wish you had given a minimal, runnable demonstration of the problem. You're having us make assumptions as to what's what you didn't show.

        I guess you'll have to trace through to find the problem. Carp::Always might prove to be a shortcut (although I'm not sure how it behaves with eval). It surely won't work if you change $SIG{__DIE__}.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://880916]
[usemodperl]: sorry veltro, venting...
[usemodperl]: (is that wrong marto?)
[aitap]: usemodperl: maybe it's you who has changed
[marto]: demonstrably yes, since you claim to want a safe space, your definition for which seems to be a place where you can name call, make things up or otherwise post without being challenged
[usemodperl]: no that's not it at all, meant safe for perl people, to not be hounded by weirdos obsessed with things like... whitespace :-)
[choroba]: I'm definitely not obsessed with whitespace, I rate myself among Perl people, and I haven't noticed any hounding
[marto]: "no it's not that"...."weirdos "...
[marto]: List EXE_FILES installed by CPAN so a couple of people suggest that your code looks obfuscated. I'd have to ageree, from the perspective of those who can't follow all of that one liner, it doesn't read well

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2018-06-24 15:56 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.