in reply to Re: Passing arguments to functions.
in thread Passing arguments to functions.

The use of symbolic reference is an elegent solution for a 'use once' script. The effort to write a hash of hard references (Called 'dispatch table' in a previous post) will probably be repaid in the maintainence of 'industrial strength' software. Unfortunately, most perl applications lie somewhere inbetween, where the choice is one of preference.

Replies are listed 'Best First'.
Re^3: Passing arguments to functions.
by BrowserUk (Patriarch) on Apr 25, 2012 at 13:58 UTC
    The effort to write a hash of hard references (Called 'dispatch table' in a previous post) will probably be repaid in the maintainence of 'industrial strength' software.

    Sorry, but you do not know what you are talking about.

    The code I posted uses a hash-based dispatch table. It is called the symbol table.

    There is simply no advantage to adding another layer of indirection here; and no additional risk or maintenance effort in avoiding that extra layer.

    Which makes all your talk of "use once" and "industrial strength", nothing more than cargo-culted, pseudo-CompSci balderdash!


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

Re^3: Passing arguments to functions.
by Anonymous Monk on Apr 25, 2012 at 14:00 UTC

    You don't need symbolic references at all

    #!/usr/bin/perl -- use strict; use warnings; use CGI; sub dier { die " dier die @_ " } warn main->can('CGI::new')->(); main->can('dier')->( 'now' ); __END__ CGI=HASH(0x99a1fc) at - line 5. dier die now at - line 4.