I've decided to try to get Vector on there, and document what I'm doing as I do it. Not that I think Vector is particularly brilliant, or that it should go in the Perl 6 CPAN when there is such a thing. But I hope it is at least both a pretty good example of how to do this sort of thing in Perl 6, and potentially a useful tool someone else could build on.
So I'm looking in the proto
PIONEER
file. It lists four conventions that need to be followed, the first of which is creating a deps.proto
file. Vector doesn't have any dependencies; I'm not sure if having an empty file or no file is a better way of indicating that. I'm guessing an empty file, as that suggests that I have at least considered it. (Or better yet, with a comment indicating there are no dependencies?)Next is building. Vector doesn't need a build stage, and
PIONEER
indicates that if there is no Makefile.PL
or Configure.pl
file, it just assumes the build worked, which sounds perfect for my purposes.Step three is running tests. If there is a makefile, proto will
make test
. If there isn't, it will try to run prove
recursively on the t/
directory. Assuming it's smart enough to run prove
with the system's working Rakudo, this should work just fine with what we already have. Errr, assuming the LIB paths are set up properly.Which is the last issue, I guess. I've just been running with Vector.pm and Test.pm in the top-level Vector directory, no need for a PERL6LIB environment variable. Will
prove
test figure out the paths automatically? And if I switch over to that system, should it be lib/Vector.pm
or lib/Math/Vector.pm
or something like that?I think my next step is to check in what I've got now, make this post, e-mail a link to it to masak to get his comments, and head off to the pub. I will report on what happens later.
Hello, masak here. Funnily enough I stumbled over this post before I saw your email. :)
ReplyDeleteFirst off, Vector is now added to proto's projects.list, and you now (along with everybody else) have proto commit access, should you need it for anything.
I think I'd also prefer an empty deps.proto file to none at all. As you say, it sends the message that you've given it some thought. Proto genuinely doesn't care either way.
As for sticking to conventions with Makefile and Configure.pl and the like, you're absolutely free to do as you wish. We have no conventions set in stone yet, only bylaws. This includes the choice between naming the module 'Vector' or 'Math::Vector'.
Putting things in a lib/ directory seems to be a pretty strong bylaw nowadays. It simply provides people with structure. Providing a Makefile of some sort is mostly an act of kindness (since people who want speed will probably want to run from PIR), but by no means a must.
One habit I personally dislike is the proliferation of Test.pm in various repositories. I think it's our clearest symptom of the malaise caused by the lack of a central storage for our modules. (Incidentally, plans started today for rectifying that in proto...)
Regarding the 'prove' functionality, I fear that's still unimplemented... people haven't been doing very much testing with proto, so the demand has been low.
Thank you for adding Vector and the commit bit!
ReplyDeleteIs there a standard Perl 6 Configure.pl out there? I would like to Do The Right Thing, but I have no idea how to compile to PIR. Likewise, I don't really have a firm grasp on how to cleanly move Vector.pm into lib/. I mean, obviously I can move the file, but would I then need to add that lib/ directory to PERL6LIB? That seems a fairly grotesque way to handle things.
Likewise, the only reason Test.pm is in there is so that the tests can run without additional dependencies or mucking about with PERL6LIB. As soon as I have a good way to get rid of it I will.
I may poke around in proto to see what needs to be done to enable testing...
Ah, I see your grampa project has a Perl 6 Configure.pm module...
ReplyDeleteAnd a Makefile.in I can understand. Okay, so that's how make / make test handle PERL6LIB. I can work with that!
ReplyDeleteBut I don't see how to use this without cloning Configure.pm...
I've blogged about figuring this out at http://lastofthecarelessmen.blogspot.com/2009/08/vector-proper-file-layout-and-makefile.html
ReplyDeleteI can move the file, but would I then need to add that lib/ directory to PERL6LIB? That seems a fairly grotesque way to handle things.
ReplyDeleteFor what it's worth, proto was born as a tool to manage that grotesquity. The whole thing with handling dependencies and stuff was just an afterthought; primarily I wanted proto to make PERL6LIB management less painful.
Looks like most of this would have been automatic if I had just used proto's create-new-project script?
ReplyDelete