Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > Running an inte...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 10793 of 11748
Post > Topic >>

Running an interactive program with filehandles

by anjan.purkayastha@[EMAIL PROTECTED] (Anjan Purkayastha) Mar 25, 2008 at 08:30 PM

------=_Part_15508_11273949.1206491424489
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Consider the following program- HydrophobicityProfiler.pl
Here is a sample run of the program:
perl HydrophobicityProfiler.pl
Enter the name of the sequence file (try protein.txt) and then press
Enter:
.../data/protein.txt
Enter the desired window size as an odd number and then press Enter:
5
Which method would you like to use (Kyte-Doolittle, Eisenberg, Hopp-Woods,
Janin, or Rose):
Eisenberg

The program sequentially asks the user for 3 parameters: name of sequence
file; desired window size and method


I tried to write a perl program that would use a filehandle to run
HydrophobicityProfiler.pl.
Here it is:
#! /usr/bin/perl

use strict;
use warnings;

open(HP, "|perl ./HydrophobicityProfiler.pl \n");
HP->autoflush(1);

print HP "../data/protiein.txt \n";
print HP "5 \n";
print HP "Kyte-Doolittle \n";
close HP;

Unfortunately this gives me a list of errors:

 perl handle_test.pl
Can't locate object method "autoflush" via package "IO::Handle" at
handle_test.pl line 7.
anjan-purkayasthas-powerbook-g4-17:~/perl_directory/programs anjan$ Enter
the name of the sequence file (try protein.txt) and then pr
ess Enter:
Use of uninitialized value in scalar chomp at ./HydrophobicityProfiler.pl
line 20.
Enter the desired window size as an odd number and then press Enter:
Use of uninitialized value in scalar chomp at ./HydrophobicityProfiler.pl
line 23.
Which method would you like to use (Kyte-Doolittle, Eisenberg, Hopp-Woods,
Janin, or Rose):
Use of uninitialized value in scalar chomp at ./HydrophobicityProfiler.pl
line 26.
Use of uninitialized value in open at ./HydrophobicityProfiler.pl line 28.
Cannot open the file: No such file or directory


So my question is. Is it possible to write a program to run an interactive
program using file handles?

TIA,
Anjan

-- 
ANJAN PURKAYASTHA, PhD.
Senior Computational Biologist
==========================

1101 King Street, Suite 310,
Alexandria, VA 22314.
703.518.8040 (office)
703.740.6939 (mobile)

email:
anjan@[EMAIL PROTECTED]

 




 2 Posts in Topic:
Running an interactive program with filehandles
anjan.purkayastha@[EMAIL   2008-03-25 20:30:24 
Re: Running an interactive program with filehandles
chas.owens@[EMAIL PROTECT  2008-03-25 21:40:56 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Sep 5 12:07:47 CDT 2008.