[ic] Tag->salestax() causes Safe error in IO/Socket.pm

Dan Browning interchange-users@icdevgroup.org
Mon Aug 5 23:53:00 2002


At 11:14 PM 8/5/2002 -0400, you wrote:
>Quoting Dan Browning (dbml@kavod.com):
> > At 10:42 PM 8/5/2002 -0400, you wrote:
> > >Quoting Dan Browning (dbml@kavod.com):
> > > > I've got one for the funny papers:
> > > >
> > > > This code:
> > > >
> > > > [perl tables="products options"]
> > > >          return ( $Tag->salestax({ noformat => 1, }) );
> > > > [/perl]
> > > >
> > > > Produces this error:
> > > >
> > > > x.x.x.x ZfdIYb6S:x.x.x.x - [05/August/2002:20:59:39 -0400] foundation
> > > > /cgi-bin/cart.cgi/test Safe: require trapped by operation mask at
> > > > /usr/lib/perl5/5.6.1/i686-linux/IO/Socket.pm line 9.
> > > >  > Compilation failed in require at
> > > > /usr/lib/perl5/site_perl/5.6.1/LWP/Simple.pm line 302.
> > > >  >
> > > >  >
> > > >  >       return ( $Tag->salestax({ noformat => 1, }) );
> > > >  >
> > > >  >
> > > >
> > > > [salestax noformat=1] works fine, but it really tickles my funny 
> bone that
> > > > IO/Socket.pm would have a balk at a mere salestax call. 
> :-)  Environment:
> > > > 4.8.3, CPanel4.  Accepting all comments,
> > > >
> > >
> > >If your database is talking over the net, and some misguided DB driver
> > >does a runtime "require", you could see this because of Safe.
> > >
> > >I hate runtime requires because of this. We are probably the only
> > >significant piece of software that uses Safe routinely, and also are one
> > >of the few long-lived Perl daemons. As such people do all sorts of
> > >bizarre things like not allow class method calls for subroutines and
> > >routinely call require on repetitive object creation....SOAP::Lite is an
> > >example of this and it makes programming for it a pain.
> >
> > Aha, I'm pretty sure its the UPS queries, then.  "Tax on shipping" is
> > enabled, so for salestax to calculate, it first runs the shipping, which
> > then runs the LWP::Simple request to ups.com.  Any solutions/workarounds?
> >
>
>I think the only thing would be to rewrite Business::UPS to use
>the LWP::UserAgent module and then build the initial object
>at catalog startup time....

FTMLAS [for the mailing list archive's sake],  I worked-around the problem 
by wrapping the offensive code in a catalog-level usertag.

+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Dan Browning, Kavod Technologies <db@kavod.com>
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Miss, n.:
         A title with which we brand unmarried women to indicate that
they are in the market.
                 -- Ambrose Bierce, "The Devil's Dictionary"