Loading ...
Sorry, an error occurred while loading the content.

25947Re: [PBML] Eval and memory problems

Expand Messages
  • Jenda Krynicky
    Jan 9, 2008
      From: "computerdribble" <computerdribble@...>
      > I humbly thank ALL who have read or responded.
      > Can you, with all of the examples to date...
      > do away with the EVAL of the variable that contains the testing
      > information and just do a straight macro expansion ?
      > $this = "that"
      > $that ="this"
      > $test = ' ( ( "that" =~ /at/) and ( "this" =~ /at/ ) ) '
      > something like @{[ $$test ] }

      No. You can't. It's as simple as that.

      If you did not store the expression like this in the database, but
      instead stored the name of the variable and the regexp (and nothing
      else) in separate columns you could do something like

      if ($data{$varname} =~ /$regexp/) {

      where the $varname and $regexp comes from the database. Whether that
      would be enough for you, I don't know.

      Even in this case though it would be better to preprocess the

      foreach my $test (@tests) {
      # $test = [$varname, $regexp]
      eval {
      $test[1] = qr/$test[1]/
      } or die qq{Invalid regexp /$test[1]/ : $@\n};

      This way the regexps are parsed and compiled just once instead of
      each time they are used.

      > I'm sorry to have ruffled so many feathers, but just because one has
      > 20 years of experience in a language does not mean they should look
      > down on someone TRYING to learn it. Much less understand it andits
      > quirkiness.
      > ...

      I think all this was unnecessary. Noone's picking on you.

      > As for "top loading or top responding" Not my fault, blame Yahoo for
      > doing that way.. hell blame the whole freaking internet for it,
      > because that's just how it is done. Talk to the hand.

      The fact that Yahoo (by default?) formats replies one way doesn't
      mean you have to keep it that way. Top-posting is quite OK for
      personal emails to a single recipient. For mailing lists its ... not
      working too well. Always try to make it easy to the people you are
      asking for help, even if it means you spend two more minutes
      formatting the email.

      ===== Jenda@... === http://Jenda.Krynicky.cz =====
      When it comes to wine, women and song, wizards are allowed
      to get drunk and croon as much as they like.
      -- Terry Pratchett in Sourcery
    • Show all 15 messages in this topic