You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We often don't care to get the result object back, we just need to ensure that the Perl version exists in the database.
This code requires the reader to know that the version field is parsed to find all the other information in the perl_version table. If some other field is used instead, like perl, the data will not be correct.
It would be better if we had a method named ensure_exists that takes a single argument, the Perl version string. It would be called like this:
Right now, the correct way to ensure a Perl version exists in the
perl_version
table is to do:This is less than optimal for two reasons:
version
field is parsed to find all the other information in theperl_version
table. If some other field is used instead, likeperl
, the data will not be correct.It would be better if we had a method named
ensure_exists
that takes a single argument, the Perl version string. It would be called like this:This reads better, and we can improve performance slightly inside by not creating a result object.
The text was updated successfully, but these errors were encountered: