Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPAN::Meta::Converter needs to support converting metadata fragments #41

Closed
dagolden opened this issue Nov 24, 2013 · 5 comments
Closed

Comments

@dagolden
Copy link

Per #40 we need a way of converting fragments as might be given by meta_merge fields into a specific version.

Something like this:

$cmc->convert_fragment( from_version => "1.4", to_version => "2" );

This could pick off pieces of the conversion specs. We need the "from_version" unlike the "convert" method because a fragment won't necessarily have a meta-spec field. (Though we could mandate one, I suppose.)

Alternatively, this could be done via an option to "convert", in which case, we do need to mandate a meta-spec field, and the conversion needs to use spec fields that match the input fields.

@Leont
Copy link
Member

Leont commented Nov 25, 2013

I suspect the ideal would be to have a default_from_version argument or some such. Being able to explicitly give the meta-spec is kind of required for this to be workable but different tool may have different sensibilities on what'd be the best default.

@dagolden
Copy link
Author

CMC is per-hash:

$cmc = CPAN::Meta::Converter->new( $struct )

So I suppose we could let that take options:

$cmc = CPAN::Meta::Converter->new( $struct, { version => "1.4" } );

And then:

$cmc->convert( version => "2" )

Possibly, new should blow up if the provided version conflicts with meta-spec.

@dagolden
Copy link
Author

FWIW, internally, CMC already has a 'spec' field, so that's probably the way to go:

$cmc = CPAN::Meta::Converter->new( $struct, { spec => "1.4"} );

Though we probably still need some way to not generate new fields, so maybe this:

$cmc = CPAN::Meta::Converter->new( $struct, { spec => "1.4", fragment => 1} );

@karenetheridge
Copy link
Member

Is this totally done now?

@xdg
Copy link
Contributor

xdg commented Jun 23, 2016

This is done with CPAN::Meta::Merge.

@xdg xdg closed this as completed Jun 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants