zigdon / xkcd-Bucket

Bucket is the channel bot for #xkcd
http://wiki.xkcd.com/irc/Bucket
121 stars 31 forks source link

Minor fixups for newer versions of MySQL and Perl #102

Closed kbembedded closed 7 years ago

kbembedded commented 7 years ago

Migrated my bucket clone to a newer system, ran in to some headaches due to newer MySQL and Perl versions.

MySQL STRICT_TRANS_TABLES was causing issues when setting factiods. RE field was not being set by bucket.pl and therefore MySQL just dropped the transaction. If RE is set to have a default value, this is not a problem.

Perl was complaining about unescaped left braces on a number of regex lines. I guess this was deprecated at some point.

dgw commented 7 years ago

I'll attempt to pull this PR into my pr-testing branch when I get a chance, and see what happens. When you say "bucket clone", do you mean a modified copy from which you're porting those changes that apply here, or just an instance running the code in this repo?

Migrated my bucket clone to a newer system, ran in to some headaches due to newer MySQL and Perl versions.

For historical purposes, do you know what the old and new versions of MySQL and Perl are? Could be useful info for the README, though all of these changes should be backward-compatible.

If RE is set to have a default value, this is not a problem.

MySQL default value of RE=0 is a no-brainer, especially since nothing actually tries to look for regex in factoids yet (ref: #36).

Perl was complaining about unescaped left braces on a number of regex lines. I guess this was deprecated at some point.

Yep, unescaped left brace was indeed deprecated. Immediately found a discussion on PerlMonks.

kbembedded commented 7 years ago

Sorry, by "bucket clone" I mean I have my own instance of the code in this repo (I have made some changes, but only to tune options to my liking, those are not included here, obviously).

Old versions: Perl 5.20.3 MySQL server 5.7.15 (hilariously enough, explicitly disabled STRICT_TRANS_TABLES without realizing it when doing initial setup)

New versions: Perl 5.24.1 MySQL server 5.6.35 (FreeBSD install defaulted to setting STRICT_TRANS_TABLES)

Other alternative would be to modify the main perl script to set an RE value when inserting in to bucket_facts. I don't speak perl very well so I went the easier route with my change to the database table itself.

dgw commented 7 years ago

Happy with this after all these weeks of testing.