[rt-users] scrip code sharing?

Gene LeDuc gleduc at mail.sdsu.edu
Mon Sep 27 11:07:12 EDT 2010


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



More information about the rt-users mailing list