Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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]
[erix]: then you might as well send that patch to the DBIC guys :)
[Corion]: erix: Yeah, I just found that it has no documentation at all on how to circumvent/ eliminate "1+n SELECTs" by building a local hash... I guess I have to make ->has_many do the hash lookup instead of doing the SQL query. But as the problem ...
[Corion]: ... has only manifested itself so far through the puzzled questions of other bystanders, I won't go deeper at this time. But the DBIx::Class documentation could well do with a document on how to make "it" (that is, ORMs in general) faster ;)
[Corion]: I find that DBIx::Class, like most ORMs makes things easy until they become performance critical and then makes it horribly hard to change things because the design is highly inflexible if you don't already know about the problems of 1+n :-/
[choroba]: that's why I don't like similar libraries. They pretend you don't have to learn SQL, but in the end, you have to learn how SQL plus to overcome their own limitations
[Corion]: "Just write the proper SQL beforehand" is of course the appropriate solution, but if you did that, you wouldn't/couldn't use DBIx::Class either. At least not in an obvious (to me) way.
choroba scratches a "how"
[Corion]: choroba: Exactly... But maybe that's just because I'm old and grumpy ;)
[Corion]: But maybe that could also be a nice talk, how to restructure your DBIx::Class-based app to remove 1+n-style query patterns

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2017-09-25 11:09 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (279 votes). Check out past polls.