in reply to problem with explicit package name

After adding a
my $printErrMsg;
and
sub writeLogin { }
That code compiled fine for me. It's probably something above that section of code.