[9681] in Perl-Users-Digest
Perl-Users Digest, Issue: 3275 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 28 11:17:19 1998
Date: Tue, 28 Jul 98 08:00:32 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 28 Jul 1998 Volume: 8 Number: 3275
Today's topics:
Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Pos (Peter Seebach)
**Internet Developers Needed - Santa Fe, NM** <jmorris@silcoinc.com>
Re: argv <nguyend7@egr.msu.edu>
bug in lexical array reference? <jpowers@cs.oberlin.edu>
CGI.pm on NT 4.0 and IIS 4.0 <npk@bnl.gov>
Re: Copyright question (William Wueppelmann)
Re: Counting fork()s. (Abigail)
Re: deadlocking sockets (M.J.T. Guy)
Re: Detecting Countries <markstang@ncgroup.com>
How can I use Perl from VC++? <whywest@chollian.net>
Re: Loop Problem <jdporter@min.net>
Re: Loop Problem (Larry Rosler)
Re: newbie string questions. <John.Adams@BentonvilleAR.ncr.com>
Re: Perl 5.004/5.005 difference? (Bug?) (M.J.T. Guy)
Perl5 lwp-download tcdevoe@my-dejanews.com
providing the password when prompted <kshah@paging.mot.com>
Re: Reacting to 1 of 10 or so possible values.... Need <jdporter@min.net>
SQL client... (Peter Seebach)
Re: Submit only Once <jdw@dev.tivoli.com>
Re: three perl questions for the experts <camerond@mail.uca.edu>
Re: Transferring files from client to server philc@hempseed.com
Re: Try perl on Ms Dos <nguyend7@egr.msu.edu>
Uploading Large Files with Perl kfosburg@power.net
xsubpp error <klai@hq.caci.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 28 Jul 1998 14:28:28 GMT
From: seebs@plethora.net (Peter Seebach)
Subject: Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Posted Twice Weekly ***
Message-Id: <gelv1.2712$AI4.10624096@ptah.visi.com>
In article <6p8ru0$skv@bgtnsc03.worldnet.att.net>,
Terry Cora <TerryLCora@worldnet.att.net> wrote:
>Great book!! BTW you can save $7.99 off the $39.95 cover price and help
>support a great free cgi mail list that specializes in Perl by ordering it,
>or several other programming books through http://www.jann.com/Perl/ (use
>the link to go to Amazon.com and order from there - must use the above link
>in order to help support the list though).
But please don't buy books from Spamazon. They've spammed mailing lists
and individuals, they use "opt-out" (you must ask to be removed) lists,
they don't always honor opt-outs, and they won't return email or phone
calls most of the time.
There are bookstores that don't spam.
-s
--
Copyright '98, All rights reserved. Peter Seebach / seebs@plethora.net
C/Unix wizard, Pro-commerce radical, Spam fighter. Boycott Spamazon!
Not speaking for my employer. Questions on C/Unix? Send mail for help.
Visit my new ISP <URL:http://www.plethora.net/> --- More Net, Less Spam!
------------------------------
Date: Tue, 28 Jul 1998 09:49:17 -0400
From: "Jim L. Morris" <jmorris@silcoinc.com>
Subject: **Internet Developers Needed - Santa Fe, NM**
Message-Id: <35bdd710.0@207.49.135.12>
Several Web Developers of all levels needed to design
a wide range of web-based applications for a software
company located in beautiful Santa Fe, New Mexico.
All positions are permanent. Positions include good salary
plus relocation assistance, flex-schedule, and no dress code
(wear shorts everyday if you want) in a low stress, relaxed
atmosphere. Salary ranges for positions range from 40K-100K
and are based on experience.
Positions require some (not all) of the following skills:
Java, Perl/CGI, GUI Design skills, OOP, C++, UNIX, Windows NT
Desirable skills:
Sybase, Oracle, SQL.
Come to Santa Fe, New Mexico and enjoy a relaxed life style,
warm weather most of the year, mountains, skiing, etc. all in
one beautiful location.
Due to the immediate needs of our client we cannot consider
H-1 candidates at this time. Must be located in the U.S. to be
considered. Calls from subcontracting organizations and 3rd
parties will not be accepted
For more info. contact: (Prefer E-mail)
Jim Morris
SILCO Software Technology, Inc.
jmorris@silcoinc.com
888-745-2646 ext. 11(toll free)
813-939-0703 (Fax)
------------------------------
Date: 28 Jul 1998 14:50:49 GMT
From: Dan Nguyen <nguyend7@egr.msu.edu>
Subject: Re: argv
Message-Id: <6pkog9$qu4$1@msunews.cl.msu.edu>
Michel Weegerink <mmcw@worldonline.nl> wrote:
: Does anybody know how to use the argv argument. I know how to use the
: first argv.
: It works something like this:
: if ($ARGV[0] eq "form") {$testing;}
Yes that's right.
: you call it something like this:
: http://www.testing.com/cgi-bin/test.pl?form
No that's not. It is right if it is a CGI. But then you CANNOT use @ARGV.
The string after the '?' is stored in $ENV{QUERY_STRING} You have to
do your own parsing, or you could use the CGI module.
-dan
--
Dan Nguyen | There is only one happiness in
nguyend7@msu.edu | life, to love and be loved.
http://www.cse.msu.edu/~nguyend7 | -George Sand
------------------------------
Date: Tue, 28 Jul 1998 10:21:53 -0400
From: Joshua Powers <jpowers@cs.oberlin.edu>
Subject: bug in lexical array reference?
Message-Id: <Pine.ULT.3.96.980728100403.2623I-100000@occs.cs.oberlin.edu>
I am reposting this message, as I did not get a response:
I have written a library database class in perl which uses GDBM and MLDBM.
Because the instances of this database are multilayered, I maintain lists
of each field's values and the records associated with them at the root
level of the hash in order to simplify searching. One of the options for
an instance of this database is to modify its field(s). When a field is
modified, I create an array in the instance which enumerates the fields
which have been modified and the old values associated with them. This is
so I can update these root-level lists if and when the instance is stored.
When instances are retrieved from the database, they are stored in an
array. When a request is made on the array, the class iterates over each
item in the array and fills the request for each item.
For example, you can say something like this:
my $books = Book->retrieve_where("title =~ /software/i");
now $books is an object of type "LibraryItemArray" - it is an array of
book objects matching the given request.
Now you can modify a field for every book in this array:
$books->modify_field("author","John Doe");
The problem I'm running into is that when a field is modified for one of
these arrays, every item in the array ends up pointing to the same list of
old values, even though this list is recreated on each iteration.
The code which creates the list of old values is shown below: (the \037 is
just to ensure that we don't mistake our list of old values for a field
that someone has named "oldvalues")
{
my @old_vals = @{$caller->{"old\037values"}} if defined
($caller->{"old\037values"});
if ($instance_dependent) {
push (@old_vals, ($field, $caller->{$field}->[$instance]));
$caller->{$field}->[$instance] = $newvalue;
}
else {
$newvalue = $instance;
push (@old_vals, ($field, $caller->{$field}));
$caller->{$field} = $newvalue;
}
$caller->{"old\037values"} = \@old_vals;
}
as you can see, the list "old_vals" gets recreated every time. I have
even placed this code within its own block to force the issue, although
this particular section of code occurs at the very end of a method. Here
is the code which uses these classes:
{
$instance = 1;
$book = Book->retrieve_where("copies > 1");
print Dumper ($book);
$book->modify_field("status", "$instance", "groggy");
print Dumper ($book);
}
The results show what I am talking about: The first dump is fine. All
books are retrieved normally:
$VAR1 = bless( [
bless( {
'year_published' => 1991,
'title' => 'Checking C Programs with Lint',
'author' => 'Ian Darwin',
'copies' => 2,
'status' => [
'available',
'available'
],
'reviews' => 'none',
'editor' => 'none',
'location' => [
'Room 125N',
'Room 125N'
],
'number' => 6,
'owner' => [
'AIS',
'AIS'
],
'picture' => 'no',
'isbn' => '0937175307',
'acquired' => 883634400,
'publisher' => 'O\'Reilly'
}, 'Book' ),
bless( {
'year_published' => 1995,
'title' => 'Compute In Comfort',
'author' => 'Paul Linden',
'copies' => 2,
'status' => [
'available',
'available'
],
'reviews' => 'none',
'editor' => 'none',
'location' => [
'Room 125N',
'Room 125N'
],
'number' => 13,
'owner' => [
'AIS',
'AIS'
],
'picture' => 'yes',
'isbn' => '0133099156',
'acquired' => 883634400,
'publisher' => 'Prentice Hall PTR'
}, 'Book' ),
...
(etc.)
The second dump (after the field "status" has been modified) shows that
the list of old values is only created once, stored in the first instance,
and then referenced in each successive instance:
$VAR1 = bless( [
bless( {
'year_published' => 1991,
'title' => 'Checking C Programs with Lint',
'author' => 'Ian Darwin',
'copies' => 2,
'status' => [
'available',
'groggy'
],
'reviews' => 'none',
'editor' => 'none',
'location' => [
'Room 125N',
'Room 125N'
],
'number' => 6,
'owner' => [
'AIS',
'AIS'
],
'picture' => 'no',
'isbn' => '0937175307',
'oldvalues' => [
'status',
'available',
'status',
'available',
'status',
'available',
'status',
'available',
'status',
'available',
'status',
'available',
'status',
'available',
'status',
'available'
],
'acquired' => 883634400,
'publisher' => 'O\'Reilly'
}, 'Book' ),
bless( {
'year_published' => 1995,
'title' => 'Compute In Comfort',
'author' => 'Paul Linden',
'copies' => 2,
'status' => [
'available',
'groggy'
],
'reviews' => 'none',
'editor' => 'none',
'location' => [
'Room 125N',
'Room 125N'
],
'number' => 13,
'owner' => [
'AIS',
'AIS'
],
'picture' => 'yes',
'isbn' => '0133099156',
'oldvalues' => $VAR1->[0]{'oldvalues'},
'acquired' => 883634400,
'publisher' => 'Prentice Hall PTR'
}, 'Book' ),
bless( {
'year_published' => 1990,
'title' => 'Learning PostScript - A Visual
Approach',
'author' => 'Ross Smith',
'copies' => 2,
'status' => [
'available',
'groggy'
],
'reviews' => 'none',
'editor' => 'none',
'location' => [
'Room 125N',
'Room 125N'
],
'number' => 41,
'owner' => [
'AIS',
'AIS'
],
'picture' => 'no',
'isbn' => '0938151126',
'oldvalues' => $VAR1->[0]{'oldvalues'},
'acquired' => 883634400,
'publisher' => 'Peach Pit Press'
}, 'Book' ),
...
(etc.)
The interesting thing (which I just discovered) is that this does not
happen if I rewrite the code which writes @old_vals as follows:
{
my @old_vals;
if (defined ($caller->{"old\037values"})) {
@old_vals = @{$caller->{"old\037values"}};
}
...
(etc.)
It seems that if I say:
my @old_vals = @{$caller->{"old\037values"}} if defined
($caller->{"old\037values"});
instead of the above, perl somehow looks back to a previous invocation of
this method to find a $caller that DOES have an "old\037values" array and
references this new array to that one instead of simply creating a new
array. Is this bizarre, or is it just me? Does anyone have any idea what
is going on here?
-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-^-_-
Josh Powers - jpowers@cs.oberlin.edu
http://www.cs.oberlin.edu/~jpowers
------------------------------
Date: Tue, 28 Jul 1998 14:39:17 +0000
From: Nicholas Konidaris <npk@bnl.gov>
Subject: CGI.pm on NT 4.0 and IIS 4.0
Message-Id: <35BDE295.43B6402A@bnl.gov>
Hello all,
I'm having a problem which I'd appreciate your help on: In IIS 4.0 on
Windows NT running
Gurusamy Sarathy's binary version of Perl, I have a problem.
I set up .pl to run perl.exe (in the properties sheet) as it should, but
then, when I open up a perl
file, it just sits there, doing nothing. Examining the current running
tasks, shows that perl.exe
has been spawned, but is taking no CPU or memory. Does anyone have any
experience with
this?
Thanks a lot!
------------------------------
Date: 28 Jul 1998 14:30:44 GMT
From: william@host.ott.igs.net (William Wueppelmann)
Subject: Re: Copyright question
Message-Id: <6pknak$pam$1@news.igs.net>
Dustin Cobb (dcobb@cyberrealm.net) wrote:
: I'm a cgi programmer and I've written many scripts for the ISP I work
: for. Recently, I've been told by someone else in our company that the
: scripts that we've written in Perl cannot be copyrighted due to the fact
: that Perl isn't a compiled language. Therefore, we would have to
: re-write most of these scripts in another language (like C/C++) to
: obtain a copyright. Is this true? Can anyone give me an example of
: some software that is written entirely in Perl and is legitimately
: copyrighted?
What, really, are you going to copyright? Are you going to patent
$i += 1;
and try to sue anyone who uses it in one of their programs? Or are you
going to copyright the functionality of your script? (If someone else
writes a mailto script, are you going to drag them into court because
they stole your idea?)
Of course, I can't think of a reason why you'd want to copyright your
scripts either. Unless you are a phenomenally good programmer, I'm fairly
certain that any script that you've written that is general enough that
others might want to use it has also been implemented by someone else who
is willing to make it freely avialable. After all, there is only so much
you can do with generic CGI scripts, and there are lots of people who
build them.
William
------------------------------
Date: 28 Jul 1998 14:49:14 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Counting fork()s.
Message-Id: <6pkoda$f8o$1@client3.news.psi.net>
dwiesel@my-dejanews.com (dwiesel@my-dejanews.com) wrote on MDCCXCII
September MCMXCIII in <URL: news:6pk3v3$7cg$1@nnrp1.dejanews.com>:
++ Ok. Now I have figured out the problem. The problem was that I can't fork as
++ much as I want to. Therefore I have to check if my forking was a failure or
++ not.
++
++ Well, I still have some problems. I wan't to have a loop that continues until
++ I have done all the forks that I want to do. Then at the end, I want to wait
++ until all the forks are done.
++
++ $number_of_forks = 5;
++ $started_forks = 0;
++ $finished_forks = 0;
++
++ $SIG{CHLD} = sub { wait; $finished_forks++; };
++
++ while($started_forks <= $number_of_forks)
++ {
++ if ($pid = fork)
++ {
++ $started_forks++;
++
++ # If child
++ if ($pid == 0)
++ {
++ &do_something_that_takes_a_while;
++ exit 0;
++ }
++ }
++ }
++
++ while($finished_forks != $number_of_forks)
++ {
++ sleep 1;
++ }
++
++ &handle_the_rest_of_the_program;
++
++ Well, when I run the above code I end up in a neverending loop. I can't figur
++ out why. Maby someone has a solution to my problem?
There are several problems with your program. First, "$started_forks ++"
only happens *after* fork(), which means that every child gets the
original value of $started_forks. Hence, there will always be a child
who has $started_forks == 0. Second, (and this makes the first thing so
bad), the 'if ($pid == 0) {}' part is *inside* the 'if ($pid = fork)'
part. Hence, that will never be executed - no child will ever reach the
'exit 0'. Third, the '$started_forks <= $number_of_forks' is wrong;
that should be '$started_forks < $number_of_forks'.
#!/usr/local/bin/perl -w
use strict;
my $number_of_forks = 5;
my $started_forks = 0;
my $finished_forks = 0;
$SIG {CHLD} = sub { wait;
$finished_forks ++;
warn "$$ reaped a child (finished: $finished_forks)\n";
};
while ($started_forks < $number_of_forks) {
$started_forks ++;
my $pid = fork;
if ($pid) {
warn "$$ forked process $pid (started: $started_forks)\n";
}
else {
if (defined $pid) {
warn "Child stuff by $$\n";
}
else {
warn "Fork by $$ failed\n";
}
exit;
}
}
while ($finished_forks != $number_of_forks) {sleep 1;}
warn "$$: Terminating\n";
__END__
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: 28 Jul 1998 14:27:31 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: deadlocking sockets
Message-Id: <6pkn4j$8hu$1@pegasus.csx.cam.ac.uk>
In article <6pkhd5$k4p$1@nnrp1.dejanews.com>, <faganb@my-dejanews.com> wrote:
>I am trying to write a c/s app using sockets and developing my own
>application level protocol. I can't send and receive on the socket without
>deadlocking. Does anyone have a more extensive example of a send-receive-send
>scenario? I've got camel, llama, and leopard to no avail. I'm missing
>something obvious.
Are you setting autoflush ($|) in all relevant places?
Otherwise, difficult to guess without sight of some code.
Mike Guy
------------------------------
Date: Tue, 28 Jul 1998 10:32:24 -0400
From: "Mark Stang" <markstang@ncgroup.com>
Subject: Re: Detecting Countries
Message-Id: <6pknf5$oj5$1@usenet1.interramp.com>
The UK
Ian Boys wrote in message <35BDA2F8.5656@aspentech.com>...
>Scott wrote:
>>
>> You could sell a dongle with it that has a GPS receiver. :-)
>>
>> I'd look at the domain, and if it ends with one of the myriad of USA or
the
>> Canadian postfix, you could not let it run.
>>
>
>Hmmm. My email address is boys@aspentech.com. I access the internet
>via an ISP in Boston, MA. Which country am I in?
>
>PS: It is not the USA.
>
>Ian
------------------------------
Date: Tue, 28 Jul 1998 14:13:42 GMT
From: "Seungchul Choe" <whywest@chollian.net>
Subject: How can I use Perl from VC++?
Message-Id: <q0lv1.215$L72.646070@news1>
I compiled a C code which has some Perl code like this;
#include <stdio.h>
#include <EXTERN.h>
#include <perl.h>
static PerlInterpreter *my_perl;
int main(int argc, char **argv, char **env)
{
my_perl=perl_alloc();
......
perl_free(my_perl);
}
This code is in 'perlembed' document distributed from Perl5.0.
anyway, it compiled but, didn't linked, displaying this error;
error LNK2001: unresolved external symbol _perl_free
......
error LNK2001: unresolved external symbol _perl_alloc
How can I do? need help....
Additionally, can I use perl with C++ code in VC++? and how?
------------------------------
Date: Tue, 28 Jul 1998 14:45:29 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Loop Problem
Message-Id: <35BDE478.4338@min.net>
Juli@my-dejanews.com wrote:
>
> while (defined ($line = <SAM>) ) {
> # if cusip matches write line to file
> if ($line =~ /$cusip/) {
> push (@file, $line);
> $found = 1;
> }
> # else match all the variables, write line(s) to file
> else {
> foreach $nameitem (@name){
> foreach $familyitem (@family){
>
> if (($line =~ /$nameitem/) &&
> ($line =~ /$familyitem/)) {
>...
Two things:
1. when using a variable in a regex like this, you should
quote the metachars in it (unless the variable is supposed
to contain regex stuff), like this:
if ( $line =~ /\Q$cusip\E/ ) {...
and similarly /\Q$nameitem\E/ and /\Q$familyitem\E/.
2. perhaps you should test the important variables for non-
emptiness before even going into this loop, and maybe
give an error message in such cases.
unless ( length($cusip) && @name && @family ) {
print "MISSING DATA";
}
else {
# continue with loops...
--
John Porter
------------------------------
Date: Tue, 28 Jul 1998 07:40:05 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Loop Problem
Message-Id: <MPG.102782a319a1f4c989797@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <6pk09j$3qa$1@nnrp1.dejanews.com> on Tue, 28 Jul 1998 07:57:40
GMT, dave@mag-sol.com <dave@mag-sol.com> says...
...
> if (($line =~ /$nameitem/) &&
> ($line =~ /$familyitem/))
>
> which you expect to fail if $nameitem and $familyitem don't have data in them.
> In this case they will effectively contain an empty string and an empty string
> will match whatever you have in $line.
No it won't. It will match whatever the previous successful match did.
Here is a simple test:
#!/usr/local/bin/perl -w
use strict;
my $foo = '';
$_ = 'abcd';
/bc/;
/$foo/ and print "$_\n"; # prints abcd
$_ = 'efgh';
/$foo/ and print "$_\n"; # doesn't print -- no match against 'bc'
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 28 Jul 1998 09:10:31 -0500
From: John Adams <John.Adams@BentonvilleAR.ncr.com>
Subject: Re: newbie string questions.
Message-Id: <35BDDBD7.3564@BentonvilleAR.ncr.com>
In answer to this statement:
>
> > The original poster asked for 'the first sentence', and a warning
> > should be given that that is not at all trivial. Even looking for a
> > full stop followed by spacing and a capital letter won't always work
> > (think of Dr. Spock, Rev. Doolittle, St. Joan).
I think of at least two of them frequently... ;-)
Michael Maraist wrote:
> Simple enough.. Just require that a sentence be defined as a line of
> characters followed by a period and two spaces. That's how I've always
> been taught at least.
The problem is that that's typewriting rather than typesetting or
computer usage. I was taught the same way myself, back in the
prehistoric seventies, but it's not a standard anyone uses anymore.
John A
...who used to be the best proofreader in the county
...speaking only for himself and not his fine employer
------------------------------
Date: 28 Jul 1998 14:25:29 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Perl 5.004/5.005 difference? (Bug?)
Message-Id: <6pkn0p$8gu$1@pegasus.csx.cam.ac.uk>
Lars Andersson <barse@acc.umu.se> wrote:
>I think I found a bug in the 5.005 version of Perl. The program
>
>foreach $i (60..90) {
> if ($i =~ /7/g){next}
> else {print "$i "}
>}
>
>results in the following output when run in Perl 5.003_07 (Debian) or
>5.004_04 (Solaris):
>
>60 61 62 63 64 65 66 68 69 80 81 82 83 84 85 86 88 89 90
>
>
>When I try running it through Perl 5.004_71 (MSWin32-x86) or 5.004_75
>(RedHat) I get the following output:
>
>60 61 62 63 64 65 66 68 69 71 73 75 78 80 81 82 83 84 85 86 88 89 90
This change looks like a bug to me - pos($i) should be reset each time
round the loop, since $i is updated. Reported to perlbug.
OTOH, that /g is a rather eccentric thing to do. Is it really what
you intended?
Mike Guy
------------------------------
Date: Tue, 28 Jul 1998 14:04:50 GMT
From: tcdevoe@my-dejanews.com
Subject: Perl5 lwp-download
Message-Id: <6pklq2$ord$1@nnrp1.dejanews.com>
I've just begun to code with Perl and have built/customized some Perl CGI
scripts. I found lwp-download to download a file from the internet to a local
machine. There are multiple modules required to use this.
This is my situation. I have a Win/95 machine at home where I edit Perl
scripts/html and upload them to the UNIX server. I've read the readme files
that describe how to build the module(s). Since I don't have UNIX to
compile/make the module, is there someplace to access an already built
module(s)?
Thanks for the help.
Tom
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Tue, 28 Jul 1998 10:34:10 -0400
From: "Ketan G. Shah" <kshah@paging.mot.com>
Subject: providing the password when prompted
Message-Id: <35BDE161.D8511DD6@paging.mot.com>
--------------8E5C692DAE5A4511F5FE7FAB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I am trying to use rexec..HPUX.
Here is what the following program looks like.
This currently a shell script. but would like to make it a perl script.
Once the rexec command is executed it asks me for a password.
1. I would like to provide the password automatically.
2. Also would like to redirect the output from the ps command to a file.
Please help.
file=`date +%m%d%H%M`
for i in `cat ~/filedir/servers`
do
rexec $i -l kshah -n ps -ef <would like to redirect the ps output to
~/filedir/$i_$file>???
done
Thanks in advance.
--
Ketan
--------------8E5C692DAE5A4511F5FE7FAB
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#FF0000" ALINK="#000088">
I am trying to use rexec..HPUX.
<P>Here is what the following program looks like.
<BR>This currently a shell script. but would like to make it a perl script.
<P>Once the rexec command is executed it asks me for a password.
<P>1. I would like to provide the password automatically.
<BR>2. Also would like to redirect the output from the ps command to a
file.
<P>Please help.
<BR>
<P>file=`date +%m%d%H%M`
<P>for i in `cat ~/filedir/servers`
<BR>do
<BR> rexec $i -l kshah -n ps -ef <would like to redirect
the ps output to ~/filedir/$i_$file>???
<BR>done
<BR>
<PRE>Thanks in advance.</PRE>
<PRE>--
Ketan</PRE>
</BODY>
</HTML>
--------------8E5C692DAE5A4511F5FE7FAB--
------------------------------
Date: Tue, 28 Jul 1998 14:06:12 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Reacting to 1 of 10 or so possible values.... Need some streamlining help.
Message-Id: <35BDDB43.557B@min.net>
Ilya Zakharevich wrote:
>
> use 5.005;
> m{
> ^typeOne$ (?{ Do-type-one })
> |
> ^typeTwo$ (?{ Do-type-two })
> |
> (?{ Do-default })
> }x;
Extremely cool.
I don't have 5.005 yet, so permit me to inquire.
I infer from your example that:
1. ?{ code } is a way to eval some code within a regex.
is the result of the eval then inserted into the regex
at that point?
2. regex patterns are short-circuit evaluated,
so if ^typeOne$ is not found, then (?{ do_typeOne })
is not evaluated?
--
John Porter
------------------------------
Date: Tue, 28 Jul 1998 14:32:41 GMT
From: seebs@plethora.net (Peter Seebach)
Subject: SQL client...
Message-Id: <dilv1.2715$AI4.10642931@ptah.visi.com>
So, I've used things like DBD::Oracle in the past... I'm wondering what the
best option is (if there is one) to have a perl script talk to a remote
SQL server. I've looked at DBD::Sybase and DBD::ODBC, because someone
mentioned those in a post here, but both seem to assume that there's some
SQL-related software on the local system.
Is there a way to do this with nothing that resembles a database on the
local (Unix) system? Ideally, I'd like something that acts like a DBD::...
module, and lets me attach to a remote SQL database. I'm afraid the SQL
server may be running on an NT box.
If there is a more appropriate newsgroup for this, please let me know; I've
misplaced all of my active files, and this is the only perl newsgroup I
remember.
-s
--
Copyright '98, All rights reserved. Peter Seebach / seebs@plethora.net
C/Unix wizard, Pro-commerce radical, Spam fighter. Boycott Spamazon!
Not speaking for my employer. Questions on C/Unix? Send mail for help.
Visit my new ISP <URL:http://www.plethora.net/> --- More Net, Less Spam!
------------------------------
Date: 27 Jul 1998 22:56:59 -0500
From: "Jim Woodgate" <jdw@dev.tivoli.com>
Subject: Re: Submit only Once
Message-Id: <obbtqahblg.fsf@alder.dev.tivoli.com>
root.noharvest.\@not_even\here.com (-) writes:
> "Jim Woodgate" <jdw@dev.tivoli.com> Said this:
>
> >You could generate a random number, store it in a hidden field (which
> >would need to be recalculated on a form reset), then store that
> >hidden/random number in a database when they submit a *good* form.
>
> Why would it need to be "recalculated" on a form reset? You do mean a
> "clear all fields" or "reset" button created like this,
>
> <input type=reset>
>
> right?
that what I said and was thinking, but as someone else and you pointed
out, the hidden fields won't be re-generated, so a "reload" is
actually needed.
The reason you need this is because the original poster said he wanted
the users to be able to go back, reset the form, and submit something
new. If the random number isn't regenerated, even with a form reset,
the user won't be able to submit.
> >You might also want to save the random number initially, so the user
> >can't modify the form and put in his/her own random numbers, but that
> >seems a bit excessive
>
> <input type="hidden" name="session-id" value="xyz23450zxcer">
>
> There, that's simple enough. Anybody who doesn't use frontpage to
> create web pages should be skilled enough to save the page and alter
> the code, but so what.
that's why I said to save the random number initially, if the user
saves the front page and alters the key, when they submit the form,
the cgi-script will see a random key that it didn't create and puke.
--
Jim Woodgate
Tivoli Systems
E-Mail: jdw@tivoli.com
(512)436-8134
------------------------------
Date: Tue, 28 Jul 1998 09:16:31 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
To: KHeise <kheise@aol.com>
Subject: Re: three perl questions for the experts
Message-Id: <35BDDD3F.D3EB8AFC@mail.uca.edu>
[cc'd to jo (KH)]
You're using Windows, aren't you? Q's 2 and 3 certainly sound like it.
If so, you need to use binmode (FILEHANDLE), look in perlfunc for
details. It should fix everything. Q 1, I don't send output to a
printer, so I don't know, but there has been a lot of discussion on this
on the Win32-perl mailing lists, look in the archives there.
If you don't use Windows, disregard the preceding.
Cameron
camerond@mail.uca.edu
KHeise wrote:
>
> i am a perl novice who has read a couple of books on the subject, but couldnt
> seem to find the answers to any of these questions.
>
> 1) how can i direct output to a printer (for a printed report) using perl? i
> suspect it has to do with redirecting STDIO, but i have not been able to find
> any info on how to accomplish this.
>
> 2) i use perl to do file processing on large fixed length customer lists.
> recently found out how to read each record in the list as binary data. so
> here's what i am doing: a) reading x number of bytes of binary data into
> memory (x=record length) b) performing some sort of processing on this chunk
> of data c) writing the chunk to hard disk into another file. i perform these
> kinds of tasks daily as a dierect mail programmer, and perl does a fine job for
> most files i receive, but i noticed something perl is doing to some of my data
> which is unacceptable for my purposes: when a line-feed character (hex 0A)
> falls in the middle of one of my records a carriage-return character (hex 0D)
> is inserted before the line-feed, thus adding a charcter to my record. i cannot
> have this happen, because the work that i do requres that the file MUST be a
> fixed number of characters. does anyone know how i can avoid this? is it in a
> module that can be edited?
>
> 3) lastly, if there is an end of file marker (hex 1A) in a file i am
> processing, it stops my program dead in its tracks. is this the same sort of
> problem as question 2? is there any way to get around this?
>
> i hope these questions can be answered, and truly appreciate ANY input (ex.
> "Read page $pageNumber in $bookName, rookie.).
>
> thanks,
>
> jay o'neill
>
> kheise@pgicompanies.com
------------------------------
Date: Tue, 28 Jul 1998 14:44:28 GMT
From: philc@hempseed.com
Subject: Re: Transferring files from client to server
Message-Id: <6pko4d$rua$1@nnrp1.dejanews.com>
In article <35BD40B8.F1C999BC@triologic.com>,
Nick Forte <webmaster@triologic.com> wrote:
> while (<$filename>)
> {
> print OUT;
> }
> close(OUT);
This looks a little iffy. Since it's binary data you're transferring, I
wouldn't read it line by line...The code I am using in my file upload script
is:
open (OUTFILE, '>' . $path . "\\$localName");
# Not sure whether I need this or not, but it won't
# hurt if i don't.
binmode(OUTFILE);
binmode($name);
while ($Bytes = read($name,$Buffer,1024)) {
$BytesRead += $Bytes;
print OUTFILE $Buffer;
}
close OUTFILE;
Of course, although this works as far as transferring the file, it fails
(with a "Document contains no data.") every other time. However, that is most
probably specific to my particular script. (Actually, if anyone else has run
int this, I'd appreciate any help as well)
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 28 Jul 1998 14:55:00 GMT
From: Dan Nguyen <nguyend7@egr.msu.edu>
Subject: Re: Try perl on Ms Dos
Message-Id: <6pkoo4$qu4$2@msunews.cl.msu.edu>
Suruchi <sursood@mail.emirates.net.ae> wrote:
: i'm using notepad to make the program.
There's your problem, your using notepad. Notepad will not let you
save in any extensions it doesn't know about. You'll have to edit the
registry and add the pl extension. Hopefully then it should work.
--
Dan Nguyen | There is only one happiness in
nguyend7@msu.edu | life, to love and be loved.
http://www.cse.msu.edu/~nguyend7 | -George Sand
------------------------------
Date: Tue, 28 Jul 1998 13:58:12 GMT
From: kfosburg@power.net
Subject: Uploading Large Files with Perl
Message-Id: <6pkldl$oeb$1@nnrp1.dejanews.com>
Hello,
I'm using a perl upload script to have users upload their files to a server,
and have problems with large files (30+ MB). I'm using a script that uses
CGI_LIB.pl on a SGI O2 running perl 5.002.
The problem is that the perl program uses about 3 times the memory than the
file size, which pretty much exhausts the available memory leading to
potential problems. Also, users have no way of knowing how far along their
transfer is.
I would like to use ftp, but MS IE doesn't support ftp://username@host syntax,
and can only use ftp://username:passwd@host. Users (IntrAnet only) freak out
when they see their password flashing on their screen.
Any suggestions would be appreaciated.
Thanks in advance,
Karl Fosburg <kfosburg@power.net>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Tue, 28 Jul 1998 14:53:34 GMT
From: "Khuong" <klai@hq.caci.com>
Subject: xsubpp error
Message-Id: <01bdba37$e1f2df40$35120a0a@Khuong.hq.caci.com>
I downloaded Tcl extension module from CPAN.
I edited Makefile.PL so LIBS and INCLUDE point to my Tcl libs.
I did:
"perl Makefile.PL" gave me this output:
Writing makefile for Tcl
usage: subpp [-V] [-C++]...........file.xs
Anyone knows how to fix this.
Thanks
I'm using:
windows 95
perl 5.004
Tcl 8.1
Moreover, I successfully did that on my Solaris 2.6. Any idea? is there any
different between Tcl extension module on windows 95 and solaris.
Thanks again
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". 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". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 3275
**************************************