I would take your text_block() subroutine, and either
submit it to the PDF::API2 author for inclusion in that module, or submit it to CPAN as "PDF::API2::TextBlock" or some such.
in reply to Review request for PDF::API2 Tutorial
That would give it wider exposure, put it under real version control, provide a central place for storing/updating it, etc. (all the advantages of CPAN.)
It would also simplify your tutorial, since you can
concentrate on the use of the subroutine rather than its internals.