I don't know if you can disable the warning without modifying the source code, but one way to capture the warning is to use
eval
use strict;
use warnings;
use Tree;
my ($i, $T, $n);
$T = Tree->new('root');
my $t = $T;
for($i=0;$i<100;$i++){
$n = Tree->new("child $i");
eval { $t->add_child({}, $n); };
if ($@) {
# take some action...
}
$t = $n;
}
print "success\n";
Then you can decide what action to take.
My guess is that the NONFATAL attempt did not work because it is in the wrong scope; NONFATAL would have to be used inside the Tree module.