And line 7 is the line where you try to talk to the agent. I presume that the environment variables are set up so that the domain socket etc. are found?
Does the error message change when you set the environment variables ($ENV{SSH_AUTH_SOCKET} ?) to some invalid value before creating $ssh2?
Does your Perl process run as the same user as the ssh process you're using to connect?
Maybe consider setting trace => -1 in the constructor to dump lots (and lots) of information, and maybe compare that to what the ssh -vvv executable does. Maybe there is a difference that shows up?
my $ssh2 = Net::SSH2->new(trace => -1);