|go ahead... be a heretic|
You may be not totally lost yet!
The "small" .pl program probably works as some kind of scheduler, calling the appropriate sub-routines from the .lib file as and when needed.
Mind you, using a .lib file instead of a properly packaged module (.pm) is certainly not considered a standard in the Perl-world.
Anyhow, the fact that subroutines are used in this .lib file is something "good".
Indeed, the way to go forward is trying to figure out what each sub-routine does. Even more important is to find out how the flow of execution runs through all these subroutines.
Knowing that, you can establish some hierarchy, see what data is passed around (in and out of the subroutines; do not forget that "global" variables may muddle/mess up this picture!) and what gets send to the web by which subroutine.
Having discovered all this you can then proceed, to carefully take apart the things which need to be changed and apply the necessary changes. It may seem like a chore but all this preparative work will help you later.
'Time spent in reconaissance is seldom wasted' they told us in the Army (to which one replied "A good scout is a dead scout" (Gen. Sherman, if I'm not mistaken))
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law