Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • It's working exactly as documented.

    local() changes something for its current scope _until_ it exits that scope _at runtime_. It's a runtime, temporary effect.

    You're expected a compile time effect, basically.

    I agree that the docs aren't so hot, though.
  • duh.

    I need a vacation.
  • It seems to me that you could get around this with a blessed closure that would hold onto the dbh. An autoload method would dereference the closure, and pass it the method name you wanted (to call against the dbh), and any arguments you need to pass it. And the closure would then be something like:

    sub {
      my ($method, @args) = @_;
      local $dbh->{RaiseError} = 0;
      local $dbh->{AutoCommit} = 1;
      return $dbh->$method( @args );

    Does that sound like it