[11833] in Perl-Users-Digest
Perl-Users Digest, Issue: 5433 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 20 19:07:21 1999
Date: Tue, 20 Apr 99 16:00:23 -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, 20 Apr 1999 Volume: 8 Number: 5433
Today's topics:
Re: Can Perl implement a state machine? <joeprogrammer@aa.net>
Can't Use Win32::ODBC to Connect to MS SQL eweiss@winchendon.com
Re: CGI/Telnet?? (Z Trex)
Re: Checksums from hell (Mike Wescott)
Err Building PERL5 on BSDI 3.1 kamez@my-dejanews.com
Re: FAQ 3.22: How can I compile my Perl program into by <droby@copyright.com>
Re: FAQ 3.22: How can I compile my Perl program into by (Larry Rosler)
Re: FAQ 3.22: How can I compile my Perl program into by <tchrist@mox.perl.com>
Re: FAQ 3.9: Is there an IDE or Windows Perl Editor? <gellyfish@gellyfish.com>
Re: FAQ 8.12: How do I start a process in the backgroun <cassell@mail.cor.epa.gov>
Re: for (my $i;;) doesn't work like I think it should (Bart Lateur)
How do I SPAWN a child process? (fire and forget) jrmorrill@yahoo.com
Re: How do I SPAWN a child process? (fire and forget) scraig@my-dejanews.com
Re: HTTP_REFERRER <gellyfish@gellyfish.com>
Re: Is it REALLY impossible to install Perl on Windoze? <Allan@due.net>
Re: Is it REALLY impossible to install Perl on Windoze? <gellyfish@gellyfish.com>
Re: Need example <gellyfish@gellyfish.com>
Re: Perl 'split' function in C?? kn-brush@uchicago.edu
Re: Perl 'split' function in C?? <tchrist@mox.perl.com>
Re: Perl vs. OTHER scripting languages ? When/Why to us (Joe Smith)
Re: Please Help !!!!! (Tim Herzog)
Re: Please Help !!!!! (Bob Trieger)
Re: Please Help !!!!! <gellyfish@gellyfish.com>
Re: posting from perl to cgi <gellyfish@gellyfish.com>
Re: Problem with writing to file. (Bob Trieger)
Re: Problems installing module MIME-Base64-2.11 <gellyfish@gellyfish.com>
Re: purging old mail <gellyfish@gellyfish.com>
Re: Reading .ini files from Perl <ebohlman@netcom.com>
Re: Reading .ini files from Perl <gellyfish@gellyfish.com>
Re: Reading .ini files from Perl <cassell@mail.cor.epa.gov>
Re: Reading File to a Scalar? <rcroote@corp.atl.com>
Re: SNMP <gellyfish@gellyfish.com>
Re: Unix files in MacPerl (Dan Wilga)
Re: Unix files in MacPerl (Dan Wilga)
Re: Unix files in MacPerl (Bart Lateur)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 20 Apr 1999 13:13:23 -0700
From: "joeprogrammer" <joeprogrammer@aa.net>
Subject: Re: Can Perl implement a state machine?
Message-Id: <371cdf75@news.weyer.com>
Here's something I wrote for a Perl presentation. I found lots of
hints but no full examples (which I like to learn from). So, if you
have read all of the perldocs and really did not feel like taking 'a
net beating' and still don't quit understand maybe this will help.
Use as it as you wish.
A long time ago I was having difficulty passing around a hash of
hash of arrays pointing to hashes between subroutines. I read all of
the docs but still did not get it. I posted and got the regular 'didn't you
read the #$%@! docs and an email of an example. The example was just
the ticket.
Enjoy!
------------------------------------------------------------------
John Syre
C/C++, Perl, DBA consultant
no_cruise_spam@aa.net #remove the no_,_spam to reply
------here's the code-------
# File: statemachine.pl
#
# Description:
# Implements a state machine in perl
#
# History: 04/15/1999 Created by John Syre
# Note:
# Here's a fully working example inspired by a snippet posted
# by Mark-Jason Dominus. My version checks for invalid states.
#
#
#@end
#!/usr/bin/perl
use strict;
my %eventDesc = (
'a' => "Invokes actions for event 'a'" ,
'b' => "Invokes actions for event 'b'" ,
'x' => "Invokes actions for event 'x'" ,
'y' => "Invokes actions for event 'y'" ,
'r' => "Go back to the state = 'start'" ,
'q' => "Quit"
) ;
my %stateTable = (
# CurState, Event, NextState, Action
'e_start' => {
'a' => [ 'e_a', \&action_for_a ],
'b' => [ 'e_b', \&action_for_b ],
'r' => [ 'e_start', \&restart ],
'q' => [ 'e_stop' , \&quit ]
} ,
'e_a' => {
'x' => [ 'e_x', \&action_for_x ],
'r' => [ 'e_start' , \&restart ],
'q' => [ 'e_stop' , \&quit ]
},
'e_b' => {
'y' => [ 'e_y', \&action_for_y ],
'r' => [ 'e_start' , \&restart ],
'q' => [ 'e_stop' , \&quit ]
},
'e_x' => {
'r' => [ 'e_start', \&restart ],
'q' => [ 'e_stop' , \&quit ]
} ,
'e_y' => {
'r' => [ 'e_start' , \&restart ],
'q' => [ 'e_stop' , \&quit ]
},
'e_r' => {
'x' => [ 'e_x', \&do_action_for_x ],
'r' => [ 'e_start' , \&restart ],
'q' => [ 'e_stop' , \&quit ]
},
'e_stop' => {
'q' => [ 'e_none' , \&quit ]
}
);
my $event;
my $action;
my $nextState;
my $STOP = 'false' ;
# establish the beginning state
my $state = 'e_start' ;
# but you can really start it anywhere as below
#my $state = 'e_x' ;
while ( $STOP eq 'false' )
{
print "\nCURRENT STATE: '$state' EVENT: '$event' \n" ;
# print out a valid list for all of the events for the current state
print "VALID EVENTS:\n\t",
join( "\n\t" , map { $_ . " - " . $eventDesc{$_} } sort keys
%{$stateTable{$state}} ) , "\n" ;
# get a character reprenting an event and remove the newline from the
input
print "Enter letter representing event: " ;
chomp($event = <STDIN>);
# convert to lower case
$event = lc($event) ;
# check to make sure the event is in the state table
if ( defined( $stateTable{$state}{$event}) )
{
# read entry from the state state
($nextState, $action) = @{ $stateTable{$state}{$event} };
print "\nMoving to NEXT STATE - $nextState \n" ;
print "==>Execute action for EVENT: '$event'\n" ;
print "-" x 60 , "\n" ;
# execute the action attached to this event
&$action();
print "-" x 60 , "\n" ;
print "==>Done\n" ;
# go to next state
$state = $nextState;
}
else
{
# event was not in the state table
PrintError( "*** ERROR - Invalid event: $event ***" );
$event = "";
}
}
exit;
sub quit()
{
print "Quiting \n" ;
$STOP = 'true' ;
}
sub restart()
{
print "Back at state = 'e_start' \n" ;
}
sub action_for_a()
{
print "In subroutine to implement actions for EVENT 'a'\n" ;
}
sub action_for_b()
{
print "In subroutine to implement actions for EVENT 'b'\n" ;
}
sub action_for_x()
{
print "In subroutine to implement actions for EVENT 'x'\n" ;
}
sub action_for_y()
{
print "In subroutine to implement actions for EVENT 'y'\n" ;
}
sub PrintError()
{
my $msg = shift ;
my $len = length($msg) ;
print "\n", "*" x $len, "\n" ;
print "$msg\n" ;
print "*" x $len, "\n" ;
}
Ronald J Kimball wrote in message
<1dq64su.1ggb9dwi56524N@p116.tc2.state.ma.tiac.com>...
>Jeffrey Davey <Jeffrey_Davey-P93404@email.mot.com> wrote:
>
>> I was wondering if anyone knows how adept Perl is at implementing a
>> state machine. The type we'd like to use is one that is table-driven,
>> in that functions called within a state are referenced from within an
>> array. Haven't seen yet that Perl can do this.
>
>i.e. an array of references to subroutines? Sure, Perl can do that.
>
>> Pointers to relevant information would be welcome.
>
>Check out the perlreftut and perlref documentation.
>
>--
> _ / ' _ / - aka -
>( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
> / http://www.tiac.net/users/chipmunk/
> "It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Tue, 20 Apr 1999 21:02:36 GMT
From: eweiss@winchendon.com
Subject: Can't Use Win32::ODBC to Connect to MS SQL
Message-Id: <7fiq1a$eno$1@nnrp1.dejanews.com>
Argh! I'm trying to connect to MS SQL Server 6.5 using Win32::ODBC, but I
can't get connected. My script is:
use Win32::ODBC;
$db = new Win32::ODBC("UID=name;PWD=password;DSN=database");
if (! $db) {
print "Error: " . Win32::ODBC::Error() . "\n";
die "Could not open ODBC";
}
The error message is:
Error: [126] [] "[Microsoft][ODBC SQL Server Driver]Unable to load
communication module. Driver has not been correctly installed." Could not
open ODBC at odbc.pl line 7.
When I try odbcping with these same parameters, it connects fine.
What am I missing?
Eric
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 20 Apr 1999 16:40:48 -0500 (CDT)
From: ZTrex@webtv.net (Z Trex)
Subject: Re: CGI/Telnet??
Message-Id: <17877-371CF460-62@newsd-101.iap.bryant.webtv.net>
Here's the script for it:
http://www.angelfire.com/ny/demo69/UnixTelnet.html
Again, I will not be posting here again. Thanks for your time, and I'll
leave you be.
------------------------------
Date: 20 Apr 1999 17:43:44 -0400
From: wescott@cygnus.ColumbiaSC.NCR.COM (Mike Wescott)
Subject: Re: Checksums from hell
Message-Id: <x4pv4z6k8f.fsf@cygnus.ColumbiaSC.NCR.COM>
In article <7fh9gq$vj5$1@nnrp1.dejanews.com> aaronsca@hotmail.com writes:
> So it's like this: I want to be able to generate checksums just like the BSD
> "sum" program. I tried the unpack("%32C*", <>) way just like in the camel
> book. This works fine until you try to checksum hundreds of files that are
> hundreds of megs. It takes forever. So, I tried going the sysread method,
> but for some reason I just can't get it right. Some of the checksums are ok,
> but others are wrong, and it is really frustrating. Snippet of code:
See the implementation of sum by Theo Van Dinter in the Perl Power Tools
collection:
http://language.perl.com/ppt/src/sum/index.html
BTW, the camel has it wrong ... p 237 should say
undef $/;
$checksum = unpack("%32C*",<>) % 65535;
It also turns out that the PPT version is very slow for the SysV algorithm.
The speed, however can be improved about 100x by a small change to the
sum2 sub:
sub sum2 {
my($fh) = shift;
my($crc) = my($len) = 0;
my($buf,$num,$i);
my($buflen) = 4096; # buffer is "4k", you can up it if you want...
while($num = sysread $fh, $buf, $buflen) {
$len += $num;
$crc += unpack("%32C*", $buf); # faster than an explicit loop
}
# crc = s (total of bytes)
$crc %= 65535;
return $num,$crc,($len+511)/512; # round # of blocks up ...
}
--
-Mike Wescott
mike.wescott@ColumbiaSC.NCR.COM
------------------------------
Date: Tue, 20 Apr 1999 20:33:16 GMT
From: kamez@my-dejanews.com
Subject: Err Building PERL5 on BSDI 3.1
Message-Id: <7fioac$d35$1@nnrp1.dejanews.com>
i got problems , compiling PERL5 on a BSDI machine , here's the following
error messages i got :
-------------------------------------------------------------------
`sh cflags libperl.so doio.o` doio.c
CCCMD = cc -DPERL_CORE -c -fpcc-struct-return -O2
doio.c: In function Perl_do_ipcctl:
doio.c:1381: argument #4: incompatible types in argument passing
doio.c:1432: argument #4: incompatible types in argument passing
-------------------------------------------------------------------
Could you, email me, in detail what i'd need to do, to solve that problem ?
Thnak you veru much in advance for your Help.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 20 Apr 1999 20:12:18 GMT
From: Don Roby <droby@copyright.com>
Subject: Re: FAQ 3.22: How can I compile my Perl program into byte code or C?
Message-Id: <7fin2v$bup$1@nnrp1.dejanews.com>
In article <371C60B7.1A4D6E6E@datenrevision.de>,
Philip Newton <Philip.Newton@datenrevision.de> wrote:
> Tom Christiansen wrote:
> >
> > (This excerpt from perlfaq3 - Programming Tools
> > ($Revision: 1.35 $, $Date: 1999/04/16 01:38:05 $)
>
> > this, it will make it miniscule. For example, on one author's
>
> s/miniscule/minuscule/
>
s/min[i|u]scule/tiny/
Both spellings are in some dictionary, but who needs this word anyway?
--
Don Roby
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 20 Apr 1999 15:38:18 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: FAQ 3.22: How can I compile my Perl program into byte code or C?
Message-Id: <MPG.1186a1b25e00fa459898f2@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7fin2v$bup$1@nnrp1.dejanews.com> on Tue, 20 Apr 1999
20:12:18 GMT, Don Roby <droby@copyright.com> says...
...
> s/min[i|u]scule/tiny/
>
> Both spellings are in some dictionary, but who needs this word anyway?
There's a third match on that, which my dictionary doesn't have:
min|scule
Hmmm...
:-)
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 20 Apr 1999 16:58:23 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: FAQ 3.22: How can I compile my Perl program into byte code or C?
Message-Id: <371d068f@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Philip Newton <Philip.Newton@datenrevision.de> writes:
:s/miniscule/minuscule/
The OED lists "miniscule" as an erroneous variation of minuscule, but
goes on to offer cites dating back over a century, including reputable
publications from both sides of the Atlantic:
1898 J. Southward Mod. Printing I. xxii. 139 - Each of the text
letters already named has its own lower case or `miniscule' letters.
1948 N.Y. Times 12 Dec. vii. 5 - Now once again these miniscule
land areas have faded from our interests.
1955 N.Y. Times 10 Apr. x. 27 - Upland meadows are carpeted with
miniscule wild flowers.
1961 Economist 16 Dec. 1118/1 - Many `gardens' would be miniscule
affairs.
1967 [see integrated ppl. a. b].
1970 Daily Tel. 24 Apr. 1/3 - If these conditions were fulfilled
the risk from the pill was `miniscule'.
1973 Orcadian 2 Aug. 4/4 - The most interesting feature of this
miniscule nation..is the strength of its national culture.
Minuscule is listed as deriving from Fr. "minuscule", ad. L. "minuscula"
(sc. "littera"), fem. of "minusculus" rather less, dim. of "minor" (neut.
"minus"). It is the antecedent of of "majuscule" (upper-case). My guess
is that there's a bit of confusion between "MINImal" and "minUS" going on.
--tom
--
Sorry. My testing organization is either too small, or too large, depending
on how you look at it. :-)
--Larry Wall in <1991Apr22.175438.8564@jpl-devvax.jpl.nasa.gov>
------------------------------
Date: 20 Apr 1999 21:14:18 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: FAQ 3.9: Is there an IDE or Windows Perl Editor?
Message-Id: <7fiqna$9rk$1@gellyfish.btinternet.com>
On Tue, 20 Apr 1999 14:46:47 -0500 Daniel Beckham wrote:
>
> www.textpad.com
>
> In article <7fdafg$2qf$1@starburst.uk.insnet.net>, gs_london@yahoo.com
> says...
>>
>> Programmer's File Editor
>>
>> Andrew Perrin wrote in message
>> <371A0A72.2816420C@mcmahon.qal.berkeley.edu>...
>> >Just FYI, emacs for Windows can be found at
>>
OK OK guys - shall we just leave it at:
<http://reference.perl.com/query.cgi?editors>
for all the usual reasons.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Tue, 20 Apr 1999 15:50:44 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: FAQ 8.12: How do I start a process in the background?
Message-Id: <371D04C4.90BE363F@mail.cor.epa.gov>
Tom Christiansen wrote:
>
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc,
> David Cassell <cassell@mail.cor.epa.gov> writes:
> :Tom, do you think a paragraph or two on doing this in win32 would be
> :helpful?
>
> cat >> faq8.12
>
> Victims of brain-damaged, closed, proprietary, non-standard excuses
> for program loaders probably aren't allowed to run processes this way.
> Please contact your vendor for a patch that will make fork() work
> correctly.
heh. [yes, I have been reading too many of Randal's messages]
David
--
David Cassell, OAO
cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541)
754-4468
mathematical statistician fax: (541)
754-4716
------------------------------
Date: Tue, 20 Apr 1999 21:06:09 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: for (my $i;;) doesn't work like I think it should
Message-Id: <371deab3.1054120@news.skynet.be>
Ala Qumsieh wrote:
>Methinks you are using an old version of Perl that might not be
>supporting the my() keyword.
Close, but no cigar.
The syntax
for(my $i; ...; ...) { .... }
did NOT come with the first version of Perl 5. I'm not sure exactly when
it was introduced, but my guess it must have been around 5.004.
NAME
perldelta - what's new for perl5.004
my() in Control Structures
You can now use my() (with or without the parentheses) in
the control expressions of control structures such as:
while (defined(my $line = <>)) {
$line = lc $line;
} continue {
print $line;
}
Also, you can declare a foreach loop control variable as
lexical by preceding it with the word "my". For example, in:
foreach my $i (1, 2, 3) {
some_function();
}
Bart.
------------------------------
Date: Tue, 20 Apr 1999 20:21:35 GMT
From: jrmorrill@yahoo.com
Subject: How do I SPAWN a child process? (fire and forget)
Message-Id: <7finkb$cff$1@nnrp1.dejanews.com>
I have a long lived Perl process. It serves out web pages. It goes up and stay
running indefinately. However whenever a user connects to it a new instance is
spawned, sends the output, then dies.
This is working great!
Now I have a new challenge.
This long lived process needs to call a child process. The instance which
calls this child process lives long enough to serve out a web page. But this
child can take over an hour to return! Clearly it's not acceptable for
Netscape to sit there spinning for an hour. SO I want to set up this child
process and let it do whatever it needs for however long it needs and never
return to the parent.
I've tried exec and system ('myprog &') but both of them hang the long lived
process.
I guess I want to spawn a new parent process, not a child process. Any ideas?
Thanks,
Jason
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 20 Apr 1999 22:37:29 GMT
From: scraig@my-dejanews.com
Subject: Re: How do I SPAWN a child process? (fire and forget)
Message-Id: <7fivj9$jrh$1@nnrp1.dejanews.com>
In article <7finkb$cff$1@nnrp1.dejanews.com>,
jrmorrill@yahoo.com wrote:
> I want to set up this child
> process and let it do whatever it needs for however long it needs and never
> return to the parent.
>
I'm not an expert, but you can try this:
FORK:{
my $pid = fork;
if( defined $pid ){
if( $pid == 0 ){ #child
exec 'myprog';
exit; # not necessary with exec, but can't hurt
}
# else parent
}
elsif( $! =~ m/No more process/ ){
sleep 5;
redo FORK;
}
else{
#weird fork error, die?
}
}
This example was basically lifted from Programming Perl.
HTH
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 20 Apr 1999 21:22:22 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: HTTP_REFERRER
Message-Id: <7fir6e$9rn$1@gellyfish.btinternet.com>
On Sun, 18 Apr 1999 19:39:26 +0300 Juho Cederstrom wrote:
>
> Well, you could use $ref in the if line too, but I can't
> get tilde out of my keyboard so I can't show how :(
>
What ? I havent the faintest idea what a keyboard in your neck of the woods
looks like but how can do Perl, Unix Shell, vi, Spanish without one ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Tue, 20 Apr 1999 16:10:18 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Is it REALLY impossible to install Perl on Windoze???
Message-Id: <7fimhi$psc$1@camel0.mindspring.com>
mjw@bahnhof.se wrote in message ...
:I am getting really mad.
:
:More times than I want to remember I tried to install Perl
:under Win95, on three different machines:
:1. My humble, hopelessly obsolete Pentium 133 MHz
:2. Compaq Armada 233 MHz notebook in my office
:3. A Dell desktop PC in my office.
:
:I used various builds of Perl. I tried many times to
:carry out every installation. I tried every conceivable
:measures, deactivated antivirus programs (WHY, ON EARTH,
:IS IT NECESSARY???), switched off the lights in my room,
:prayed to God and so on.
:
:NOTHING. NULL. ZERO SUCCESS.
:
:The ActiveState installation program freezes always
:when "preparing HTML documentation", at 95%, leaving
:the installation unfinished (I believe that 60 min
:waiting for the program to continue - was enough...).
:
:Ok. I bought a book "Perl 5 Complete" from Mc Graw-Hill,
:a respectable publishing house. I inserted the attached
:CD-ROM into my computer and started installation -
:perhaps not the latest build, but presumably "stable".
:
:The installation program showed to be a worthless piece
:of crap, completely broken, unusable. Probably nobody
:ever tested it.
:
:Is there anything I can do before I start hating Perl
:and send millions of anti-Perl spam messages on the whole
:net?
:
:What the hell can go wrong in an installation program
:that does little more than copying files and writing
:some info in the registry?
:
:Is it really impossible for the Perl community to prepare
:a package for MANUAL installation, with all files neatly
:packed, together with the directory tree, in a ZIP archive
:or similar, ready to copy "as is"?
I know this is of little help but just for the record, I have installed
binary versions (standard and activestate) of perl on a large number of
different W95 and W98 machines including a 486 laptop and I have never had a
problem. If your activestate installation hung I would first try to
uninstall it and then, after shutting down all other programs, try running
the installation again. Sorry I can't offer more assistance.
AmD
PS You probably don't have to wait an hour before deciding something has
gone amiss with your install <g>.
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
A computer lets you make more mistakes faster than any invention in human
history - with the possible exceptions of handguns and tequila.
- Mitch Ratliffe
------------------------------
Date: 20 Apr 1999 20:41:00 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Is it REALLY impossible to install Perl on Windoze???
Message-Id: <7fioos$9rb$1@gellyfish.btinternet.com>
On Tue, 20 Apr 1999 21:01:36 +0200 mjw@bahnhof.se wrote:
>
> I used various builds of Perl. I tried many times to
> carry out every installation. I tried every conceivable
> measures, deactivated antivirus programs (WHY, ON EARTH,
> IS IT NECESSARY???), switched off the lights in my room,
> prayed to God and so on.
>
Yeah but you forgot the white chickens, the black candles ...
>
> The ActiveState installation program freezes always
> when "preparing HTML documentation", at 95%, leaving
> the installation unfinished (I believe that 60 min
> waiting for the program to continue - was enough...).
>
I might be inclined to leave it for a while longer given the
lesser of your platforms. That stage took 20 minutes on my
work machine - a 350Mhz PII with 64MB - it has a lot of work
to do building several hundred HTML pages and hey this Windows
not Linux (where I can build the whole damn thing in ten minutes
from the source ).
>
> Is there anything I can do before I start hating Perl
> and send millions of anti-Perl spam messages on the whole
> net?
>
I wouldnt go there - there's more of us than you
> What the hell can go wrong in an installation program
> that does little more than copying files and writing
> some info in the registry?
>
As I say it does have to actually make the HTML from the pods
and do some other stuff with the modules and so on.
> Is it really impossible for the Perl community to prepare
> a package for MANUAL installation, with all files neatly
> packed, together with the directory tree, in a ZIP archive
> or similar, ready to copy "as is"?
>
I'd persist with the 'approved method' or install Linux.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 20 Apr 1999 20:17:13 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Need example
Message-Id: <7finc9$9r4$1@gellyfish.btinternet.com>
On Tue, 20 Apr 1999 14:54:09 -0500 Daniel Beckham wrote:
> You can write cgi in, python, tcl/tk, vb, vc, c, c++,
> basic, pascal, java and pretty much any other language in existence.
>
I dont if I would take it quite *that* far - I tried to something with
qbasic after making that self same claim a while back and for the life
of me I couldnt get it to work ... I'm not so sure about Logo either ;-}
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Tue, 20 Apr 1999 21:22:46 GMT
From: kn-brush@uchicago.edu
Subject: Re: Perl 'split' function in C??
Message-Id: <x7676rx9zt.fsf@atlantis.uchicago.edu>
krusty276@aol.com (Krusty276) writes:
> Does anyone have one, or know of a site that has the split funtion of Perl
> converted to C? Sorry I'm just lazy, and wanna save sometime before I start
> working on this?
>
> Thanks
You could always use strtok() from strings.h
-Ken
------------------------------
Date: 20 Apr 1999 16:43:38 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl 'split' function in C??
Message-Id: <371d031a@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, krusty276@aol.com (Krusty276) writes:
:Does anyone have one, or know of a site that has the split funtion of Perl
:converted to C? Sorry I'm just lazy, and wanna save sometime before I start
:working on this?
If you want Perl, you know where to find it. :-)
It's like ten times faster to develop in Perl than in C because it's
like ten times smaller. It's also like ten times less buggy.
Why don't you just go back to assembly language? :-)
--tom
--
150 years ago everybody was a Christian Scientist. --dmr
------------------------------
Date: 18 Apr 1999 23:25:12 -0700
From: inwap@best.com (Joe Smith)
Subject: Re: Perl vs. OTHER scripting languages ? When/Why to use it ?
Message-Id: <7fei88$a97$1@shell3.ba.best.com>
In article <3714AC6C.967940A5@slpmbo.ed.ray.com>,
Michael Genovese <mikeg@slpmbo.ed.ray.com> wrote:
>He recently decided that we WILL do our scripts in C-SHELL & AWK/NAWK,
Make sure he reads "Perl versus ..."
http://language.perl.com/versus/index.html
Especially the link for "Csh Programming Considered Harmful"
http://language.perl.com/versus/csh.whynot
which describes known bugs and deficiencies in csh.
-Joe
--
INWAP.COM is Joe Smith, Sally Smith and our cat Murdock.
(The O'Hallorans and their cats moved to http://www.tyedye.org/ Nov-98.)
See http://www.inwap.com/ for PDP-10, "ReBoot", "Shadow Raiders"/"War Planets"
------------------------------
Date: Tue, 20 Apr 1999 16:36:33 -0500
From: therzog@knotech.com (Tim Herzog)
Subject: Re: Please Help !!!!!
Message-Id: <therzog-2004991636330001@therzog-host105.dsl.visi.com>
In article <7fi09c$jmk$1@nnrp1.dejanews.com>, ranjeev_s._pamnani@hud.gov wrote:
Like this:
$result = `mailx <options>`;
or if you want to pipe input to it, like this:
if( open MAIL, "|mailx <options>" ) {
print MAIL "Input to mailx's stdin";
close MAIL;
}
>Hi,
>
>I am new to perl and want to execute a unix command (mailx) from within perl.
>Can anyone let me know how to invoke a unix command from within a perl script?
>
>Thanks in advance,
>Ranjeev
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
--
Tim Herzog
------------------------------
Date: Tue, 20 Apr 1999 22:03:12 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Please Help !!!!!
Message-Id: <7fit9o$5uk$1@fir.prod.itd.earthlink.net>
[ courtesy cc sent by mail if address not munged ]
Jasjit Singh <jasjit@teleport.com> wrote:
>
>$email = "someone@somewhere.someplace";
>$message = "This is the body of the mail message.\n";
>system("mailx -s \"This is the subject line\" $email < $message");
>
I assume you tested this before posting?
------------------------------
Date: 20 Apr 1999 22:13:50 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Please Help !!!!!
Message-Id: <7fiu6u$9s9$1@gellyfish.btinternet.com>
On Tue, 20 Apr 1999 13:43:08 GMT ranjeev_s._pamnani@hud.gov wrote:
> Hi,
>
> I am new to perl and want to execute a unix command (mailx) from within perl.
> Can anyone let me know how to invoke a unix command from within a perl script?
>
You want to use either system(), the backticks (``) or a piped open -
check the perlfunc and perlop manpages for more on these.
However if you want to send send mail from your program you probably
want to see the perlfaq9 manpage for more on mailing ..
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 20 Apr 1999 20:27:57 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: posting from perl to cgi
Message-Id: <7fio0d$9r7$1@gellyfish.btinternet.com>
On Tue, 20 Apr 1999 17:20:42 -0700 Ours wrote:
> Hi group.
>
> I was wondering how I can post one value, from a perl-script into another
> cgi-script.
>
One generally would use the module LWP::UserAgent part of libwww-perl
available from CPAN - it comes with good documentation so I wont bore
everyone else with the details.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Tue, 20 Apr 1999 22:11:15 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Problem with writing to file.
Message-Id: <7fitor$5uk$2@fir.prod.itd.earthlink.net>
[ courtesy cc sent by mail if address not munged ]
agniora@usa.net wrote:
>why doesnt this script here work?
>
>open OUTFILE, ">upal.txt";
>print OUTFILE "HI";
>printf OUTFILE ("Hello %5.0f %5.0f\n",9375,93257392);
>
>it creates a file called upal.txt but theres nothing in the file.
makes a file named upal.txt containing 'HIHello 9375 93257392' on my
system even though you have:
No shbang line.
No -w switch.
No check for the status of your open.
No clean closure to the file.
------------------------------
Date: 20 Apr 1999 22:29:50 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Problems installing module MIME-Base64-2.11
Message-Id: <7fiv4u$9t4$1@gellyfish.btinternet.com>
On Tue, 13 Apr 1999 22:29:30 GMT kstinson@hotmail.com wrote:
> times not implemented at /usr/local/lib/perl5/Benchmark.pm line 240. make:
> 1254-004 The error code from the last command is 2.
That'll be 'times' not implemented then - actually I dont think that this
will stop the Module from working and it just means that you wont be able
to use the Benchmark module.
Carry on and do 'make install' I think you'll find it alright.
However I would examine your OS documentation and Hassle the vendor to
find out why 'times' isnt implemented on your system.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 20 Apr 1999 21:59:14 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: purging old mail
Message-Id: <7fitbi$9s0$1@gellyfish.btinternet.com>
On Mon, 19 Apr 1999 08:33:04 -0700 Debbie Simek wrote:
> I'm trying to get back into programming after many years. I've been
> creating some HTML web pages and now I'm trying to learn Perl. I've
> been tasked to purge mail messages on our server that are older than 1
> year. Since many people tend to keep messages too long, I'm sure this
> is such a common procedure. Is this procedure in a library somewhere?
I would start with the output you get when you run:
find2perl -atime 365 -exec rm {} \;
Or indeed just lose the 2perl and run it from cron ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Tue, 20 Apr 1999 21:30:23 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Reading .ini files from Perl
Message-Id: <ebohlmanFAIBqn.6z7@netcom.com>
Scott W <swolfington@home.com> wrote:
: Is it possible to read and search .ini files in Perl For Win32? I know
: I could just read in the file line by line, but was wondering if there is a
: Perl module that makes it a little easier. Thanks in advance!
There are a couple modules on CPAN for doing that. I don't remember
their names offhand, but a trip to CPAN should point them out (IIRC,
they're *not* in the Win32::* namespace).
------------------------------
Date: 20 Apr 1999 20:46:37 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Reading .ini files from Perl
Message-Id: <7fip3d$9re$1@gellyfish.btinternet.com>
On Tue, 20 Apr 1999 17:53:14 GMT Clinton Pierce wrote:
> On Tue, 20 Apr 1999 17:10:25 GMT, "Scott W" <swolfington@home.com> wrote:
>>
>>Is it possible to read and search .ini files in Perl For Win32? I know
>>I could just read in the file line by line, but was wondering if there is a
>>Perl module that makes it a little easier. Thanks in advance!
>
> In DCI's "Crash Course In Perl" one of the labs does almost exactly this.
> (Since we teach on Win32 systems "win.ini" is something everyone has and
> is familiar with.) We create DBM files using the win.ini file as a source
> for data. The lab is at:
>
> http://www.geeksalad.org/business/training/perl/Lab5.html
>
> And one solution is:
>
>
> http://www.geeksalad.org/business/training/perl/solutions/Sol-Lab5.html
>
> .ini is actually a really easy format to parse in Perl...
>
It should also be borne in mind that there is a module named IniConf
available from CPAN that does exactly this.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Tue, 20 Apr 1999 15:48:23 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Reading .ini files from Perl
Message-Id: <371D0437.240F992E@mail.cor.epa.gov>
Eric Bohlman wrote:
>
> Scott W <swolfington@home.com> wrote:
> : Is it possible to read and search .ini files in Perl For Win32? I know
> : I could just read in the file line by line, but was wondering if there is a
> : Perl module that makes it a little easier. Thanks in advance!
>
> There are a couple modules on CPAN for doing that. I don't remember
> their names offhand, but a trip to CPAN should point them out (IIRC,
> they're *not* in the Win32::* namespace).
Right. Try the IniConf.pm module.
David
--
David Cassell, OAO
cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541)
754-4468
mathematical statistician fax: (541)
754-4716
------------------------------
Date: Fri, 16 Apr 1999 10:10:12 -0700
From: "Richard Croote" <rcroote@corp.atl.com>
Subject: Re: Reading File to a Scalar?
Message-Id: <7f7qvo$d11@sunshine.atl.com>
Reading these responses are interesting. I'm usually just lazy though and
do:
my $slurp = `cat file`;
Ray A. Lopez wrote in message <37174383.4E4A5468@inficad.com>...
>I wanted to know if there were any other (or better) ways of reading
>file data into a scalar? Below is one implementation I came up with.
>Any other ways????
>
>
>#!/usr/bin/perl -w
>use strict;
>
>my $slurp;
>
>open (FILE, "< file") or die "Can not open file!\n";
>
>while (<FILE>) {
> $slurp = join ('', $slurp, $_);
>}
>
>close (FILE);
>
>print "\n$slurp";
>
>
------------------------------
Date: 20 Apr 1999 22:06:11 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: SNMP
Message-Id: <7fitoj$9s6$1@gellyfish.btinternet.com>
On Tue, 20 Apr 1999 17:47:34 +0200 Philip Smeuninx wrote:
> Hello,
>
> How can I send SNMPGETS in perl???
>
There is, would you believe, Net::SNMP available from CPAN.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Tue, 20 Apr 1999 16:42:26 -0400
From: dwilgaREMOVE@mtholyoke.edu (Dan Wilga)
Subject: Re: Unix files in MacPerl
Message-Id: <dwilgaREMOVE-2004991642260001@wilga.mtholyoke.edu>
In article <371CBF56.3CC6996F@mail.cor.epa.gov>, David Cassell
<cassell@mail.cor.epa.gov> wrote:
> > Another alternative would be to install netatalk on the Unix machine,
> > since it will do the EOL conversion automatically on a volume that is
> > mounted through Appleshare or Appleshare IP.
>
> True, but doesn't that create a *major* security hole on the network?
[Thinking a bit more...] Or are you referring to the fact that netatalk
uses cleartext passwords by default (thus opening up holes for packet
sniffers)? If so, then that can be overcome by using another encryption
method.
Dan Wilga dwilgaREMOVE@mtholyoke.edu
** Remove the REMOVE in my address address to reply reply **
------------------------------
Date: Tue, 20 Apr 1999 16:39:27 -0400
From: dwilgaREMOVE@mtholyoke.edu (Dan Wilga)
Subject: Re: Unix files in MacPerl
Message-Id: <dwilgaREMOVE-2004991639270001@wilga.mtholyoke.edu>
> > Another alternative would be to install netatalk on the Unix machine,
> > since it will do the EOL conversion automatically on a volume that is
> > mounted through Appleshare or Appleshare IP.
>
> True, but doesn't that create a *major* security hole on the network?
How so? Netatalk uses the same login procedure and file access permissions
that Unix does. You log-in using the same uid and gid as if you were at
the command prompt.
Dan Wilga dwilgaREMOVE@mtholyoke.edu
** Remove the REMOVE in my address address to reply reply **
------------------------------
Date: Tue, 20 Apr 1999 21:23:07 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Unix files in MacPerl
Message-Id: <371fee20.1930448@news.skynet.be>
graphics wrote:
>I regularly swap Perl scripts between Mac and Linux/Unix and would like
>to know if there's a simple way of getting MacPerl 5.2.0r4 to read text
>files with Unix-style line endings, \n as opposed to the Mac's \r ?
As TomC so elabortately wrote: "\n" and "\r" are not physical
representations of line endings. They are "logical" representations.
You could say that "\n" is the line end, and "\r" is "the other one".
>It's getting tedious using BBEdit to change them each time. I could
>write a utility to do it for me but it would be nice not to have to
>worry about it...
Urm... I think you NEED to worry about it. Sorry.
You could have a simple script that can change any line endings to your
native line endings, for reasonably short text files (I think most
scripts would qualify ;-). It doesn't even hurt if line endings already
WERE converted. Caveat: untested.
undef $/;
while($file = shift) {
open(FILE,"+<$file") or die "Can't open file $file: $!";
$_ = <FILE>; # whole file
s/\015\012|\015|\012/\n/g; # any "standard" sequence
seek FILE,0,0;
truncate FILE,0;
print FILE;
}
Bart.
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5433
**************************************