Hi Jerry, hi Shawn,

I'm sorry that I couldn't reply to your messages earlier, I have been
quite busy during the past week.

Jerry Amundson [EMAIL PROTECTED] wrote:
> Please wake me from my nightmare. I thought I had this figured out - may
> have bit off too much, lacking Perl experience and all.
> 
> In maillog:
> May  9 12:40:11 arsenic courierfilter: Starting pureperlfilter
> May  9 12:40:11 arsenic courierfilter: Can't call method "close" on an undefined 
> value at /usr/local/lib/perl5/site_perl/5.8.4/Courier/Filter.pm line 299.

Shawn Edwards [EMAIL PROTECTED] wrote:
> I'm getting this error in my mail.log when starting up courierfilters:
> 
> Can't call method "close" on an undefined value at 
> /usr/local/lib/perl5/site_perl/5.8.4/Courier/Filter.pm line 299.
> 
> [...]
> It looks like it's having trouble getting file handle 3.  I tried
> changing things so that it only closes the file handle if it is open,
> but that a) breaks the courierfilter spec as I read it and b) doesn't
> seem to help.

This is really weird.  Opening a file descriptor by number is documented
in Perl 5.8.4's `perldoc -f open` as follows:

| If you specify '<&=X', where "X" is a file descriptor number or a
| filehandle, then Perl will do an equivalent of C's "fdopen" of that file
| descriptor (and not call dup(2)); this is more parsimonious of file
| descriptors.  For example:
| 
|     # open for input, reusing the fileno of $fd
|     open(FILEHANDLE, "<&=$fd")

And perlopentut says:

| If the filehandle or descriptor number is preceded not just with a
| simple "&" but rather with a "&=" combination, then Perl will not create
| a completely new descriptor opened to the same place using the dup(2)
| system call.  Instead, it will just make something of an alias to the
| existing one using the fdopen(3S) library call  This is slightly more
| parsimonious of systems resources, although this is less a concern these
| days.  Here's an example of that:
| 
|     $fd = $ENV{"MHCONTEXTFD"};
|     open(MHCONTEXT, "<&=$fd")   or die "couldn't fdopen $fd: $!";

And IO::File::new() just calls the builtin open() function, so
IO::File->new('<&=3') actually should work.

I won't be able to install Perl 5.8.4 on my development machine for the
next two weeks or so, but as soon as I manage to do it, I will try seeing
whether Perl 5.8.4 changes anything related to that piece of code.

I suspect that it's not an issue specific to Perl 5.8.4.

As an interim measure, could you please try commenting out the 
IO::File->new('<&=3')->close() line (line 299) in Courier/Filter.pm, and inserting the 
following two lines instead?

    open(FD3, '<&=3') or die("Couldn't open file descriptor #3: $!");
    close(FD3);



-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id%62&alloc_ida84&op=click
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to