[13338] in Perl-Users-Digest
Perl-Users Digest, Issue: 748 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 9 10:06:28 1999
Date: Thu, 9 Sep 1999 07:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 9 Sep 1999 Volume: 9 Number: 748
Today's topics:
Re: Alternative to ELSIF statements <jpeterson@office.colt.net>
Re: Alternative to ELSIF statements <rhardicr@gw.ford.com>
Re: Alternative to ELSIF statements <gellyfish@gellyfish.com>
Re: Case insensitive SQL query (Mark W. Schumann)
escaping curly braces <mario.schrijver@cans.nl>
Re: Help! HTTP500 error when running Perl script on Fro <rootbeer@redcat.com>
Re: Help! HTTP500 error when running Perl script on Fro (Bill Moseley)
How to echo "% f"? (Joseph O'Rourke)
Re: How to echo "% f"? <rootbeer@redcat.com>
Re: How to echo "% f"? (Bill Moseley)
How to send control codes from Expect module <wpflum@my-deja.com>
mastering algorithms a munition? <dturley@pobox.com>
my and hashes; Bug of PERL? <Bernd.Kronmueller@eedn.ericsson.se>
Re: my and hashes; Bug of PERL? <gellyfish@gellyfish.com>
Re: my and hashes; Bug of PERL? <rootbeer@redcat.com>
Re: need help. look at my code <photo@photoshopsection.com>
Opening URL with Perl <Oliver@pop.k-net.dk>
Re: Opening URL with Perl <lars@thegler.dk>
Perl fails tests <jsmith@mcs.drexel.edu>
Re: Please help a newbe <cook@mediaone.net>
Re: problem with s///e structure <rootbeer@redcat.com>
redirection problems <weinachter@yahoo.com>
Re: redirection problems <jpeterson@office.colt.net>
Re: ref to array of ref to arrays <rhardicr@gw.ford.com>
run .exe and get result? (WinNT) <olivier.maas@at-lci.com>
Re: run .exe and get result? (WinNT) <craig@mathworks.com>
Re: run .exe and get result? (WinNT) <olivier.maas@at-lci.com>
Re: Script to create subshell that sends input/output t <dsdasilva@earthlink.net>
Re: Sorry, Re: Why, why, why, -w and use strict? (Remco Gerlich)
Re: suggestion to revise grep (another Q: reference com (Sitaram Chamarty)
Re: suggestion to revise grep (another Q: reference com (Mike Stok)
Re: use cgi/perl to hide access to subdirectory <rootbeer@redcat.com>
Re: Using strict? <jpeterson@office.colt.net>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 09 Sep 1999 13:05:10 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: Alternative to ELSIF statements
Message-Id: <agOB3.97$xa4.1311@news.colt.net>
dave h <dave4000@my-deja.com> wrote:
> Firstly, I am new to Perl.
> Secondly, I have many subroutines (40 +) each one prompting for
> different information, and I prompt the user to select which option
> (subroutine) to select. (1-46). At the moment I have 46 if else
> statements to do this, eg.
> Can somebody tell me if there is a much easier way of doing this?
There is. It's even in the FAQ, although you'd be forgiven for missing it
unless you were familiar with the terms 'case statement' or 'switch', and I
see no reason why you should be.
If you lookin perlfaq7 or in perlsyn, you will find some info on ways of doing
this.
With as many options as you have, the hash of subroutine references would
probably suit you best.
my %commands = (
"happy" => \&joy,
"sad", => \&sullen,
"mad" => \&angry,
);
print "How are you? ";
chomp($string = <STDIN>);
if ($commands{$string}) {
$commands{$string}->();
} else {
print "No such command: $string\n";
}
------------------------------
Date: Thu, 09 Sep 1999 13:10:16 +0100
From: Richard H <rhardicr@gw.ford.com>
Subject: Re: Alternative to ELSIF statements
Message-Id: <37D7A3A8.AE48DB62@gw.ford.com>
dave h wrote:
<snip>
> At the moment I have 46 if else
> statements to do this, eg.
>
> if ($option ==1) {
> do option1();
> }
> elsif ($option ==2) {
> do option2();
> }
>
> ...etc, etc, all the way to 46.
>
> Can somebody tell me if there is a much easier way of doing this?
>
yes, there are alternatives,
If you've got activestate perl do a
>perldoc -q switch
or go to page 104 in the Camel book,
or do like:
SWITCH : {
if (x) { do code; last SWITCH;}
if (y) { do code; last SWITCH;}
$nothing = 1;
}
Richard H
------------------------------
Date: 9 Sep 1999 14:18:28 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Alternative to ELSIF statements
Message-Id: <37d7b3a4_2@newsread3.dircon.co.uk>
dave h <dave4000@my-deja.com> wrote:
> Firstly, I am new to Perl.
> Secondly, I have many subroutines (40 +) each one prompting for
> different information, and I prompt the user to select which option
> (subroutine) to select. (1-46). At the moment I have 46 if else
> statements to do this, eg.
>
> <subroutines go here>
>
> print ("\nEnter Option: ");
> $option = <>;
> chop $option;
>
> if ($option ==1) {
> do option1();
> }
> elsif ($option ==2) {
> do option2();
> }
>
> ...etc, etc, all the way to 46.
>
You might try using an array of subroutine references :
my @options = (
\&option1,
\&option2
);
$options[$option]->() if (ref ($options[$option]) eq 'CODE' );
/J\
--
"Do you want to go to court today?" - BBC News Website
------------------------------
Date: 9 Sep 1999 09:12:42 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Case insensitive SQL query
Message-Id: <7r8boa$38k@junior.apk.net>
In article <7r43rg$91l$1@nnrp1.deja.com>, <mrbog@my-deja.com> wrote:
>Hello, genius, guess what, there are other people to answer the
>questions besides you. The more people in the group, the more people to
>answer questions. I can and have answere the questions of others, for
>example.
If you actually read this group you'd know I practically never answer
questions. Other people get to them first.
>Besides that, how fucking stupid are you to think that of 2400 new
>messages, they will all be questions? You're a programmer and I need to
>explain that to you? It's more lik 10% at most. Note I said new
>messages not new threads.
Okay, so there are 240 new threads. You want to add to that by asking
about unrelated issues?
>God what an idiot
I'm rubber, you're glue. Nyah, nyah.
------------------------------
Date: Thu, 9 Sep 1999 14:31:51 +0200
From: "Mario Schrijver" <mario.schrijver@cans.nl>
Subject: escaping curly braces
Message-Id: <7r88is$hme$2@newnews2.news.nl.uu.net>
Has anybody got a clue how to escape curly braces which surround a record?
like
{ "-1" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"2305" ,"" ,"" ,"" ,"" ,"" ,""}
I want to get those fields out and sepparate /recombine them. Im working the
csv module.
Regards,
Mario Schrijver
------------------------------
Date: Thu, 9 Sep 1999 06:48:06 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Help! HTTP500 error when running Perl script on Frontpage
Message-Id: <Pine.GSO.4.10.9909090646500.16999-100000@user2.teleport.com>
On Thu, 9 Sep 1999, gilbert wrote:
> Please help, why I can't run the perl script on frontpage?
It sounds as if you're having troubles with Frontpage. Please check the
docs, FAQs, and newsgroups relevant to Frontpage. Let me know by email if
you (or anyone else reading this) don't know what those things are or how
to search for them. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 9 Sep 1999 06:41:06 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Help! HTTP500 error when running Perl script on Frontpage
Message-Id: <MPG.124158c9acd9bd0a989729@nntp1.ba.best.com>
gilbert (gilbert@yahoo.com) seems to say...
> Please help, why I can't run the perl script on frontpage?
> The following step have been done.
>
> 1. perl script was located at frontpage's cgi-bin, both cgi-bin & local are
> checked with "Allow Script or Program to be run"
> 2. Frontpage pws was on.
> 3. regedit's ScriptMap .pl was added and pointed to local perl.exe %s %s.
You have an error on line 17.
Check your web server error log and check back with the CGI newsgroup.
So far, this isn't a problem with perl.
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: 9 Sep 99 12:30:47 GMT
From: orourke@grendel.csc.smith.edu (Joseph O'Rourke)
Subject: How to echo "% f"?
Message-Id: <37d7a877.0@news.smith.edu>
When I try to read the string "% f" and print it out, it prints
as " 0.000000". I am using this simple program test.pl:
#!/usr/bin/perl
while (<>) {
printf $_;
}
and running it with terminal input:
% test.pl <- Unix command
% f <- User input
0.000000 <- Program output
I've tried protecting the % with \% but to no avail. Can someone
help me? Thanks.
------------------------------
Date: Thu, 9 Sep 1999 06:52:22 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How to echo "% f"?
Message-Id: <Pine.GSO.4.10.9909090651030.16999-100000@user2.teleport.com>
On 9 Sep 1999, Joseph O'Rourke wrote:
> #!/usr/bin/perl
> while (<>) {
> printf $_;
> }
In Perl, it's rare to use printf, since we have print. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 9 Sep 1999 06:46:08 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: How to echo "% f"?
Message-Id: <MPG.124159feb0575f298972a@nntp1.ba.best.com>
Joseph O'Rourke (orourke@grendel.csc.smith.edu) seems to say...
> When I try to read the string "% f" and print it out, it prints
> as " 0.000000". I am using this simple program test.pl:
>
> #!/usr/bin/perl
> while (<>) {
> printf $_;
^---- useless use of C experience in line 4
perldoc -f printf
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Thu, 09 Sep 1999 12:15:58 GMT
From: Bill <wpflum@my-deja.com>
Subject: How to send control codes from Expect module
Message-Id: <7r88dl$8dl$1@nnrp1.deja.com>
I've done some digging but haven't come up with an answer yet, if I've
missed the obvious let er rip I can take it. I'm using the Expect
module with perl to run a telnet session which logs into our
accounting/mail program on our server. We mainly interface with the
server through the Accounting program which includes a mail function,
so we do not use a standard email program. What I'm trying to do is
have the perl program telnet in and check the mail for a person in the
accounting program and then mail a normal email through the unix system
which I can then check with PC or Mac based email reader. The goal is
to have the PC/Mac email program running in the background checking the
unix mail to alert the user if he has mail on the accounting program to
check. This is needed since the accounting software is accessed
through a terminal emulator and will not 'POP' up or alert the user
that he has mail, you have to manually check for mail regularly to make
sure you don't have any hanging out there and you know how end users
are so reliable when it comes to doing things manually. Anyway, back
to my question. I need to send several control keys such as function
keys and especially the 'DO' key which are available on a vt220
terminal or emulator to the telnet program so I can move through the
session to the email portions of the accounting software. I've tried
sending what I thought was the correct ascii equivilents but they don't
seem to work, any ideas how to send those keys. Even better anyone
have a chart showing exactly what the ascii codes are for these keys?
I tried just pressing the keys at a unix prompt but the codes generated
don't appear to be the ascii or hex numbers I need. I'm lost so feel
free to tell me where to go ;)
Thanks
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 09 Sep 1999 13:45:30 GMT
From: David Turley <dturley@pobox.com>
Subject: mastering algorithms a munition?
Message-Id: <7r8dln$cau$1@nnrp1.deja.com>
I've been pouring over "Mastering Algorithms in Perl" and see that this
book will be one of those "I need a copy at work and at home" books,
like the Cookbook.
On page 549 the RSA algorithm in Perl is printed, along with a warning
that t-shirts, etc with this printed on them are classed as munitions by
the US. So, does this mean that this book is also a munition?
--
David Turley
dturley@pobox.com
http://www.binary.net/dturley
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 09 Sep 1999 14:47:38 +0200
From: Bernd Kronmueller <Bernd.Kronmueller@eedn.ericsson.se>
Subject: my and hashes; Bug of PERL?
Message-Id: <37D7AC6A.1E13EAAA@eedn.ericsson.se>
Hello,
we encountered here a problem and we can't explain what is going on.
#! /usr/loacal/bin/perl -w
my $name = "hash";
my $hash_name = "$name\_1";
my %hash_1 = ('asd', 1 , 'erg', 2);
print "\tdirect:\n";
foreach $key (keys %hash_1)
{
print "key: $key value: ", $hash_1{$key}, "\n";
}
print "\n\thash name put together: \n";
foreach $key (keys %{$hash_name})
{
print "key: $key value: ", ${$hash_name}{$key}, "\n";
}
The problem is, that in the case where the name is put together it won't
find the hash.
Simply removing the my from the hash declaration solves the problem.
Who can explain this to me or is it a bug of perl???
Thanks, Bernd
------------------------------
Date: 9 Sep 1999 14:50:18 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: my and hashes; Bug of PERL?
Message-Id: <37d7bb1a_2@newsread3.dircon.co.uk>
Bernd Kronmueller <Bernd.Kronmueller@eedn.ericsson.se> wrote:
> Hello,
>
> we encountered here a problem and we can't explain what is going on.
>
> #! /usr/loacal/bin/perl -w
>
> my $name = "hash";
> my $hash_name = "$name\_1";
>
> my %hash_1 = ('asd', 1 , 'erg', 2);
>
> print "\tdirect:\n";
> foreach $key (keys %hash_1)
> {
> print "key: $key value: ", $hash_1{$key}, "\n";
> }
>
> print "\n\thash name put together: \n";
> foreach $key (keys %{$hash_name})
> {
> print "key: $key value: ", ${$hash_name}{$key}, "\n";
> }
>
> The problem is, that in the case where the name is put together it won't
> find the hash.
> Simply removing the my from the hash declaration solves the problem.
>
> Who can explain this to me or is it a bug of perl???
No its a bug in your reasoning - by definition you cannot use a lexical
variable to create a symbolic reference. You dont infact want to use a
symbolic reference at all - use a hash or array of hashes instead.
/J\
--
"Do you want to go to court today?" - BBC News Website
------------------------------
Date: Thu, 9 Sep 1999 07:00:55 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: my and hashes; Bug of PERL?
Message-Id: <Pine.GSO.4.10.9909090657550.16999-100000@user2.teleport.com>
On Thu, 9 Sep 1999, Bernd Kronmueller wrote:
> Newsgroups: comp.lang.perl.misc, comp.lang.perl
If your news administrator still carries comp.lang.perl, please let him
or her know that that newsgroup has not existed since 1995. If you
have such an outdated newsgroup listing, you are probably missing out
on many other valid newsgroups as well. You'll be doing yourself and
many others a favor to use only comp.lang.perl.misc (and other valid
Perl newsgroups) instead.
> #! /usr/loacal/bin/perl -w
It's generally better to cut-and-paste your actual code, rather than
retyping it, when you're reporting a problem.
> my $name = "hash";
> my $hash_name = "$name\_1";
>
> my %hash_1 = ('asd', 1 , 'erg', 2);
> foreach $key (keys %{$hash_name})
You're using a symbolic reference, which gives you %hash_1 in the current
package, rather than the my variable of the "same" name. But you don't
want to use symbolic references; use true ("hard") references instead. See
the perlref manpage for more information. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 9 Sep 1999 14:42:57 +0200
From: "Robert" <photo@photoshopsection.com>
Subject: Re: need help. look at my code
Message-Id: <7r89n5$apk$1@zingo.tninet.se>
I just had to chomp the variables first.
Mark <Mark@Mark.Com> wrote in message news:37D79B23.2C9EA0AA@Mark.Com...
>
>
> Robert wrote:
>
> > I have a file and I want to know if a date exists and a the $dep
variable if
> > so the $state variable will be set to 1 but it don´t work.
> > Can someone see any wrong in the if statment?
> >
> > $dep = $q->param('Dep');
> > $dep_date = $q->param('date');
> > $meters = 0;
> > $state = 2;
> >
> > $BASE_DIR = "/import/user8/gotlogic/public_html";
> > $FILE_STORE = "${BASE_DIR}/admin/bokning/files.txt";
> > open (FILE, "$FILE_STORE")|| die &error;
> > @files = <FILE>;
> > close FILE;
> > foreach $l (@files)
> > {
> > @file = split (/:/,$l);
> > print "<br>$file[0] $file[1] $file[2]<br>\n";
> > if($file[1] == $dep_date && $file[2] eq $dep)
>
> ^^^ use eq, perhaps?
>
>
> >
>
------------------------------
Date: Thu, 9 Sep 1999 14:33:31 +0200
From: "Oliver Christian Kjær" <Oliver@pop.k-net.dk>
Subject: Opening URL with Perl
Message-Id: <7r89e6$e2a$1@news.net.uni-c.dk>
Is it possible with a Perl script to open a html file on the internet,
it could be http://www.something.com/something.html,
and save it on the disk (on the server). ???
I have looked many places on the net, but haven't found anything
on that subject. Any help would be appreciated.
Oliver Chr Kjær
------------------------------
Date: Thu, 09 Sep 1999 14:46:17 +0200
From: Lars Thegler <lars@thegler.dk>
Subject: Re: Opening URL with Perl
Message-Id: <37D7AC19.87C2F04@thegler.dk>
"Oliver Christian Kj=E6r" wrote:
> =
> Is it possible with a Perl script to open a html file on the internet,
> it could be http://www.something.com/something.html,
> and save it on the disk (on the server). ???
Make sure you've got Bundle::LWP installed, then try 'perldoc lwpbook'.
/Lars
------------------------------
Date: Thu, 09 Sep 1999 10:03:24 -0400
From: Justin Smith <jsmith@mcs.drexel.edu>
Subject: Perl fails tests
Message-Id: <37D7BE2B.DD8C5A6E@mcs.drexel.edu>
When I build Perl 5.003 on my RedHat 6.0 system, it fails one of the
tests
(namely the DBM tests). This is significant because latex2html doesn't
work
on my system and people tell me that it's because Tied access to hashes
doesn't work properly.
Any suggestions>
--
______________________________________________________________________
|
Time blows wildly against my door | Justin R. Smith
Stirring discarded sorrows | Department of Mathematics and
Like dead leaves of summers past | Computer Science
Memories of forgotten lore | Drexel University
Making way for new tomorrows | Philadelphia, PA 19104
New hopes, new fears, |
and new ways that last | Office: (215) 895-1847
|
c Justin R. Smith, March 14, 1994 | Fax: (215) 895-1582
My home page: http://www.mcs.drexel.edu/~jsmith
------------------------------
Date: Thu, 09 Sep 1999 09:45:05 -0400
From: edgar <cook@mediaone.net>
Subject: Re: Please help a newbe
Message-Id: <37D7B9E1.CAEA7062@mediaone.net>
>
> Thanks,
> A module would be nice, being that I am still learning Perl. Although
> it can be painful at times, I do enjoy writing programs that can do
> some unique things. I'll try your suggestions and let you know. Thanks
> to all of you for your input.
>
> JP
>
#! perl -w
use strict;
### taken from perl cook book pp281 with chg's
print " To store an array of lines in reverse order \n";
my @lines = reverse (<DATA>);
print @lines;
print "\n Now reversing the order!! or back to what it looks like ???\n";
my @rev_lines = reverse @lines;
for ( @rev_lines){
print $_;
}
__DATA__
1 this is first 145
2 in second 135
3 asdffdsa last 124
tried on a win9x PC
hope this helps
-cookie
------------------------------
Date: Thu, 9 Sep 1999 06:45:16 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: problem with s///e structure
Message-Id: <Pine.GSO.4.10.9909090638040.16999-100000@user2.teleport.com>
On Thu, 9 Sep 1999, Chris van Uffelen wrote:
> I do this using a
>
> $data =~ s/.../.../ge;
> So the question is: how do I prevent Perl from writing the number of
> changes (3 in this case) to $data.
Could you show us some actual code? It sounds as if you're doing something
on the right side of the s///ge that you don't mean to be doing. I wish I
could be more specific. (By the way, my best guess at this point is that
you didn't mean to use the /e modifier.)
Ideally, you should post a short program or runnable excerpt, five or six
lines, something like this:
$data = 'my sample data';
$data =~ s/(\w+)/ length $1 /ge;
print "Result is '$data'.\n";
Armed with that and some information on what you expected the output to
be, we may be able to help you. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 09 Sep 1999 14:39:11 +0200
From: Nico <weinachter@yahoo.com>
Subject: redirection problems
Message-Id: <37D7AA6F.821037E6@yahoo.com>
Hello,
I'm working on a web server with perl scripts and i have a little
problem with path. In fact, i'm trying to make a script that can
redirect a user on another site but i don't know how to do to send him
there. Does anyone could helpme ?
Thanx
Nico.
------------------------------
Date: Thu, 09 Sep 1999 13:16:56 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: redirection problems
Message-Id: <crOB3.98$xa4.1311@news.colt.net>
Nico <weinachter@yahoo.com> wrote:
> Hello,
> I'm working on a web server with perl scripts and i have a little
> problem with path. In fact, i'm trying to make a script that can
> redirect a user on another site but i don't know how to do to send him
> there. Does anyone could helpme ?
This isn't a Perl question. You just need to read about HTTP headers, and
probably CGI too.
Here's a hint -
print "Location: http://www.foo.com/\n\n";
------------------------------
Date: Thu, 09 Sep 1999 13:00:29 +0100
From: Richard H <rhardicr@gw.ford.com>
Subject: Re: ref to array of ref to arrays
Message-Id: <37D7A15D.DDCDEE1B@gw.ford.com>
kev wrote:
>
> Hi,
>
> I need to know how to get hold of the values from the results returned
> from the DBI method selectall_arrayref. The docs say it returns "a
> reference to an array containing references to arrays for each row of
> data fetched".
> This is a little beyond me. How do I read, say, the second row? Or the
> fourth column in the fifth row, etc?
>
> Thanks,
>
> - Kev
my $ref = $dbh->selectall_arrayref('select * from author');
## if this returns a reference to an array of references to arrays!
# ref is a reference
my @resultset = @{ $ref };
# @resultset is now an array of references
foreach $reference (@resultset) {
my @row = @{ $reference };
print "row @row \n";
}
# @row contains the results
so if you wanted the data in the second row :
my @secondrow = @{ $resultset[1] };
If you don't like all this dereferencing, why not stick to using
fetchrow_arrayref in a fetch loop, I find it easier to keep track of
where I am.
Hope that helps,
Richard H
------------------------------
Date: Thu, 09 Sep 1999 15:10:48 +0200
From: Olivier Maas <olivier.maas@at-lci.com>
Subject: run .exe and get result? (WinNT)
Message-Id: <37D7B1D8.E940FFF3@at-lci.com>
Hello,
I would like from a perl scripts launched with NT/IIS to run a .exe and
get the result in my perl script or in a file
I tried:
system("catdoc -w test.doc");
this prog sends (on STDOUT) the word file converted in txt, (which is
what I need)
I tried
- @res=system("catdoc -w test.doc");
getting:256 not the file
- system("catdoc -w test.doc >> test.txt");
test.txt file is empty.
- system("test");
where test is a .bat with the previous try line.
looked in perlipc, but did not find what I imagine must B pretty simple
I tried also things like open(OUT, "catdoc -w test.doc>Res.txt"); and
others
but nothing will do...
Any idears how to solve this PB
thanks anyway
please also mail answer to maas@ensae.fr
olivier
------------------------------
Date: Thu, 09 Sep 1999 09:24:39 -0400
From: Craig Ciquera <craig@mathworks.com>
Subject: Re: run .exe and get result? (WinNT)
Message-Id: <37D7B516.A7BDE9A6@mathworks.com>
Try:
@output = `catdoc -w test.doc`;
Craig
Olivier Maas wrote:
> Hello,
> I would like from a perl scripts launched with NT/IIS to run a .exe and
> get the result in my perl script or in a file
>
> I tried:
> system("catdoc -w test.doc");
>
> this prog sends (on STDOUT) the word file converted in txt, (which is
> what I need)
------------------------------
Date: Thu, 09 Sep 1999 15:36:55 +0200
From: Olivier Maas <olivier.maas@at-lci.com>
Subject: Re: run .exe and get result? (WinNT)
Message-Id: <37D7B7F6.F01152BC@at-lci.com>
It is what I first tried
My answer is then that the given name is not recognized as an internal or
external command, An executable prog or a command file
the same line with system("catdoc -w test.doc"); gets a recognized answer
(256)
Craig Ciquera a écrit :
> Try:
>
> @output = `catdoc -w test.doc`;
>
> Craig
>
> Olivier Maas wrote:
>
> > Hello,
> > I would like from a perl scripts launched with NT/IIS to run a .exe and
> > get the result in my perl script or in a file
> >
> > I tried:
> > system("catdoc -w test.doc");
> >
> > this prog sends (on STDOUT) the word file converted in txt, (which is
> > what I need)
------------------------------
Date: Thu, 09 Sep 1999 08:47:56 -0500
From: Dominic Da Silva <dsdasilva@earthlink.net>
Subject: Re: Script to create subshell that sends input/output to a socket
Message-Id: <37D7BA8C.49613A01@earthlink.net>
How about sticking that egg up your ass instead.
Ala Qumsieh wrote:
> Dominic Da Silva <dsdasilva@earthlink.net> writes:
>
> > I am trying to write a script to start of a shell (ie take commands and
> > execute them),
> > but also have any screen info sent to a socket.
> > It would be basically like the typescript command, except that out put
> > will be redirected
> > to a socket rather than a file.
> > Any help will be appreciated.
>
> What exactly is the help you are seeking? I can cook really good eggs
> if you want :)
>
> --Ala
------------------------------
Date: 9 Sep 1999 12:53:05 GMT
From: scarblac-spamtrap@pino.selwerd.cx (Remco Gerlich)
Subject: Re: Sorry, Re: Why, why, why, -w and use strict?
Message-Id: <slrn7tfb8b.k76.scarblac-spamtrap@flits104-37.flits.rug.nl>
Bart Simpson <phony@nospam.com> wrote:
> My ISP recommended using a phony address when posting to newsgroups because
> he says it cuts down on spam.
Then use a phony address. "phony@nospam.com" is completely legal,
and the people at nospam.com won't be happy with you using it.
People will want to reply by mail sometimes; I hate sending this
to the group, because this isn't about Perl. Helping people
is much more important than not having to delete two or three
spam mails per day.
Your ISP is clueless.
(yes, my From: address does say "spamtrap", but it still works).
--
Remco Gerlich, scarblac@pino.selwerd.cx
This is no way to be
Man ought to be free -- Ted Bundy
That man should be me
------------------------------
Date: 9 Sep 1999 06:28:16 -0700
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: suggestion to revise grep (another Q: reference comparison)
Message-Id: <slrn7tf8lr.n90.sitaram@diac.com>
On Wed, 8 Sep 1999 06:06:17 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
>I don't understand what you mean. If two references are equal, they
>refer to the same entity -- 'pointing at the exact same referant' in
>your words. Therefore there is no such thing as a 'deep compare'.
>
>I think you are confusing this comparison with 'deep copy'. Please
>enlighten me if I have misunderstood your observation.
Let's say you make a deep copy of a reference. The resulting
referennce will not be equal (in the stringified sense, that is in
terms of where it is pointing) to the original.
But you ought to be able to compare them just as you copied them,
and determine that their "values" (or referents) are equal. IOW -
if you can "deepcopy" you should be able to "deep compare".
I believe that using Data::Dumper it is actualy possible to deep
compare, even if a module/function for that doesn't already exist!
Haven't tried it.
------------------------------
Date: Thu, 09 Sep 1999 14:02:35 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: suggestion to revise grep (another Q: reference comparison)
Message-Id: <%5PB3.2049$U5.922057@typhoon1.austin.rr.com>
In article <MPG.123fff1a394620a7989f2b@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>I don't understand what you mean. If two references are equal, they
>refer to the same entity -- 'pointing at the exact same referant' in
>your words. Therefore there is no such thing as a 'deep compare'.
>
>I think you are confusing this comparison with 'deep copy'. Please
>enlighten me if I have misunderstood your observation.
In Python you can compare references using == which traverses the
referents and does a "deep compare" or you can use is to see if the
references refer to the same thing.
>>> L1=[1, ('a', 3)]
>>> L2=[1, ('a', 3)]
>>> L1 == L2
1
>>> L1 is L2
0
>>> L3 = L2
>>> L3 is L2
1
>>> L1 == L3
1
In Perl the stringified value of a reference can be used to see if two
references refer to the same thing, but there's no automatic support for
== doing any kind of traversal for you.
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
| 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Thu, 9 Sep 1999 06:34:35 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: use cgi/perl to hide access to subdirectory
Message-Id: <Pine.GSO.4.10.9909090631440.16999-100000@user2.teleport.com>
On Thu, 9 Sep 1999, Andrew wrote:
> I want to have a html page that calls cgi and within the cgi, I simply want
> to run another html page which is thereby hidden from the user. Can it be
> done and how?
No, you can't run HTML pages; they aren't programs. But if you want your
CGI program to access some data which isn't served by your web server,
that's not hard to do, in Perl or any other competent language. See the
docs, FAQs, and newsgroups about CGI programming and related issues for
more information. Let me know if you (or anyone else reading this message)
don't know what those things are or how to search for them. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 09 Sep 1999 12:59:29 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: Using strict?
Message-Id: <RaOB3.96$xa4.1311@news.colt.net>
Danny <danny@blueberry.co.uk> wrote:
> My developers are currently being forced to use strict by the software
> environment that they are programming in - apart from pre-declaring vars
> is there any other obvious potential things that they should look for in
> their code?
They shouldn't use symbolic references either, but that's a rarer occurence
anyway. They shouldn't use bare word subroutine names.
It's unlikely that the use of strict is causing erratic behaviour. Very
unlikely, really.
You need to post more details about the environment your programs are in
(web, I'm guessing), post relevant code snippets, and relevant error messages.
On reflection, it sounds to me like you are doing mod_perl development. Am I
right? If so, you may be better off on the mod_perl mailing list, where the
experts in that particular field can be found:
To subscribe to this list, send mail to majordomo@apache.org with the string "subscribe modperl" in the body.
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. Due to their sizes, neither the Meta-FAQ nor
the FAQ are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq" from
almanac@ruby.oce.orst.edu.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 748
*************************************