start converting stdio->perlio
convert rest of funct to PerlIO