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
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