Dave Horsfall <[EMAIL PROTECTED]> writes:
>
>    if ((abuf = fill_key(numargs, args, &recnum)) == NIL(char))
>
>The fill_key() function just took the Perl args and converted them into
>a structure used by the database.
>
>
>There's a whole bunch of code that I have left out, as I didn't want
>to overwhelm this list, and I didn't know which bits were relevant :-)

fill_key() ! 

That is the bit that is equivalent to the problem you had surely?
- send just to me if you like

Then the perl5 version looks like this:

/* C-code part of XS file */

static char *
fill_key(int numargs, SV **args, &recnum)
{
 ... /* code similar to your perl4 stuff */
}

/* Now XS part proper */
MODULE ...

int
uni_acckey(...)
CODE:
{
 int recnum;
 char *abuf = fill_key(items,&ST(0),&recnum);
 if (abuf == NULL)
  {
   return -1; /* or croak or XS_RETURN_UNDEF or whatever */
  }  
 return acckey(recnum,abuf); 
}
OUTPUT:
 RETVAL

It this really is a data-base it is probably also worth looking at DBI 
module (which is a meta-interface to "true" databases) or other DB modules 
like DB_File which map key/value databases onto perl's hashes via tie.

 

 

Reply via email to