[9230] in Perl-Users-Digest
Perl-Users Digest, Issue: 2825 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 9 22:07:36 1998
Date: Tue, 9 Jun 98 19:00:31 -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, 9 Jun 1998 Volume: 8 Number: 2825
Today's topics:
*** E-DATA 1.2: Release *** <boliviaweb@prodigy.net>
Re: Animated gifs question ... (Abigail)
Array Notation...Slices and Elements (Eric Weiss)
Re: CALCULATING DATE RANGES (Martien Verbruggen)
Re: CALCULATING DATE RANGES (Mike Stok)
Re: Certified Perl Programmers (Mark-Jason Dominus)
Re: Command line substitution thru subdirectories (Allan M. Due)
Re: Command line substitution thru subdirectories (Abigail)
efficient comparisons (Darwin O.V. Alonso)
Re: efficient comparisons <bowlin@sirius.com>
Electronic Fax? <jcong@ipacs.com>
Re: Exercise in Llama Book <kennerDELETE.ME@xnet.com>
How to "protect" cgi-bin scripts from view? jr32@hotmail.com
ip address, windows 95 & perl <josri@postoffice.pacbell.net>
Re: ip address, windows 95 & perl <bowlin@sirius.com>
Re: ip address, windows 95 & perl <nsyte@hotmail.com>
Re: Latest Perl on Slakeware 2.0.33 (Stefaan A Eeckels)
Re: McCabe complexity analysis (Stefaan A Eeckels)
Re: McCabe complexity analysis <tchrist@mox.perl.com>
Need a HP ov Orphan Process Killer <mahddh@gate.net>
Re: NEED HELP: stty and the perl compiler <nsyte@hotmail.com>
New module/pragma "enum.pm" (was "fields.pm") <zenin@bawdycaste.org>
Re: newbie: trying to remove unwanted data from an arra (Tom Harrington)
open pipe? <kquinn@sk.sympatico.ca>
Re: open pipe? (Charles DeRykus)
pack/unpack seps <rs83@is7.nyu.edu>
Re: pass the gravy and the hashref, please -- solved <cwinters@intes.net>
Re: Reading Directories (Shaun Sides)
Re: Stopping Perl from interpreting fprintf's in a C fi (Stefaan A Eeckels)
Stripping HTML coding from CGI data for Perl <lakesoft@skypoint.com>
Re: Web Hosting with CGI freew3@my-dejanews.com
Re: Web Hosting with CGI (Bob Trieger)
Re: Win95 problems for Perl? Need assistance here! <bburlingnews@iname.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 9 Jun 1998 17:00:06 -0400
From: "Claudia Soria" <boliviaweb@prodigy.net>
Subject: *** E-DATA 1.2: Release ***
Message-Id: <6lk7vh$71fq$1@newssvr04-int.news.prodigy.com>
E-DATA 1.2
For all users and programmers interested in Perl programs,
there is a new web site, Adventia Software (www.adventia.com),
which is developing a series of Perl applications as well as ASP components
that can be useful.
The newest one is the E-Data 1.2. E-Data is an e-mail directory written in
Perl that allows you to enhance your web site by letting visitors add their
personal information (e.g. name, e-mail, hobbies or activities, web address,
etc.) to a directory.
E-Data 1.2 has the following features:
1.Easy search by first name, last name or e-mail
2.Entries alphabetically indexed
3.Users can update their own information
4.Easy customization of interface (HTML)
E-Data 1.2 can be found at http://www.adventia.com/e-data.htm
For a Live Demo please go to http://www.adventia.com/cgi-bin/dir.pl
Feedback regarding this product is very welcome at info@adventia.com.
Thanks,
Adventia
------------------------------
Date: 10 Jun 1998 00:41:16 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Animated gifs question ...
Message-Id: <6lkknc$7vj$2@client3.news.psi.net>
John Bokma (postmaster@castleamber.com) wrote on MDCCXLIII September
MCMXCIII in <URL: news:01bd93e7$d8f7f860$02521e0a@tschai>:
++
++
++ Why don't you use:
++
++ print "Location: http://www.your.server.com/youranimated.gif\n\n";
++
Because that would be very bad. You might want to use:
print "Location: http://www.your.server.com/youranimated.gif\015\012\015\012";
instead, as that is 1) according to the RFC, 2) portable.
Abigail
--
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
print+Just (), another (), Perl (), Hacker ();'
------------------------------
Date: Tue, 9 Jun 1998 21:42:42 -0400
From: eweiss@winchendon.com (Eric Weiss)
Subject: Array Notation...Slices and Elements
Message-Id: <MPG.fe7ae9c8de4ec169896e4@news.dgsys.com>
Does anyone know why it is @array, @array[1,2], but $array[3]?
OK, @array[3] also works as a slice of 1, but is this any better
or worse than $array[3]?
TIA
Eric
------------------------------
Date: 9 Jun 1998 23:18:08 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: CALCULATING DATE RANGES
Message-Id: <6lkfrg$nua$1@comdyn.comdyn.com.au>
In article <slrn6nr8gg.p05.wllngton@worf.netins.net>,
wllngton@netins.net (WELLINGTON APARTMENT) writes:
> Can anyone help me with this problem? I want to calculate some dates
> based on someone entering a date like 6/9/98 and telling it to pull up
> information based on the last 4 days... so it figures out that 1 day
> ago was 6/8/98 and two days ago was 6/7/98, etc.
Maybe the module Date::DateCalc can help you out? Get it from CPAN, or
try one of the other Time:: or Date:: modules:
http://www.perl.com/CPAN/modules/
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | I'm desperately trying to figure out
Commercial Dynamics Pty. Ltd. | why kamikaze pilots wore helmets - Dave
NSW, Australia | Edison
------------------------------
Date: 10 Jun 1998 01:36:16 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: CALCULATING DATE RANGES
Message-Id: <6lknug$i84@news-central.tiac.net>
In article <slrn6nr8gg.p05.wllngton@worf.netins.net>,
WELLINGTON APARTMENT <wllngton@netins.net> wrote:
>Can anyone help me with this problem? I want to calculate some dates
>based on someone entering a date like 6/9/98 and telling it to pull up
>information based on the last 4 days... so it figures out that 1 day
>ago was 6/8/98 and two days ago was 6/7/98, etc.
You might do well to go and look at CPAN, the comprehensive perl archive
network. There are several modules on there to do with Date and Time
manipulation. One place to find a pointer to CPAN is at
http://www.perl.com and follow a link with CPAN in it.
Alternatively you can use the Time::Local module to convert a user
supplied date into seconds since the epoch and then subtract 4 days worth
of seconds from that and use th builtin function localtime to convert back
to something you can get a date out of (maybe using the POSIX module's
strftime if you liked)
perldoc Time::Local
perldoc POSIX
perldoc -f localtime
should all get documentation from a recent perl installation displayed on
your terminal.
Hope this helps,
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
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: 9 Jun 1998 21:10:05 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Certified Perl Programmers
Message-Id: <6lkmdd$bui$1@monet.op.net>
Keywords: Flemish foggy plagiarism prize
In article <EuAxH7.9p4@news.boeing.com>,
Charles DeRykus <ced@bcstec.ca.boeing.com> wrote:
>Perhaps though the Perl Institute could issue a certificate.
I may be mistaken, but I thought that TPI had specifically desclined
to issue certifications. Of course, that policy could be changed, if
there is such a policy.
For my scheme to work, it helps to have as many competing certifynig
authorities as possible.
------------------------------
Date: 9 Jun 1998 22:40:44 GMT
From: due@murray.fordham.edu (Allan M. Due)
Subject: Re: Command line substitution thru subdirectories
Message-Id: <6lkdlc$n4f$0@206.165.146.194>
In article <357DA4E9.DA495FD6@code80.npt.nuwc.navy.mil>, Bob Roklan
(roklan_r@code80.npt.nuwc.navy.mil) posted...
| I am running Perl 5.003 on Windows 95. I would like to specify a
|substitution string for multiple files spanning specified directory and
|its subdiredirectories.
|
|I know that the following would work for the current directory....
|
| perl -i.old -p -e "s/foo/bar/g" *.htm
|
|but how can I tell perl to do the same for a specified directory and
|down?
|
|Info would be greatly appreciated. While I am here can I ask another
|question? Ok, thanks. Does anyone know of a news server where I can at
|least read comp.lang.perl.misc thru a news reader? Ours does not allow
|you to search subjects.
|
|
On the newsreader front try Gravity. By far the best Windoze ENV
newsreader IMHO (all appologies to Agent fans, Agent is the best *free*
newsreader for Windoze).
http://www.microplanet.com/
--
Allan M. Due
Due@Murray.Fordham.edu
The beginning of wisdom is the definitions of terms.
- Socrates
------------------------------
Date: 10 Jun 1998 00:25:38 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Command line substitution thru subdirectories
Message-Id: <6lkjq2$7vj$1@client3.news.psi.net>
Bob Roklan (roklan_r@code80.npt.nuwc.navy.mil) wrote on MDCCXLIII
September MCMXCIII in <URL: news:357DA4E9.DA495FD6@code80.npt.nuwc.navy.mil>:
++ I am running Perl 5.003 on Windows 95. I would like to specify a
++ substitution string for multiple files spanning specified directory and
++ its subdiredirectories.
++
++ I know that the following would work for the current directory....
++
++ perl -i.old -p -e "s/foo/bar/g" *.htm
++
++ but how can I tell perl to do the same for a specified directory and
++ down?
$ find . -name '*.htm' | xargs perl -i.old -p -e "s/foo/bar/g"
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
------------------------------
Date: 10 Jun 1998 00:07:02 GMT
From: dalonso@u.washington.edu (Darwin O.V. Alonso)
Subject: efficient comparisons
Message-Id: <6lkin6$1mmc$1@nntp6.u.washington.edu>
Programming Perl (2nd Ed page 540) makes a point that
$foo = $a || $b || $c; is much faster than the "if (){}else{}" construct.
In trying to find both the minimum and maximum values in an array, I
have the following snippet of code:
$min = $max = $ar[0];
for $i ( 1 .. $#ar ) {
( ($ar[$i] < $min ) && ($min = $ar[$i]) ) # min?
||
( ($ar[$i] > $max ) && ($max = $ar[$i]) ); # if not min, maybe max?
}
If it makes any difference, $#ar = 3000.
Does anyone have any suggestions on making that code more efficient?
How about more conceise, and equally efficient?
I tried constructs like "$mini > $t[$i] &&= $t[$i];"
but could not get them to run.
Thanks,
Darwin
------------------------------
Date: Tue, 09 Jun 1998 18:27:58 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: "Darwin O.V. Alonso" <dalonso@u.washington.edu>
Subject: Re: efficient comparisons
Message-Id: <357DE11E.4C671C0E@sirius.com>
Darwin O.V. Alonso wrote:
>
> Programming Perl (2nd Ed page 540) makes a point that
> $foo = $a || $b || $c; is much faster than the "if (){}else{}" construct.
>
> In trying to find both the minimum and maximum values in an array, I
> have the following snippet of code:
>
> $min = $max = $ar[0];
> for $i ( 1 .. $#ar ) {
> ( ($ar[$i] < $min ) && ($min = $ar[$i]) ) # min?
> ||
> ( ($ar[$i] > $max ) && ($max = $ar[$i]) ); # if not min, maybe max?
> }
>
> If it makes any difference, $#ar = 3000.
>
> Does anyone have any suggestions on making that code more efficient?
> How about more conceise, and equally efficient?
> I tried constructs like "$mini > $t[$i] &&= $t[$i];"
> but could not get them to run.
I benchmarked the following and it was about twice as fast as the
orignal loop (on my machine).
foreach (@ar) {
$min = $_ if $_ < $min;
$max = $_ if $_ > $max;
}
HTH -- Jim Bowlin
------------------------------
Date: Wed, 10 Jun 1998 09:50:01 +0800
From: Ong Joo Chin <jcong@ipacs.com>
Subject: Electronic Fax?
Message-Id: <357DE649.EF32EB3D@ipacs.com>
Is it possible to write a PERL script (or any CGI script) that send data
from the internet to a fax machine? If possible, what is the best
language to use (C, PERL, shell script)? Is there any reference or codes
that you can recommend?
------------------------------
Date: Tue, 9 Jun 1998 18:09:34 -0500
From: "Kenner" <kennerDELETE.ME@xnet.com>
Subject: Re: Exercise in Llama Book
Message-Id: <6lkhep$7f1$1@flood.xnet.com>
I am using Win32 Perl at home as well, and I tried what you said and got the
same results. I found that if I tried to print anything directly after the
"@array=<STDIN>;", it wouldn't print. It's like it eats the first line
printed, then prints everything else fine. If I run:
-w;
print "Type some strings, finish with CTRL-Z:\n";
@array=<STDIN>;
print "Hi kids!\nWelcome to the Bozo show!\n";
print @array;
***using as input:***
a
b
c
d
e
f
Ctrl-Z
***my output is:***
Welcome to the Bozo show!
a
b
c
d
e
f
and there are apparently *two* newlines after the output "f", because there
is a full blank line between it and the command prompt.
I also noticed that if you don't hit enter between typing "f" and hitting
Ctrl-Z, you can continue inputting, so the interpreter doesn't seem to
recognize Ctrl-Z until you've put in a newline.
Something funky with the way the Ctrl-Z works with Windows, I think, but I
don't really know.
--
Kenner
# If you want to send me e-mail, please remove the "DELETE.ME" from my
address. #
"I'm glad that I could help out my friend Stephen with his art." - Stuart
Davis
------------------------------
Date: Tue, 09 Jun 1998 18:47:20 -0400
From: jr32@hotmail.com
Subject: How to "protect" cgi-bin scripts from view?
Message-Id: <357DBB78.2C173298@hotmail.com>
Hi...
If I'm in the wrong group for this question, please don't slam me or
anything. But maybe tell me what group I *should* ask...
My company's web host does not allow Telnet access in order to change
chmod permissions on my cgi-bin. Nor is it allowed via FTP, obviously.
In fact, they tell me the only way to protect directories/files *on
their service* is with htaccess. Fine, no problem. I can easily block a
directory via htaccess. That's not hard. But that would keep the world
from running my scripts (wouldn't it?).
So my question is: How can I keep my scripts safe, so people can't pull
up the contents of the cgi-bin in the browser window (eg: Open Location:
http://www.mydomain.com/cgi-bin), look at the scripts and know such
things as the locations of data files, password files and the like?
Right now, my cgi-bin is naked as a jaybird. We aren't the world bank or
anything, and we're not dealing in ultra-secret stuff -- it's all
perfectly mundane. But I still don't like the idea of knowing people
could snoop around so freely... why leave something insecure if you can
secure it?
Is there a way to rig htaccess so site visitors cannot access the
*directory contents* but *can* run the scripts within? I am at a
complete loss. Do I mess with the <LIMIT> settings in the htaccess file?
(I think I've tried that every which way.) Or should I just be clever
about hiding my scripts and filenames somehow?
Thanks for any help/guidance you can offer. I'm still fairly new at
this, obviously (I'm not even finished "Learning Perl" yet :-) ...
hoping you can help! Replies to this NG or e-mail... either would be
great!
Best,
RF
------------------------------
Date: Tue, 09 Jun 1998 16:57:42 -0700
From: josri <josri@postoffice.pacbell.net>
Subject: ip address, windows 95 & perl
Message-Id: <357DCBF6.D947C5C6@postoffice.pacbell.net>
Hi all
I have an isp who assigns me a dynamic ip address. I want to find that
address each time when I logon to internet. Is it possible to do with
perl on windows 95? If so, can anybody show me light on that?
Thanks in advance
Regards
Josri
------------------------------
Date: Tue, 09 Jun 1998 17:36:59 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: josri@pacbell.net
Subject: Re: ip address, windows 95 & perl
Message-Id: <357DD52B.9E11BEFE@sirius.com>
josri wrote:
>
> Hi all
> I have an isp who assigns me a dynamic ip address. I want to find that
> address each time when I logon to internet. Is it possible to do with
> perl on windows 95? If so, can anybody show me light on that?
> Thanks in advance
> Regards
> Josri
The following works on my NT
use Sys::Hostname;
print join '.', unpack 'C4', gethostbyname hostname;
HTH -- Jim Bowlin
------------------------------
Date: Wed, 10 Jun 1998 02:37:47 +0000
From: bryan <nsyte@hotmail.com>
Subject: Re: ip address, windows 95 & perl
Message-Id: <6lkluo$53q$1@gte1.gte.net>
if you execute C:\Windows\winipcfg (usually done by:
Start->run->winipcfg), you will find your IP address. Try calling a system
command through perl to do this.
EX: (in unix it would be)
system "c:\windows\winipcfg"; # directory paths in
Dos/Windows format
josri wrote:
> Hi all
> I have an isp who assigns me a dynamic ip address. I want to find that
> address each time when I logon to internet. Is it possible to do with
> perl on windows 95? If so, can anybody show me light on that?
> Thanks in advance
> Regards
> Josri
------------------------------
Date: 9 Jun 1998 17:17:50 GMT
From: Stefaan.Eeckels@ecc.lu (Stefaan A Eeckels)
Subject: Re: Latest Perl on Slakeware 2.0.33
Message-Id: <6ljqnu$6l1$1@justus.ecc.lu>
In article <357D69B6.9F6BC556@tra.com>,
"Earl E. McCoy" <emccoy@tra.com> writes:
> I am new to this group, so if this has been covered please
> bear with me.
>
> I am having trouble installing Perl 5.004.04 on Slakeware Linux
> 2.0.33. Bombs out on some C code.
>
> Has anyone successfully got this to intall on 2.0.33?
I've had no problem compiling it on an (upgraded) Slackware
system. Please post the errors you're getting (one of the
recent Slackware distributions came with a broken compiler,
so its version number (and not just the kernel's) would be
a help too.
--
Stefaan
--
PGP key available from PGP key servers (http://www.pgp.net/pgpnet/)
___________________________________________________________________
A consultant is a person who borrows your watch, tells you what
time it is, pockets the watch, and sends you a bill for it.
------------------------------
Date: 9 Jun 1998 17:28:05 GMT
From: Stefaan.Eeckels@ecc.lu (Stefaan A Eeckels)
To: tchrist@mox.perl.com (Tom Christiansen)
Subject: Re: McCabe complexity analysis
Message-Id: <6ljrb5$6l1$3@justus.ecc.lu>
[Posted and mailed]
In article <6lh1hn$3t3$2@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> writes:
> Why do people write code that's hard to grok with too many conditionals
> and branches within loops? Is it because they're Prisoners of Pascal?
Here's another rhetorical question:
Why do even respected authors (and many more programming
standards documents) state that you should write (in 'C'):
handle = fopen(file_name, mode);
if (handle == NULL) return -1;
instead of the much more elegant:
if ((handle = fopen(file_name, mode)) == NULL)
return -1;
I guess it's because not everybody has the required
esthetic sense to be programming. It's an art form,
after all.
--
Stefaan
--
PGP key available from PGP key servers (http://www.pgp.net/pgpnet/)
___________________________________________________________________
A consultant is a person who borrows your watch, tells you what
time it is, pockets the watch, and sends you a bill for it.
------------------------------
Date: 9 Jun 1998 22:58:50 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: McCabe complexity analysis
Message-Id: <6lkena$qbl$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Stefaan.Eeckels@ecc.lu (Stefaan A Eeckels) writes:
:Why do even respected authors (and many more programming
:standards documents) state that you should write (in 'C'):
:
: handle = fopen(file_name, mode);
: if (handle == NULL) return -1;
:
:instead of the much more elegant:
:
: if ((handle = fopen(file_name, mode)) == NULL)
: return -1;
I wonder why these allegedly respected authors seem
to thing there's some different between
if (p)
and
if (p == NULL)
When of course, there isn't.
--tom
--
"... an initial underscore already conveys strong feelings of
magicalness to a C programmer."
--Larry Wall in <1992Nov9.195250.23584@netlabs.com>
------------------------------
Date: Tue, 9 Jun 1998 20:44:17 -0400
From: "mahddh" <mahddh@gate.net>
Subject: Need a HP ov Orphan Process Killer
Message-Id: <6lkl1q$l1c$1@news.gate.net>
We are running HP Open Views and users access the system through an
Exceed session on NT workstations . Sometimes they exit Exceed
without properly logging out of the applications they are running.
This leaves orphan processes that, for some reason, run away and
eventually start hogging all the CPU time.
I'd like to write a script that I could kick off as a crontab about a
1/2 hour after each shift change that will find and kill any ov
provesses that are not attached to a currently logged in user. Rather
than reinvent the wheel, is there something already written that will
do this or something similar to it?
Thank you.
mahddh@gate.net
------------------------------
Date: Wed, 10 Jun 1998 01:16:47 +0000
From: bryan <nsyte@hotmail.com>
Subject: Re: NEED HELP: stty and the perl compiler
Message-Id: <6lkh6q$med$1@gte1.gte.net>
--------------C5C4B9D0D5991F46DA7B0DB0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
You could make the screen black instead of turning terminal echo
off...but that will only work if the terminal screen is already black
(not blue).
James W. Thornton wrote:
> I have setup the perl compiler and successfully compiled several
> programs. However, the following bit of code doesn't execute correctly
> when translated to C and then compiled.
>
>
> #system "clear";
>
> print "login: ";
> $un = <STDIN>;
> chop ($un);
>
> system "stty -echo";
> print "Password: ";
> chop($pw = <STDIN>);
> print "\n";
> system "stty echo";
>
>
> When I run the compiled executable, I get the login prompt...but after
> I enter the username and hit enter, the program quits w/o prompting me
> for the password.
>
> If I recode the password section to be:
>
>
> print "Password: ";
> system "stty -echo";
> chop($pw = <STDIN>);
> print "\n";
> system "stty echo";
>
> ...then I get the Password prompt, but after I enter the password and
> hit enter, the program quits prematurely.
>
> Both of the previous segments of code work correctly as an uncompiled
> perl program.
>
> Any ideas on why this is not working when translated to C and
> compiled?
>
> My system info:
>
>
> OS: Red Hat Linux 5.x
> Perl Version: 5.00401
>
>
> Thanks,
>
> --James
--------------C5C4B9D0D5991F46DA7B0DB0
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
You could make the screen black instead of turning terminal echo off...but
that will only work if the terminal screen is already black (not blue).
<BR>
<P>James W. Thornton wrote:
<BLOCKQUOTE TYPE=CITE> <TT>I have setup the perl compiler and successfully
compiled several programs. However, the following bit of code doesn't execute
correctly when translated to C and then compiled.</TT>
<BR>
<BLOCKQUOTE><TT>#system "clear";</TT></BLOCKQUOTE>
<BLOCKQUOTE><TT>print "login: ";</TT>
<BR><TT>$un = <STDIN>;</TT>
<BR><TT>chop ($un);</TT>
<P><TT>system "stty -echo";</TT>
<BR><TT>print "Password: ";</TT>
<BR><TT>chop($pw = <STDIN>);</TT>
<BR><TT>print "\n";</TT>
<BR><TT>system "stty echo";</TT>
<BR> </BLOCKQUOTE>
<TT>When I run the compiled executable, I get the login prompt...but after
I enter the username and hit enter, the program quits w/o prompting me
for the password.</TT>
<P><TT>If I recode the password section to be:</TT>
<BR>
<BLOCKQUOTE><TT>print "Password: ";</TT>
<BR><TT>system "stty -echo";</TT>
<BR><TT>chop($pw = <STDIN>);</TT>
<BR><TT>print "\n";</TT>
<BR><TT>system "stty echo";</TT></BLOCKQUOTE>
<TT>...then I get the Password prompt, but after I enter the password and
hit enter, the program quits prematurely.</TT>
<P><TT>Both of the previous segments of code work correctly as an uncompiled
perl program.</TT>
<P><TT>Any ideas on why this is not working when translated to C and compiled?</TT>
<P><TT>My system info:</TT>
<BR>
<BLOCKQUOTE><TT>OS: Red Hat Linux 5.x</TT>
<BR><TT>Perl Version: 5.00401</TT>
<BR> </BLOCKQUOTE>
<TT>Thanks,</TT>
<P><TT>--James</TT></BLOCKQUOTE>
</HTML>
--------------C5C4B9D0D5991F46DA7B0DB0--
------------------------------
Date: 10 Jun 1998 01:25:15 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: New module/pragma "enum.pm" (was "fields.pm")
Message-Id: <897442406.802645@thrush.omix.com>
[posted & mailed]
I've reworked my enum.pm (was first "fields.pm") module to act as much like
C enum types as it probably can. Basic use allows for things like:
use enum qw(One Two Three Four);
use enum qw(Forty => 40, 'FortyOne', 'FortyFive', Six => 6, 'Seven'); # etc
use enum qw(Sun Mon Tue Wed Thu Fri Sat);
Like in C, the index can be changed at any time in the list with later tags
being incremented from that point on unless another tag changes the index.
Thoughts? Is this something I should submit to CPAN, or should I shy away
from taking a pragma name that might get better used for something else in
the core (can't think of what, but maybe something)?
Current version available at:
ftp://thrush.omix.com/pub/perl/modules/enum-1.005.tar.gz
--
-Zenin
zenin@archive.rhps.org
------------------------------
Date: 9 Jun 1998 22:45:45 GMT
From: tph@longhorn.uucp (Tom Harrington)
Subject: Re: newbie: trying to remove unwanted data from an array....
Message-Id: <6lkdup$jhh1@eccws1.dearborn.ford.com>
Steve Neuharth (steven@mail.dhc.com) wrote:
: O.k. I KNOW there's an easy answer to this.... I can't seem to find it
: anywhere....
: I've got an array (@rawoutput). I only need the lines that contain
: "SUB-TOTAL:".... I'm trying some thing like this.....
: $x=0;
: for ($y=0;$y <= @rawoutput; $y++){
: if (@rawoutput[$y] =~ /SUB-TOTAL:/) {
: @output[$x] = @rawoutput[$y];
: $x++;
: }
: }
: @output never seems to populate with data (not sure why).
When you want to refer to an individual array element, use "$"
rather than "@", i.e. if($rawoutput[$y]... and NOT if(@rawoutput[$y]...
: I was thinking there should be a way to do it something like this (?).......
: @output = (@rawoutput =~ /SUB-TOTAL:/);
Read up on the "grep" function, it'll do what you want.
--
Tom Harrington --------- tph@rmii.com -------- http://rainbow.rmii.com/~tph
"Oh, write of me not 'Died in bitter pains,' But 'Emigrated to
another star!'" -Helen Hunt Jackson
Cookie's Revenge: ftp://ftp.rmi.net/pub2/tph/cookie/cookies-revenge.sit.hqx
------------------------------
Date: Tue, 09 Jun 1998 18:19:38 -0600
From: Ken Quinn <kquinn@sk.sympatico.ca>
Subject: open pipe?
Message-Id: <357DD11A.7D4D839@sk.sympatico.ca>
I'm trying to open a pipe to a program in /usr/local/bin. The perl
script takes a username as <STDIN> checks a dbfile to see if the
username is in the file and then prints the $line from the dbfile to the
program in /usr/local/bin/program.pl. I am getting "no such directory"
error . I have tried various paths to the file but nothing seems to
work. I have set the file permission to x. Any help would be
appreciated.
Thanks,
Ken
#! /usr/local/bin/perl -w
$user = <STDIN> ;
open(DATA, '</root/dbfile') ;
my @subs = <DATA> ;
foreach my $line (@subs)
{
if($line =~/^$user\s/) {
open(FILE, "|/home/$user/usr/local/bin/program.pl") ;
print FILE "$line \n" ;
close FILE ;
}
}
------------------------------
Date: Wed, 10 Jun 1998 01:07:27 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: open pipe?
Message-Id: <EuB9sF.67F@news.boeing.com>
In article <357DD11A.7D4D839@sk.sympatico.ca>,
Ken Quinn <kquinn@sk.sympatico.ca> wrote:
> I'm trying to open a pipe to a program in /usr/local/bin. The perl
> script takes a username as <STDIN> checks a dbfile to see if the
> username is in the file and then prints the $line from the dbfile to the
> program in /usr/local/bin/program.pl. I am getting "no such directory"
> error . I have tried various paths to the file but nothing seems to
> work. I have set the file permission to x. Any help would be
> appreciated.
> Thanks,
> Ken
>
> #! /usr/local/bin/perl -w
> $user = <STDIN> ;
> open(DATA, '</root/dbfile') ;
> my @subs = <DATA> ;
> foreach my $line (@subs)
> {
> if($line =~/^$user\s/) {
> open(FILE, "|/home/$user/usr/local/bin/program.pl") ;
> print FILE "$line \n" ;
> close FILE ;
> }
> }
>
I'd recommend this:
chomp($user = <STDIN>);
rather than trying to finesse around the newline.
HTH,
--
Charles DeRykus
------------------------------
Date: Wed, 10 Jun 1998 19:58:59 -0400
From: Ruben I Safir <rs83@is7.nyu.edu>
Subject: pack/unpack seps
Message-Id: <357F1DC3.5F16FE7C@is7.nyu.edu>
Does anyone know what the difference between
the a1 and c is in unpack?
Ruben
------------------------------
Date: Tue, 09 Jun 1998 20:20:09 -0400
From: Chris Winters <cwinters@intes.net>
Subject: Re: pass the gravy and the hashref, please -- solved
Message-Id: <357DD139.F4835606@intes.net>
Okay, I figured this out. I'm breaking the original reference in the
parent by doing a straight assignment:
$self->{values} = $href;
rather than (inefficiently) stepping through the hash and doing the
assignment
while ( my ($key, $val) = each %$href ) {
$self->{values}->{$key} = $val;
}
which keeps the reference, to which all the children are referring,
intact.
Apologies for a big duh on my part
Chris
Chris Winters wrote:
>
> Hello,
>
> A problem that's puzzling me. I will try to explain it as clearly as I
> can.
>
> 1) The parent object contains an arrayref of zero or more child
> objects
>
> 2) The parent object contains a hashref of values, with keys as
> fieldnames from the child objects
...
------------------------------
Date: 10 Jun 1998 01:25:53 GMT
From: arch@abts.net (Shaun Sides)
Subject: Re: Reading Directories
Message-Id: <slrn6nr5pt.26c.arch@abts.net>
Original message by: dukeboy77@my-dejanews.com <dukeboy77@my-dejanews.com>
Date: Tue, 09 Jun 1998 14:49:04 GMT
Subject: Reading Directories
> I need a script that will search a directory read the name of every file
> and put it into an array called @files. I've tried and tried with no success
> and had no idea where else to turn. If someone could help me I would be very
> greatful. Thank you.
#!/usr/bin/perl -w
# usage: filenames.pl *
foreach (@ARGV) {
push(@files,$_);
}
print "@files";
That'll do what you want, though that's all it does. Don't really have
an idea what else you're after.
--
==============================================================================
Shaun L. Sides | Hey! CyberGold | arch@abts.net
Free Randal Schwartz and Ric Flair! | wastes yer time | arch@sara.mmlc.nwu.edu
==============================================================================
The time for desperation is upon us. Let's play.
First Wizard Zeddicus Zu'l Zorander
==============================================================================
------------------------------
Date: 9 Jun 1998 17:20:39 GMT
From: Stefaan.Eeckels@ecc.lu (Stefaan A Eeckels)
To: "gip" <gibsonc@aztec.asu.edu>
Subject: Re: Stopping Perl from interpreting fprintf's in a C file
Message-Id: <6ljqt7$6l1$2@justus.ecc.lu>
[Posted and mailed]
In article <6ljksj$1o7@bmw.hwcae.az.honeywell.com>,
"gip" <gibsonc@aztec.asu.edu> writes:
>
> But after a "printf( OUTFILE, $line );", it becomes this:
If you positively *have* to use printf, try
printf(OUTFILE, "%s", $line);
That'll stop your output string from being interpreted as
the format string.
HTH
--
Stefaan
--
PGP key available from PGP key servers (http://www.pgp.net/pgpnet/)
___________________________________________________________________
A consultant is a person who borrows your watch, tells you what
time it is, pockets the watch, and sends you a bill for it.
------------------------------
Date: Tue, 9 Jun 1998 20:27:22 -0500
From: "Jonathan A. Laub" <lakesoft@skypoint.com>
Subject: Stripping HTML coding from CGI data for Perl
Message-Id: <6lknob$i1f$1@shadow.skypoint.net>
I have a simple form that I is (would) be working with a small executable
just fine if I could simply strip off the HTML codes that are passed with
the variables.
All I want to do is take the field data from my form w/o the </> stuff.
Thanks
Jon
------------------------------
Date: Tue, 09 Jun 1998 22:33:41 GMT
From: freew3@my-dejanews.com
Subject: Re: Web Hosting with CGI
Message-Id: <6lkd86$uob$1@nnrp1.dejanews.com>
SEE http://www.pseudoweb.com
For a 40% discount say "Che sent me, SHOW ME THE WEB SPACE!!!"
prices start at $24.95/mo
+ free web space for non-profits
MAKE MONEY REFERING CUSTOMERS ..just ask about our referal program.
In article <6li5b8$10i2$1@news.gate.net>,
"John Jeevers" <jj239733@aol.com> wrote:
>
> Has anyone heard of the the following 2 Web Hosting providers. Can anyone
> tell me anything about them.
>
> PremierSite http://www.premiersite.com
> Cybergate http://www.gate.net
>
> Any information would be greatly appreciated. Specially if they can run cgi
> scripts.
>
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Tue, 09 Jun 1998 22:57:13 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Web Hosting with CGI
Message-Id: <6lkenb$hnk$4@ligarius.ultra.net>
[ posted and mailed ]
freew3@my-dejanews.com wrote:
-> SEE http://www.pseudoweb.com
-> For a 40% discount say "Che sent me, SHOW ME THE WEB SPACE!!!"
-> prices start at $24.95/mo
-> + free web space for non-profits
-> MAKE MONEY REFERING CUSTOMERS ..just ask about our referal program.
and web66.com is $10 a month. Now stop your advertisingin c.l.p.m please.
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-239-0341
and hang up when the recording starts. "
------------------------------
Date: Tue, 9 Jun 1998 17:32:11 -0700
From: "Bryan Burlingame" <bburlingnews@iname.com>
Subject: Re: Win95 problems for Perl? Need assistance here!
Message-Id: <6lkk79$r69$1@news.artemis.com>
>From the command line try:
perl -w $filename
This will allow you to read any diagnostics messages from perl.
(the -w will also print the warnings)
--Bryan Burlingame, WebTV
Joshua McAdams wrote in message <35796761.3293486@news.earthlink.net>...
>Hi there folks,
>
>Got a couple of basic questions regarding running WinPerl. I have a
>win95 laptop bought this book "Teach Yourself Perl in 21 Days" and
>installed perl5 from the cd out of the back. Now when I'm writing
>perl scripts in notepad, what do I save my files as? I tried .pl and
>then associated them w/ the perl.exe file. When I double click on them
>(the .pl files) the perl window pops up for a second, reads an error
>message and then shuts down (too quicky to read the message). I left
>out the path of the perl.exe file from the .pl file I wrote in notepad
>because I saved it in the same directory as the perl.exe file. Should
>I leave the path in? Can I make the path absolute or relative?
>Do I need to use different syntax for a windows system?
>Should I stick to HTML?
>
>Thanks for all your help in advance and if anyone needs any backend
>work don't hesitate to e-mail me.
>
>Joshua McAdams
>
>josh@syndicate-interactive.com
>
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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". 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 2825
**************************************