[ic] AllowGllobal/UserTag - I need a help please

Alma Nuker interchange-users@interchange.redhat.com
Tue Mar 19 22:17:01 2002


Hi guys;

Looking trough all doc and mailing list I am even more confused about
AllowGlobal/UserTag use.

I am trying to set up my own UserTag as follow:

UserTag get-url Order duedate
UserTag get_date AddAttr
UserTag get_date Documentation <<EOD

usage: [get_date duedate]
Some text in here.
EOD

UserTag get_date Routine <<EOR

sub {

my($duedate)=@_;

 eval {
    require Date::Parse;
    requireDate::Manip;
    require Date::Format;
  };
 if($@) {

        ::logError("Error: $@");
        return;
 }

 my $new_date = &ParseDate($duedate);
 my $date_new=&DateCalc($new_date,"+ 1year",\my $err);
 my @format="%Y-%m-%d";
 my $final_date=&UnixDate($date_new,@format);
 return $final_date;
}

EOR

I called it get_date.tag and place it in /usr/lib/interchange/usertag/

I tried to refer to this tag from my page as follow:

[perl]
 $date =$Values->{due_date};
 $junk =  $Tag->get_date($date);
 return ("$junk<br>\n");
[/perl]

When I restarted interchange I did not get any error. But I have
following error im my error.log

 Error: require trapped by operation mask at
/usr/local/share/perl/5.6.1/Date/Parse.pm line 9.
 Compilation failed in require at (eval 106) line 6.

I had a look at mailing list and doco and as long as I did understand
this:

1. I only should set up AllowGlobal (my catalog name) if I am using my
usertag inside my catalog.cfg
2. Only UserTags defined in catalog.cfg are restricted by Safe module
3. Defining  UserTag as above or in interchange.cfg should allow us to
do all sort of "unsafe" stuff.

I tried adding AllowGlobal my-catalaog-name in interchange.cfg and then
adding global=1 inside perl tags as follow:

AllowGlobal my-catalog in intechange.cfg

Then adding following inside my html page

[perl sub=1 global=1]

 my $date =$Values->{maintenance_due_date};
 my $junk =  $Tag->get_date($date);
 return ("$junk<br>\n");
[/perl]

 Safe: Undefined subroutine &Vend::Interpolate::ParseDate called at
(eval 106)

I tried adding this UserTag inside interchange,cfg itself but no luck
there either.
I tried also putting it to catalog.cfg and then setting up AllowGlobal
things but that did not work either.

If I execute above code in native perl, works fine. I double checked and
all perl Date:: modules that I required are inatslled.

I am not sure what else I could try.

Pleaseeee help. I am not sure what but I must be doing something wrong
in here.

Thanks Alma