##- Please type your reply above this line -##
Your request (#142913) has been received and is being reviewed. A summary of your correspondence can be found below.
To add additional comments, please reply to this email.
Our website contains answers to many frequently asked questions. Please try these resources first, and don't forget to please follow up here if you've found an answer.
Support Center:
https://support.maxmind.com/
MaxMind Developer FAQ:
http://dev.maxmind.com/faq/
Our business hours are 9:30 - 21:00 Eastern Time Monday - Friday. If you require immediate assistance, you may talk to a MaxMind staff member anytime during these hours via our chat client, located at www.maxmind.com.
- MaxMind Team
----------------------------------------------
Bug-database-migrator, Mar 7, 14:32 EST
Queue: Database-Migrator
Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=128647 >
On 2019-02-26 17:21:53, me@jonathangazeley.com wrote:
Show quoted text> Hi there,
>
> I'm trying to implement Database::Migrator as a component of an existing
> Perl project. I've got the simple example working with more-or-less the
> example from the docs:
>
> #!/usr/bin/env perl
> use strict;
> use warnings;
> use Database::Migrator::mysql;
> Database::Migrator::mysql->new_with_options()->create_or_update_database();
>
> However I'm struggling to understand how to follow your advice: "You can
> simplify this by subclassing the implementation class". I'm quite
> comfortable with Perl as a language but much more hazy on
> classes/packages and the more application side of things. Please could
> you say a few words and give an example of how I could implement this
> effectively as a sub I can call from my main application? My end goal is
> really to have the application check for database compatibility on
> startup and invite the user to upgrade the schema if necessary.
The RT queue isn't the best place for support request so I'm going to close this.
To answer your question, check out
https://perldoc.perl.org/perlootut.html for an OO tutorial for Perl. Database-Migrator uses Moose, so you can make a subclass by writing this:
```
package MySubclass;
use Moose;
extends 'Database::Migrator::mysql;'
sub ...
```
That all said, these days I'm using Sqitch (
https://sqitch.org/) to manage my migrations, and I think it's a generally better tool.
--------------------------------
This email is a service from MaxMind.
[3Q459O-8Q20]