[ic] XML::Parser, Safe.pm, system signal 12

Mike Heins mike at perusion.com
Thu Jun 10 10:28:55 EDT 2004


Quoting Carsten Jahnke (carstenjahnke at web.de):
> Mike Heins wrote:
> >Try putting 
> >
> >	SafeUntrap require
> >
> >in interchange.cfg. This will sometimes help, but significantly reduces
> >the security of Safe. It may not work, either, if they have to modify
> >the symbol table as part of the require; you can usually get around
> >that by pre-requiring needed modules in a BEGIN {} block.
> >
> 
> Thanks for your reply, Mike!
> I also had that idea of SafeUntrap but after putting in "require" I had 
> to untrap "caller", then "-d" and at this point interchange dropped out 
> processing interchange.cfg.
> 
> >If you can break out the XML::Parser things into operations that
> >can be placed outside your [perl] blocks, i.e.
> >
> >	[tmp result][your-xml-parser-tag][/tmp]
> >
> >then you can use the result in your subsequent Perl code.
> >
> 
> That's it !!
> I got some real good explanations from Kevin about Safe.pm's supremacy 
> *g* in any [perl], [mvasp], [calc] definitions. So, putting the Tag-call 
> outside of any of these embedded-perl Tags is the running method I 
> searched for so long!
> The only small drawback is the [tmp result][your-xml-parser-tag][/tmp] - 
> construction to get the return values in following [mvasp]- or [perl]- 
> chapters.
> 

You can also do some nice tricks with a data structure within
the userTag, then use it in your Perl code later by passing
in a $Tmp variable:

UserTag xml-parser-foo Order foo
UserTag xml-parser-foo addAttr
UserTag xml-parser-foo Routine <<EOR
sub {
	....

	my $tmp_name = $opt->{tmp_name} || 'passed_structure';
	$Tmp->{$tmp_name} = {
					foo => [ @someary ]
					bar => { %somehash }
				   };
	return;
}
EOR

Then in your page:

	[xml-parser-foo tmp-name=foo]

	[perl]
		my $obj = $Tmp->{foo};

		my $foostruct = $obj->{foo};
		my $barstruct = $obj->{bar};

	[/perl]

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.647.1295  tollfree 800-949-1889 <mike at perusion.com>

Software axiom: Lack of speed kills.


More information about the interchange-users mailing list