in reply to My first thought was to build a macro... was I right?

These two routines are very similar. There are ways to refactor them to eliminate redundancy.

Refactoring is less about making the code smaller than it is making the code more supportable. Usually the two go together, but not always. If you misplace these goals, you end up with smaller, less supportable code.

Both of your routines are succinct. The only refactoring I see that doesn't significantly reduce readability would be to add something like

sub LOGifError { my ($o, $what, $err) = @_; $o->LOG('error', "$what: $error") if $error; }
Then you can rewrite the error handling to   $o->LOGifError($tree, $@);

Or, if you want to "remove" two duplicate lines from each routine without adding a new method, rewrite

if ($@) { $o->LOG('error', "$tree: $@"); }
to   $o->LOG('error', "$tree: $@") if $@; This latter rewrite is what I'd do.