in reply to Re: Double quoted string as method call
in thread Double quoted string as method call

Apologies, but it appears you have posted my code incorrectly in the very first part of your post. Particularly, at the alleged $s->(). I am not sure how key this is to your assertion my code is not strict-compliant .

I have re-read what I posted and cannot find where I ever call $s as the object or class. I call $s as a method to $caller, ie $caller->$s.

In any case, I have a close relative of the code I posted running fine under strict:

$$database_handle = DBI->connect(( map { my $s="database_$_"; exists $arguments{$_} ? $arguments{$_} : $caller->$s() } (qw(data_source_name username password)) ), {Taint=>$arguments{taint}||$caller->database_ta +int} ) or die "Could not connect to the database: $DBI:: +errstr" unless defined $$database_handle;

Please note $$database_handle is not meant to be a symbolic reference. You would need to see the whole module. $database_handle is a reference to a reference (to a handle), which I create earlier in the method because the particular reference (handle) used depends on whether the method is called on a class or an object.

Thanks for the rest of your post -- I will read it over. But, again, no problems with stricture!

Replies are listed 'Best First'.
Re: Re: Re: Double quoted string as method call
by jarich (Curate) on May 06, 2004 at 04:17 UTC
    My apologies, you're completely right.

    I dropped the $caller bit for my testing and then promptly forgot that I had done so and therefore incorrectly concluded that since what I had wasn't strict compliant, what you had couldn't be either.

    I considered that $$database_handle could be either a symbolic reference or a scalar reference and that is why I wrote that it too could cause you problems under strict, rather than it does.

    I should have checked my assumptions.

    All the best,

    jarich