Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: subroutine ref while "strict refs"

by viffer (Beadle)
on Jul 28, 2014 at 09:08 UTC ( #1095311=note: print w/replies, xml ) Need Help??


in reply to subroutine ref while "strict refs"

I can probably put
if ($sub_routine =~ /check_char/} { check_char ($value1, $value2); }
but is there a neater way? If someone else changes the record layout and adds a new subroutine, then the code would need to be changed to cater for it, which probably isn't ideal.

Replies are listed 'Best First'.
Re^2: subroutine ref while "strict refs"
by BillKSmith (Monsignor) on Jul 28, 2014 at 12:09 UTC
    If anyone adds a subroutine, you will at least need a new 'use' statement to reference it. There does not seem to be much advantage in eliminating the need for other changes. Use a method that is clear and easy to modify. I like the dispatch table. Add a new entry for each new subroutine.
    Bill
      If anyone adds a subroutine, you will at least need a new 'use' statement to reference it.

      What?

        I understood that the OP considered his symbolic references an advantage because a user could add new subroutines without modifying the original script. My point is that it is unlikely that this is possible. The additional effort to add a hard reference to a dispatch table is insignificant if you have to modify the script anyway.
        Bill

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1095311]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2022-05-22 14:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (80 votes). Check out past polls.

    Notices?