Help for this page
$ssh->system("cd $dir && tar czf /tmp/file.tgz .");
$ssh->system({stdout_file => '/tmp/file.tgz'}, "cd $dir && tar czf - . +");