Skip to main content.
home | support | download

Back to List Archive

Re: Making SWISH::API->new() accept a list?

From: Lars Kellogg-Stedman <lars(at)not-real.oddbit.com>
Date: Wed Dec 01 2004 - 01:38:17 GMT
> But you can't say $sw = SWISH::API->new( "index.1 index.2" ).  That
> breaks existing code.

That's true.  I was aiming mostly for proof-of-concept; not a final
solution :).  But I'm thinking...if you try to support "legacy" code, how
do you differentiate between:

  (a) SWISH::API->new("/Users/lars/Documents/Office Files/index.1")

And:

  (b) SWISH::API->new("/Users/lars/index.1 /Users/lars/index.2")

?

I guess you could have new(), instead of accepting a list of index files,
accept either (a) a scalar containing a space-seperated list, or (b) a list
reference:

  SWISH::API->new(["/path/to/index.1", "/path/to/index.2"]);

This would let you differentiate between "legacy" code and "new style"
code.  It's a fairly transparent solution.

-- Lars

-- 
Lars Kellogg-Stedman <lars@oddbit.com>
Received on Tue Nov 30 17:38:27 2004