In general tide calculations are horribly complicated because they are not only influenced by obvious things like the phase of the moon, but also by the topography of the sea floor in the "local" area. For accurate tide predictions for a specific location you need to obtain coefficients for the set of significant parameters used in a tidal model (maybe 30-60 of them!). The parameters are generally calculated from tide data collected over a longish period (19 years) for the location of interest! See Theory_of_tides#Tidal_constituents for a discussion of some of these parameters.
Writing a Perl module to perform the required calculations would not be particularly hard, but the result is likely to be slow. Obtaining the coefficients is likely to be a harder problem than writing the code to perform the calculation.
True laziness is hard work