develooper Front page | perl.perl6.users | Postings from July 2017

Re: Version of a Module

Thread Previous | Thread Next
From:
Martin Barth
Date:
July 4, 2017 18:45
Subject:
Re: Version of a Module
Message ID:
956e69a6-ddba-349d-69c3-cf2c03f94b38@senfdax.de
Hi there,

is this a bug?

 > perl6 -Ilib -e 'require Bailador; say Bailador.^ver'
No such method 'ver' for invocant of type 'Perl6::Metamodel::PackageHOW'
   in block <unit> at -e line 1

vs

 > perl6 -Ilib -e 'use Bailador; say Bailador.^ver'
v0.0.7

it seems that there a 2 different metaclasses being used:

 > perl6 -Ilib -e 'use Bailador; say Bailador.HOW'
Perl6::Metamodel::ModuleHOW.new

 > perl6 -Ilib -e 'require Bailador; say Bailador.HOW'
Perl6::Metamodel::PackageHOW.new


Am 28.06.2017 um 14:16 schrieb Simon Proctor:
>
> See I'm using mi6 to generate my META6.json file from the report and 
> it picks the version up from the module file. Other options like that 
> seem sensible to me.
>
> Simon
>
>
> On Wed, 28 Jun 2017, 13:01 Martin Barth, <martin@senfdax.de 
> <mailto:martin@senfdax.de>> wrote:
>
>     Hello,
>
>     but your approach means you have to state the version in the
>     META6.json AND in the Module.pm6 file again. This would be the
>     similar to having $VERSION in perl5. Shouldnt there be a simpler way?
>
>
>     Am 28.06.2017 um 08:45 schrieb Fernando Santagata:
>
>>     Hi Martin,
>>
>>     This works for me:
>>
>>     File mytest.pm6
>>
>>     use v6;
>>     unit module mytest:ver<0.0.1>;
>>
>>     sub myver is export
>>     {
>>       mytest.^ver;
>>     }
>>
>>     File mytest.p6
>>
>>     #!/usr/bin/env perl6
>>     use lib '.';
>>     use mytest;
>>
>>     say myver;
>>
>>     Console output:
>>
>>     $./mytest.p6
>>     v0.0.1
>>
>>     I this what you meant?
>>
>>     On Tue, Jun 27, 2017 at 10:37 PM, Martin Barth <martin@senfdax.de
>>     <mailto:martin@senfdax.de>> wrote:
>>
>>         Hello everyone,
>>
>>         I wanted to repeat the question that I asked today on #perl6.
>>         I am looking for a way to retrieve the version of a
>>         Perl6-Module from within the module itself.
>>
>>         <ufobat> there is often a our $VERSION in perl5 modules. is
>>         this still idiomatic/a good way to go in perl6
>>         <timotimo> i think the version is meant to be part of the
>>         meta info and such?
>>         <ufobat> but that means the module itself does not know about
>>         its version, just e.g. zef does?
>>         <timotimo> i'm convinced there ought to be a way to get the
>>         full meta info from whatever installation your script was
>>         grabbed from
>>         <timotimo> but i don't know what or how
>>
>>
>>
>>
>>     -- 
>>     Fernando Santagata
>


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About