1837202 Members
2422 Online
110115 Solutions
New Discussion

perl on hp11

 
CA788655
Occasional Contributor

perl on hp11

hi

i have problem with script below. first script don't work, second - yes. whot is wrong ? when i check this from shell
# tar -tv - i get result

1)
#!/opt/perl5/bin/perl
foreach $a (`/usr/bin/tar -tvf /dev/rmt/0m`)
#i tried (`tar -tv`) too
{
print "$a";
}

2)
#!/opt/perl5/bin/perl
foreach $a (`ps -ef`)
{
print "$a";
}
5 REPLIES 5
Jerome Baron
Respected Contributor

Re: perl on hp11

Hi
On my systeme that run correctly. Have you a tape in the drive ?

If yes what's your output ?
Have you try with a tar file ?

Regards,
Jerome
Bill McNAMARA_1
Honored Contributor

Re: perl on hp11

ll /dev/ | grep rmt

ioscan -fnkC tape

does the tar work from command line?

Later,
Bill
It works for me (tm)
H.Merijn Brand (procura
Honored Contributor

Re: perl on hp11

 
Enjoy, Have FUN! H.Merijn
H.Merijn Brand (procura
Honored Contributor

Re: perl on hp11

It *is* working, except that it takes too long to wait for for you

using backticks in a foreach will complete the command before parsing the returned lines, which will take a looooong time on a long tape.

A more interactive approach would be

--8<---
#!/opt/perl5/bin/perl

use strict;
use warnings;

open my $tape, "tar tvf /dev/rmt/0m |"
select ((select ($tape), $| = 1)[0]);
while (<$tape>) {
print "$_";
}
close $tape;
-->8---

but the time to complete will be the same on the long run.

Also try to have a look at Archive::Tar

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
CA788655
Occasional Contributor

Re: perl on hp11

You are right, this works. But it works too long - all tape is checking. I will try last method.

Robert