Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

programming questions - passing parameters

Quote Reply
programming questions - passing parameters
Alex,

Is there any good rule of thumb when to use shift vs @_ array assignment in passing parameters?

Is there any place where using one over the other will come back to bite you?

If a reference is passed, it seems best to use 'shift' and you are using the same dataset. But using @_ is more problematic. If you assign the passed values to a list, you are using copies of the passed values. In most cases, this is what you want to do, since trying to operate on the values in @_ can lead to problems.

Looking at the GT module code, both forms are used.

Is it better to "shift" references, but assign variables/data to local variables?

I'm breaking up the routines into modules, hopefully each of which could stand alone.

The first user passed parameter has to be the $PLUGIN_NAME, so the local routine knows what $PLUGIN_CFG to get.

I don't see any mod_perl problems with that... Passed parameters are evaluated each time.



PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Plugins:http://LinkSQL.com/plugin
Subject Author Views Date
Thread programming questions - passing parameters pugdog 2845 Jul 20, 2001, 10:00 PM
Thread Re: programming questions - passing parameters
Alex 2755 Jul 31, 2001, 12:32 AM
Post Re: programming questions - passing parameters
pugdog 2736 Jul 31, 2001, 1:57 PM