Scrip code sharing?

I have two scrips that “share” what has become a fairly
substanial bit of code – is there some way for them to
actually share the common code instead of having two copies
of it?

Thanks,
John

Hi John,On 9/25/2010 9:03 PM, John Hascall wrote:

I have two scrips that “share” what has become a fairly
substanial bit of code – is there some way for them to
actually share the common code instead of having two copies
of it?

I have a few functions that I use a lot also (RT 3.6.3). I put them at
the end of RT_SiteConfig.pm. Here’s the skeleton for one of them:

Return true if argument is e-mail address in one of my domains,

else undef

{ package RT::Action::UserDefined;
sub EmailInMyDomain {
### your code here
return undef;
}
1;
}

I call it from a scrip like so:
my $test2 = ! EmailInMyDomain($sender);

There are probably better ways to do this, but this one works for me.

Regards,
Gene