develooper Front page | perl.perl5.porters | Postings from April 2003

revisting perlio callback tab requirements

Thread Next
From:
Stas Bekman
Date:
April 29, 2003 02:36
Subject:
revisting perlio callback tab requirements
Message ID:
3EAE4787.1030601@stason.org
For some reason, I thought that I could write a minimalistic layer 
implementation, adding only the minimal number of callbacks and keeping the 
rest NULLs. However perlio.c doesn't check whether the callback's entry is 
NULL or not. For example:

int
Perl_PerlIO_close(pTHX_ PerlIO *f)
{
     int code = -1;
     if (PerlIOValid(f)) {
	code = (*PerlIOBase(f)->tab->Close) (aTHX_ f);
	while (*f) {
	    PerlIO_pop(aTHX_ f);
	}
     }
     return code;
}

If my perlio tab has NULL for the Close callback, the program segfaults here:
	code = (*PerlIOBase(f)->tab->Close) (aTHX_ f);

I've "solved" this problem using the tab entry:

     PerlIOBase_noop_ok,         /* close */

But the problem with functions PerlIOBase_* is that they aren't exported in 
libperl.so and so can't be used on AIX, winFU and several other platforms.

Should perliol.pod specify which tabs are required to have a callback, which 
can be filled with NULL and what options are available for noops (e.g. 
PerlIOBase_noop_ok and PerlIOBase_noop_fail, but they aren't exported!).

Please advise what's the right way to go about these.

Thanks.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About