in reply to Interpolating Property strings help.

Please help.

I'm not sure I can help you solve your problem as it seems you've left out some of the code that produces the result. How does your $List variable get populated, for instance?

I can make some suggestions that might help you clean up your code regardless of whether they fix your problems.

I have another suggestion that I didn't want to include in the above list because it is purely a matter of style and you may not even have a choice depending on coding guidelines in your environment. Consider naming your variables like $foo_bar rather than $fooBar. I strongly agree with those that claim it makes for much more readable code.

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re: Re: Interpolating Property strings help.
by krisahoch (Deacon) on Jan 25, 2003 at 04:29 UTC

    sauoq,

    Thank you for the suggestions. I will try the regex this monday. I need to reply to a couple of your points though

    Get rid of your isDefined() subroutine. All it is doing is allowing you to replace
    I am not the only one who uses this function. It has great meaning somewhere else

    Consider making your regexen more robust in general.
    The regex I chose is exactly what I am requireing. There is to be no whitespace allowed when expanding property values

    The $substituteThis and $substituteWith variables were used before I asked for help. I just hadn't pruned them out yet. I will rename $extractedVariable to $extractedVariableName

    The style thing. I come from a C programming background into a Perl and then Java. My preference is the Java variety.


    Kristofer Hoch

    Si vos can lego is, vos es super erudio

      A routine that turns defined $hashref->{$key} into $self->isDefined($hashref, $key) doesn't seem to have any purpose other than obfuscation to me. At least as far as I'm concerned, your code immediately became twice as clear once I substituted that for defined.

      Maybe it's an interface consistence thing that makes you have this method in your class - but that doesn't mean your routine should be using it.

      Makeshifts last the longest.