[ic] Error while starting Interchange

Stefan Hornburg Racke interchange-users@interchange.redhat.com
Thu Sep 20 06:14:01 2001


"Jason Osborne" <jason@sohonetworks.cc> writes:

> I added my first usertag today to parse xml data. Here is my problem:
> 
> Can't locate object method "new" via package "XML::Parser" at (eval 117)
> line 47, <GLOBAL> line 118.
> In line 118 of the configuration file 'usertag/ups_ad.tag': UserTag  ups-ad
> Routine <<EOR
> 
> and a few snipped lines from my tag file:
> 
> my $hole;
> BEGIN {
>         eval {
>                 require Safe::Hole;
>                 $hole = new Safe::Hole; };
> }
> [...]
> 	my $parser = $hole->wrap(new XML::Parser (ErrorContext => 2, Style =>
> "Tree"));
> 	my $xmlobj = new XML::SimpleObject ($parser->parse($response));

You don't need Safe::Hole for this. In a _global_ usertag you
can do sth like this:

UserTag entrance_agent Order url cookie
UserTag entrance_agent Routine <<EOF
sub {
	my ($url, $cookie) = @_;

	eval {
		require LWP::UserAgent;
		require HTTP::Cookies;
	};
	if ($@) {
		::logError("Cannot use entrance_agent, no LWP modules installed");
		return;
	}

	my $ua = new LWP::UserAgent;
	my $cookie_jar = new HTTP::Cookies;

	$ua->cookie_jar ($cookie_jar);

	my $request = new HTTP::Request ('GET', $url);
	my $response;
	
...

Ciao
        Racke

-- 
Racke happily hacks Interchange and maintains Debian packages like Courier.

For projects and other business stuff please refer to COBOLT NetServices
(URL: http://www.cobolt.net; Email: info@cobolt.net; Phone: 0041-1-3884400)