Can we get ->mo->yaml and ->mo->json? #230

mscha opened this Issue Feb 23, 2013 · 2 comments


None yet

3 participants

mscha commented Feb 23, 2013

Having to type
is way too annoying. And it wastes 16 bytes and a couple of seconds every time you use it.
Can we get
as a shortcut, just like we have
(Same thing for json, and any other formats (xml?) that might be added for dump.)

@schwern schwern referenced this issue Feb 24, 2013

Dump as XML? #231

schwern commented Feb 24, 2013

Though I couldn't give a lick about "wasting" 16 bytes, making it even
easier to dump in JSON and YAML makes sense to me.

I have reservations about XML. JSON and YAML are fairly straight
forward translations, but XML is not. However, we don't even do XML yet
so we can blow up that bridge when we come to it.

I request discussions about XML dumping happen in #231.

Since we're going to have more dumping methods, I'd suggest a
nomenclature change. as_blah seems to be the standard name for
methods. This avoids cluttering the meta namespace with random formats
and makes it a bit clearer what they do and how to find them.

perl -> as_perl
yaml -> as_yaml
json -> as_json

This should be a fairly straight forward patch. The code is in
perl5i::2::Meta::Instance. The individual dumper methods exist as
perl, _dump_as_json and _dump_as_yaml. Fiddle the names and the
tests in t/dump/. Leave an alias from as_perl to perl for
compatibility and we can get rid of it in perl5i::3.

Go to it!

@notbenh notbenh pushed a commit to notbenh/perl5i that referenced this issue Mar 5, 2013
ben hengst Adding the as_* methods as requested in #230
  - the test is calling ::2 directly rather then latest.
    I was unsure on the going convention for a version specific change
  - I am not using alias to build the aliases.
    It seemed a bit heavy handed so I am using the old-style delegation.
schwern commented Mar 6, 2013

Now they just need to be documented in perl5i::Meta::Instance. Don't forget that perl is now a backwards compatibility method and as_perl is the real one.

@notbenh notbenh was assigned Mar 6, 2013
@schwern schwern added a commit that closed this issue Mar 18, 2013
@schwern schwern Document ->mo->yaml and ->mo->json
Fixes #230
@schwern schwern closed this in 4f01071 Mar 18, 2013
@notbenh notbenh was unassigned by mscha Jul 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment