It is not what you asked but lines 41 to 53 look wrong to me. Firstly if that while loop is executed more than once (in otherwords if $maxlen is less than the size of the file) you will insert multiple rows into your table. You are probably getting away with this because your manual.pdf is smaller than maxlen. Also wouldn't it be better to check what read returns rather than what has been read.
Also, what if max_allocated_packet was less than 100_000 - you've got a problem.
Lastly, are you sure you want a unique constraint on the combination of id and name? As id is an auto increment that will mean you can have two rows with the same name. Your remove sub rather suggests you expect name to be unique but that is a guess on my part.