Are you sure that code that gave that error? Aside from the lack of anything related to login on line 6, I can't see that code giving that particular error. (I would expect <<Can't call method "login" on an undefined value>> or <<Can't locate object method "login" via package "XXX">> if anything.) That error would occur if the $ssh-> in $ssh->login was missing.