> -----Original Message-----
> From: RTO RTO [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 10, 2002 6:27 AM
> To: [EMAIL PROTECTED]
> Subject: Add a user-function to Perl core????
> 
> 
> 
> I am not sure if this would be inane to ask. But here is a dilemma:
> 
> I have three functions, ltrim, rtrim and trim. As the 
> function names adumbrate, each of them trims white-spaces -- 
> the usual trimming stuff. Since, these functions do not exist 
> in Perl and of course I can club them together in the form of 
> a package and then invoke it, I was wondering if there is a 
> way to make these three functions to go into some "core-box" 
> of Perl, so that they will be seen by my Perl scripts, just 
> similar to say substr, chomp, chop etc that are defined as 
> CORE functions of Perl.
> 
> In a nutshell, is there a way, where user-defined functions 
> can be "safely" added to my local installation of Perl and 
> make it believe that such user-defined functions to be a part 
> of "standard Perl functions"? Can I invoke such user-defined 
> functions without making an explicit "use MyPackage;" statement?

The only thing I can think of is to set the PERL5OPT variable, as defined in
perldoc perlrun:

   export PERL5OPT=-MMyPackage

Now MyPackage will be use'd whenever you invoke perl, subject to the caveats
in perldoc perlrun.

There may be another way; I'm not sure. I think it's safest to just put the
"use MyPackage;" in every script that needs it.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to