Perl's not the only TAP source

Steve Purkis steve at purkis.ca
Thu Jun 11 20:16:14 GMT 2009


On 11 Jun 2009, at 16:43, David E. Wheeler wrote:

> On Jun 11, 2009, at 6:22 AM, Ovid wrote:
>
>> #!/usr/local/bin/run_sql
>>
>> And then write /usr/local/bin/run_sql.  Shouldn't be too hard,
>> should it?
>
> And Who's going to install that? And how would SQL know to ignore that
> line?

I think we're fixating on shebangs when we shouldn't be.

My idea was slightly different: I wasn't thinking #!<command> per-se,  
but rather something like it, and something like Perl's -T test.  And  
it's very perl-ish:

if it's a text file, open it and grab the first N characters, and  
include them in the 'meta' info.  Source detectors can then use this  
info to see if the file contains anything that made it obviously  
something they could handle.

So basically the solution is: pass the buck.  Let the Source Plugin  
writers figure out the complicated stuff, like detecting what the  
thing is they've got.  That way we don't have to worry about it here  
because TMTOWTDI and we'll grow beards or invent perpetual motion  
machines before we come up with a generic shebang-based solution that  
meets everyone's needs.

If we did this, each Source Detector could define it's own signature  
that it looks for and votes on.  Signatures could be anything like  
emacs' & vim's file variables:

	-*- mode: modename; var: value; ... -*-
	/* vim: set textwidth=65 tabstop=8 sts=3 noexpandtab: */

Or they could be comments in SQL:

	-- test.sql
	-- TAP Source: pgTAP

Or they could be ascii pictures of donkeys[1], it really doesn't  
matter so long as they fit into the first N bytes (say 1024?).

The only downside: an extra system call to open the file.  Probably  
negligible performance-wise.  If people like the idea, it's pretty  
simple to make available.

Cheers,
+--
   Steve Purkis

[1] - http://www.afn.org/~afn39695/hard.htm




More information about the tapx-dev mailing list