move functions to perllib

open() have been moved to perllib.c and the macros have been moved to perllib.h