[ic] Require in Global UserTag

interchange-users@interchange.redhat.com interchange-users@interchange.redhat.com
Mon Sep 17 09:35:01 2001


Quoting Stefan Hornburg (Racke) (racke@linuxia.de):
> 
> Has anyone an idea why this didn't work:
> 
> UserTag chart Routine <<EOF
> sub {
> 	eval {
> 		require GIFgraph::bars;
> 	};
> 	if ($@) {
> 		::logError("Cannot generate chart, GIFgraph module not installed: $@");
> 		return;
> 	}
> }	
> EOF
> 
> snowflake.linuxia.de EX9E4JYr:linuxia.de - [17/September/2001:14:38:32 +0200] roll /cgi-bin/ic/roll/entrance/stats Cannot generate chart, GIFgraph module not installed: require trapped by operation mask at /usr/lib/perl5/GIFgraph/bars.pm line 14.
> > 
> 
> This is a global usertag, so it resembles the get_url UserTag.
> I suppose that I _should_ work, sigh.

No doubt you are calling it with 

    [perl]
	$Tag->chart(@parms);
    [/perl]

Safe will not allow a runtime require, no matter what you do. You
would need to do:

UserTag chart Routine <<EOF
eval {
    require GIFgraph::bars;
};
if($@) {
	return sub {
	    ::logError("Cannot generate chart, GIFgraph module not installed: $@");
	};
}
sub {
	# Do some stuff with GIFgraph::bars;
}
EOF

-- 
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH  45013
phone +1.513.523.7621      <mheins@redhat.com>

Prove you aren't stupid.  Say NO to Passport.