Skip to content

MooX::Options::Role _options_fix_argv strips leading and trailing quotes from parameter values #68

Description

@jmccarv

This bit of code in the _options_fix_argv routine of MooX::Options::Role strips leading and trailing quotes:

#remove the quoted if exist to chain
$_[0] =~ s/^['"]|['"]$//gx;

This is a problem when you want to preserve those quotes. A small example:

#!/usr/bin/env perl

package Test;

use Moo;
use MooX::Options;

option test => (
    is         => 'ro',
    short      => 't',
    format     => 's',
);  

1;

package main;

my $t = Test->new_with_options;
print $t->test."\n";

Run the above:

./test.pl -t "This is 'a test'"
This is 'a test

When I would expect to see

This is 'a test'

as its output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions