in reply to Re: Re: detecting $& usage
in thread detecting $& usage

Perhaps a simple check of their code for the offending variables, and then either reject them, or run them via a system() call to a seperate Perl process. At least that way a single use of the variables wont affect the entire body of code.

Unfortunately the problem here is that if the engineers are crafty it will be nearly impossible to prevent them from using these vars or for detecting when they have done so.

Which means that in the end Abigail is correct. The best way to resolve this problem is to train the engineers not to use them.


---
demerphq

    First they ignore you, then they laugh at you, then they fight you, then you win.
    -- Gandhi


Replies are listed 'Best First'.
Re: Re: Re: Re: detecting $& usage
by greatdane (Beadle) on Jan 27, 2004 at 22:51 UTC
    Thanks to everyone for all the help. This is a great site! Yes, the engineers are smart and numerous. Its hard to stop all the engineers from coding the wrong thing. Currently, the only indicator is a servere code slow down. I would prefer a more explicit indicator - a warning or blocked access. Thus, this thread. Scanning the user code is not that useful as many engineers will include (require/use) code from libraries. So, the check difficult. Its unfortunate that the test of "defined $&" causes the slow down. I will have to try the blocking tricks.

      I think you may want to reengineer what is happening a bit.

      Basically what im thinking is that you have a manager script that prepares all the appropriate stuff, and then spawns a new perl to actually run the engineer code. Thus the engineer code runs in a seperate process under a seperate perl every time. Youll get some slowdown from marshalling data between the manager script and the worker script, but it should be workable and overall resolve the problem of unexpected use of $&.

      Also with regard to your library usage, surely you can do a grep of your lib directories and simply remove or modify any library that has the offending vars in it. Obviously it would make your system non-standard, but it sounds like you have somewhat unusual requirements.


      ---
      demerphq

        First they ignore you, then they laugh at you, then they fight you, then you win.
        -- Gandhi