On Tue, 13 Mar 2001 [EMAIL PROTECTED] wrote:
> Hi, all
>
> ---8<---
> >
> > > > Actually, I thought C<binmode()> was a NOOP on VMS.
> > >
> > > I think that perl's CORE::binmode() is but
> > VMS::Stdio::binmode() really
> > > does do a freopen() on the filehandle. Nico would like to
> > add "ctx=bin"
> > > to avoid CR insertion for mailbox talking to STDIN.
> >
> > Ah. C<freopen()> looks to be somehow associated with C and
> > therefore Inherently Evil.
> >
> ---8<---
> Well whatever, the binmode way is portable acros platforms
> (with freopen inside...),
>
> whereas the Perl way probably should be:
> (forgive the typo's, it's an crude example)
>
> if ($^O eq 'VMS') {
> close (STDIN);
> $fh = vmsopen( "SYS$INPUT:" , ..... );
> } else {
> $fh = \STDIN;
> }
>
> Then I just have to rewrite all the code that uses stdin and
> (f.e. cgi.pm) to get it all working again..... ;-{
>
> now the only problem is how to set the STDIN back to the newly opened
> $fh....?
>
> The scripts should also run on AIX & SunOS ....
>
> binmode makes these (and possibly other) scripts portable, as is...
> which I prefer.
You say that you want portability, however you'd have to put:
BEGIN {
if ($^O eq 'VMS') {
require "VMS::Stdio.pm";
import 'VMS::Stdio::binmode()';
}
}
at any script that made use of the proposed change to
VMS::Stdio::binmode(). Are you prepared to handle that?
> The only issue left with binmode is that it just manages OUTPUT file pointers
> (except after my patch the STDIN), the input filepointers are never checked,
> reopened or whatever.
> During porting from the perl V5.5 (where it was still built in and not an
> add-on)
> -> new architecture somehow this was not done.
Are you here referring to CORE::binmode() as the "not an add on"?
Peter Prymmer