develooper Front page | perl.vmsperl | Postings from June 2002

RE: TYPE/CONT in Perl

Thread Previous | Thread Next
From:
BAZLEY, Sebastian
Date:
June 10, 2002 11:12
Subject:
RE: TYPE/CONT in Perl
Message ID:
FB30E6123B22D211B52800A0C9CFBB1901C7B17B@Lones2.sema.co.uk
Thanks to all (including the private email from .nl).

Unfortunately, "Close IN" does not terminate the sub-process.

As suggested by the e-mail I tried:

$in=vmsopen($file,'shr=put');

while(1){
  if (eof($in)){
    $pos-tell($in);
    sleep(2);
    seek($in,$pos,0);
  }
  $line = <$in>;        # Either
  read($in,$line,1000); # Or
  print $line if $line;
}

But that did not work. Bother; it looked very promising...

Then Craig's mail about the example reminded me that we have the source for
our home-grown "tail -f" (written originally for VAX/VMS 5.5!), so I had a
look at that, and found the magic incantation:

$in=vmsopen($file,'shr=put','ctx=rec');

Thanks again for helping solve the problem.

If the VMS::Stdio documentation is ever updated, perhaps it might be useful
to add an example using these qualifiers?

Sebastian
-----Original Message-----
From: Craig A. Berry [mailto:craigberry@mac.com]
Sent: 10 June 2002 18:32
To: BAZLEY, Sebastian
Cc: vmsperl@perl.org
Subject: Re: TYPE/CONT in Perl


At 01:17 PM 6/10/2002 +0100, BAZLEY, Sebastian wrote:
>The file can be read OK in DCL with TYPE/CONT, and in Perl:
>
>        open IN, "TYPE/CONT |";
>
>works OK, except that we haven't found how to terminate the sub-process
>without exitting the Perl script.

Closing IN doesn't do that?

>However, it would be nice if we could read the file directly from Perl,
e.g.
>with the appropriate vmsopen() call from VMS::Stdio. We've tried "shr=put",
>but cannot seem to read beyond the initial end of the file.

Hmm.  I think VMS::IndexedFile can do sequential reads, i.e., I don't know 
if the file really has to be indexed.  Its only advantage for your problem 
is that it's using RMS calls rather than C library calls, which may or may 
not be a way around what you are seeing.  I don't really know why you are 
seeing the behavior you get but it would be interesting to know if it's 
reproducible with a simple C example.


___________________________________________________________________________
This email is confidential and intended solely for the use of the 
individual to whom it is addressed. Any views or opinions presented are 
solely those of the author and do not necessarily represent those of 
SchlumbergerSema. 
If you are not the intended recipient, be advised that you have received this
email in error and that any use, dissemination, forwarding, printing, or 
copying of this email is strictly prohibited.

If you have received this email in error please notify the SchlumbergerSema Helpdesk by telephone on +44 (0) 121 627 5600.
___________________________________________________________________________


Thread Previous | 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