sub new { my $proto = shift; my $class = CORE::ref $proto || $proto; # yes, I know what I'm doing return $class->_new_var unless @_; if (2 == @_) { # more common (performance) return _new_from_functor_and_arity($class, @_) unless 'ARRAY' eq CORE::ref $_[1]; } elsif (1 == @_) { my $arg = shift; return _new_with_id($class, $arg) if ! CORE::ref $arg && $arg =~ /^[[:digit:]]+$/; return _new_from_string($class, $arg) if ! CORE::ref $arg; return $arg->_term($class) if CORE::ref $arg && $arg->isa(Parser); } require Carp; Carp::croak("Unknown arguments to Term->new"); }