Skip Menu |

This queue is for tickets about the Database-Migrator CPAN distribution.

Report information
The Basics
Id: 92726
Status: resolved
Priority: 0/
Queue: Database-Migrator

People
Owner: Nobody in particular
Requestors: lasse [...] unity3d.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.10



Subject: Overriding username, password, host and port from the command-line
Date: Tue, 4 Feb 2014 15:52:24 +0100
To: bug-Database-Migrator [...] rt.cpan.org
From: Lasse Makholm <lasse [...] unity3d.com>
Overriding username, password, host and port from the command-line doesn't work because MooseX::Getopt doesn't know what to do with isa => Maybe [Str] . See MooseX::Getopt bug#85030: https://rt.cpan.org/Public/Bug/Display.html?id=85030 An easy workaround is to just use isa => Str with no default value instead an explicit default => undef. Patch attached. /Lasse

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #92726] Overriding username, password, host and port from the command-line
Date: Tue, 4 Feb 2014 09:40:30 -0600 (CST)
To: Lasse Makholm via RT <bug-Database-Migrator [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
On Tue, 4 Feb 2014, Lasse Makholm via RT wrote: Show quoted text
> Tue Feb 04 09:52:35 2014: Request 92726 was acted upon. > Transaction: Ticket created by lasse@unity3d.com > Queue: Database-Migrator > Subject: Overriding username, password, host and port from the command-line > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: lasse@unity3d.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=92726 > > > > Overriding username, password, host and port from the command-line doesn't > work because MooseX::Getopt doesn't know what to do with isa => Maybe [Str] > . > > See MooseX::Getopt bug#85030: > https://rt.cpan.org/Public/Bug/Display.html?id=85030 > > An easy workaround is to just use isa => Str with no default value instead > an explicit default => undef.
That won't actually work. If the default ends up being applied you'll get a type error since undef is not a valid Str. I think the fix is to provide a type map for Maybe[Str] to MooseX::Getopt. -dave /*============================================================ http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) ============================================================*/
Subject: Re: [rt.cpan.org #92726] Overriding username, password, host and port from the command-line
Date: Tue, 4 Feb 2014 16:45:33 +0100
To: bug-Database-Migrator [...] rt.cpan.org
From: Lasse Makholm <lasse [...] unity3d.com>
It does work. I'm using it. :-) It works because there is no default value on the Moose attribute causing it to be not set at all if you don't supply the option for it. The accessor will just return $self->{$key} which is undef if $self->{$key} doesn't exist. /Lasse On Tue, Feb 4, 2014 at 4:40 PM, autarch@urth.org via RT < bug-Database-Migrator@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=92726 > > > On Tue, 4 Feb 2014, Lasse Makholm via RT wrote: >
> > Tue Feb 04 09:52:35 2014: Request 92726 was acted upon. > > Transaction: Ticket created by lasse@unity3d.com > > Queue: Database-Migrator > > Subject: Overriding username, password, host and port from the
> command-line
> > Broken in: (no value) > > Severity: (no value) > > Owner: Nobody > > Requestors: lasse@unity3d.com > > Status: new > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=92726 > > > > > > > Overriding username, password, host and port from the command-line
> doesn't
> > work because MooseX::Getopt doesn't know what to do with isa => Maybe
> [Str]
> > . > > > > See MooseX::Getopt bug#85030: > > https://rt.cpan.org/Public/Bug/Display.html?id=85030 > > > > An easy workaround is to just use isa => Str with no default value
> instead
> > an explicit default => undef.
> > That won't actually work. If the default ends up being applied you'll get > a type error since undef is not a valid Str. > > I think the fix is to provide a type map for Maybe[Str] to MooseX::Getopt. > > > -dave > > /*============================================================ > http://VegGuide.org http://blog.urth.org > Your guide to all that's veg House Absolute(ly Pointless) > ============================================================*/ > >
Subject: Re: [rt.cpan.org #92726] Overriding username, password, host and port from the command-line
Date: Tue, 4 Feb 2014 09:50:28 -0600 (CST)
To: Lasse Makholm via RT <bug-Database-Migrator [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
On Tue, 4 Feb 2014, Lasse Makholm via RT wrote: Show quoted text
> Queue: Database-Migrator > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=92726 > > > It does work. I'm using it. :-) > > It works because there is no default value on the Moose attribute causing > it to be not set at all if you don't supply the option for it. The accessor > will just return $self->{$key} which is undef if $self->{$key} doesn't > exist.
Oh, I misread your email where you said "instead of an explicit undef". Anyway, I think it might be a little cleaner to just provide the type map to MooseX::Getopt if that works. -dave /*============================================================ http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) ============================================================*/
Subject: Re: [rt.cpan.org #92726] Overriding username, password, host and port from the command-line
Date: Tue, 4 Feb 2014 17:03:58 +0100
To: bug-Database-Migrator [...] rt.cpan.org
From: Lasse Makholm <lasse [...] unity3d.com>
Possibly... I didn't dig into it but my impression from RT#85030 is that it can't work without some additional code in MooseX::Getopt, so this seemed like a reasonable workaround... /Lasse On Tue, Feb 4, 2014 at 4:50 PM, autarch@urth.org via RT < bug-Database-Migrator@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=92726 > > > On Tue, 4 Feb 2014, Lasse Makholm via RT wrote: >
> > Queue: Database-Migrator > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=92726 > > > > > It does work. I'm using it. :-) > > > > It works because there is no default value on the Moose attribute causing > > it to be not set at all if you don't supply the option for it. The
> accessor
> > will just return $self->{$key} which is undef if $self->{$key} doesn't > > exist.
> > Oh, I misread your email where you said "instead of an explicit undef". > > Anyway, I think it might be a little cleaner to just provide the type map > to MooseX::Getopt if that works. > > > -dave > > /*============================================================ > http://VegGuide.org http://blog.urth.org > Your guide to all that's veg House Absolute(ly Pointless) > ============================================================*/ > >