in reply to Appropriate use of typeglob

Oh my, oh my.. I beg for a pardon, but would you please consider first answering this question:

WHY do you need to use the typeglob and what good does it do in your particular example!? Remove the useless '*$' parameter that you are passing to a bunch of 'foo#' subroutines and the code should still print out the same exact stuff! To begin with, you don't even make any use of the passed parameter inside neither of your subroutines.

If you are attemping to play with typeglobs just because they appear to be a 'cool' thing to play with, please steer away from them. Otherwise, err... I'd like to see a piece of code of yours which indeed does make a good use of them.

Update: aseidas, happy to see that you took my question seriously and were not repulsed by it's apparent 'coldness' ;).

With regard to typeglobs, they are not entirely a bad thing. Sorry if that is how it came through from my initial reply. However, they could be easily abused, especially at the hands of an inexperienced or a novice or plain ignorant (not you, however :) perl programmer.

In responce to your point #3, I should point out that passing variables to a subroutine in Perl is rather trivial. I would suggest you read some introduction books on Perl programming to get the idea. Also, one of the replies to your initial posts includes a good & simple example for you to look at.

Cheers ;-)

_____________________
# Under Construction

Replies are listed 'Best First'.
Re: Re: Appropriate use of typeglob
by aseidas (Beadle) on Jul 11, 2002 at 03:28 UTC
    Okay I will answer your questions, but first I will say, in the way you responded to mine, you have answered it. I was trying to find out if typeglobs were 'evil' and I think you pretty much summed up in few words that they are.

    1.You are right, it wasn't doing any good in my example. The intention was to use it in pulling in a config with about 100 variables I though it might be helpful.

    2.I didn't intend to make use of the passed parameter in the subroutines yet, it was just a test.

    3.I wasn't trying to pass with the typeglob because I thought it was 'cool' I was honestly trying to solve a problem, the problem being passing several variables to a subroutine easily.

    4.Also I did follow your suggestion and deleted the useless *$ param and indeed you were correct it still generated the same ouput. Is that not how I would pass the typeglob?

    You absolutely did answer my question, I will steer clear of the evil typeglob from this point on.

    Thanks so much for the quick and direct response ! -Aseidas