
rovf
Veteran
Jul 1, 2011, 2:24 AM
Post #6 of 8
(1219 views)
|
|
Re: [FishMonger] Can't use string ("value_0") as an ARRAY ref while "strict refs" in use at ch.pl line 8. error
[In reply to]
|
Can't Post
|
|
Gotcha! ;-) If you look at the source code of, say, Class::Accessor, you will see that this code employs "no strict 'refs'" for exactly the same reason I pointed out. The same is true for other modules which can be used for this task, for example Class::Struct (which is part of the standard distribution). So, the question is IMO not so much whether there *are* occasional (rare) usages for using symbolic references - as we can see, they are -, but whether in the project I have seen, it was a good idea to manually implement the accessor functions, or whether to base the design on a module which already exists on CPAN. I personally often use CPAN stuff, but it also happens that I find modules on CPAN which only halfway do what I want, and then I download them, rename them and change them in the way I want. The distinction between code I write and code I reuse gets a bit blurred in this way...
|