[darcs-users] Re: Darcs Perl Contributors Unite!

Mark Stosberg mark at summersault.com
Tue Dec 14 02:22:32 UTC 2004


On 2004-12-13, Mark Stosberg <mark at summersault.com> wrote:
>
> 1. Assessment. Inventory all of the darcs interface functions used
>    so far. Note which one ones are pure Perl and those that call the
>    darcs binary.

Thanks to the two people who expressed interest in this adventure! Since
the assessment of Perl use so far wouldn't take very long, I went ahead
and did it. Here are the results, which I don't think will be of much
surprise to the software authors. 

The good is that I found that interfacing with darcs was generally easy,
because it provides "--pipe" options in some places just for scripting, 
and provides XML output in key places. 

Because darcs already has good support for scripting, these scripts have
little or no benefit form a shared library: nearly all of their code is
devoted to their special function:

cvs_convert.pl
tla_convert_patch.pl
tla_import.pl
darcs.cgi
darcs2rss

The XML interface hardly needs help in Perl, since this enough to turn
the XML into a Perl data structure:

    use XML::Simple;
    my $ref = XMLin('darcs_xml_output.xml')

The one place I saw potential for shared code was in date parsing and
formatting, which was repeated throughout a few projects. 

If someone thinks this situation is worth improving, I suggest creating
a new DateTime module for this task:

http://datetime.perl.org/modules.html

This leaves 'darcshive' to cover. It includes a number of functions
which work directly with the darcs repo without using darcs. (That's not
surprising, since that's the point of it!). It has functions including:

   find_repo_branch
   getpatchname
   read_invstuff
   read_patches
   read_apply
   apply
   init_apply
   get_patch
   get
   mget

However, I'm less inclined to refactor them into a shared library if
there is not a clear additional use for them. 

In conclusion, the assessment didn't reveal a significant benefit from 
creating a shared Perl library for darcs at this time. For Perl coders
who want to contribute to darcs, your time is probably better spent
contributing directly to one of these projects for now, such as writing
automated tests to confirm their functionality.

If you are unfamiliar with writing tests in Perl, you may want to start
here:
http://qa.perl.org/


    Mark

-- 
http://mark.stosberg.com/ 





More information about the darcs-users mailing list