[13615] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1025 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 8 21:06:02 1999

Date: Fri, 8 Oct 1999 18:05:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <939431115-v9-i1025@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 8 Oct 1999     Volume: 9 Number: 1025

Today's topics:
        ActiveState Perl install error on Win/NT 4.0 sp3 <duncan@mackinder.demon.co.uk>
    Re: Backtick programs <cassell@mail.cor.epa.gov>
    Re: Bug with localtime() in Perl 5.004 and 5.005 (Larry Rosler)
    Re: Bug with localtime() in Perl 5.004 and 5.005 <rick.delaney@home.com>
    Re: Das GlasPerlenspiel (Mark-Jason Dominus)
        matching jimmyory@my-deja.com
    Re: Modifying file timestamps <laurensmith@sprynet.com>
    Re: newbie possibly barking up the wrong tree... <jeff@vpservices.com>
    Re: NEWBIE QUESTION ON ORACLE <emschwar@rmi.net>
    Re: Overkill of warnings in module <cassell@mail.cor.epa.gov>
    Re: parenthesizing arguments to grep - BLOCK form (Larry Rosler)
        Perl encryption modules for Solaris 2.7 <shawn@unifygroup.com>
    Re: Please compare and contrast C and Perl. luvisi@andru.sonoma.edu
    Re: Please compare and contrast C and Perl. luvisi@andru.sonoma.edu
    Re: reading a hash using DBI <dove@synopsys.com>
    Re: sendmail problem (Kragen Sitaker)
    Re: sendmail problem <ltl@rgsun40.viasystems.com>
    Re: Server-Push Script (Kragen Sitaker)
    Re: Server-Push Script <dove@synopsys.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 8 Oct 1999 22:03:00 +0100
From: "Duncan Mackinder" <duncan@mackinder.demon.co.uk>
Subject: ActiveState Perl install error on Win/NT 4.0 sp3
Message-Id: <939416667.23073.0.nnrp-12.c1ed8957@news.demon.co.uk>

I've been having trouble installing ActiveState Perl (versions 5.17, 5.19
and 5.20) on Windows NT 4.0 Server SP3.  I also have Visual Studio 6.0 + SP2
installed in case this is relevant as I have seen other problems caused by
Visual Studio.  I can install 5.02 with no problems.

During the install I accept all defaults, except directory (which I've set
to D:\programfiles\perl), I have 84Mb free on C:, 143Mb on D: and 223Mb free
on E: (which is where Windows NT is installed).  After 'Start Copying Files'
dialog window is displayed and I click Next on that dialog, I get a popup
saying:
    Warning
    Error using perlez.dll!

Then another saying:
    .\Could not load
\P:\Apps\ActivePerl\temp\bin\MSWin32-x86-object\PerlEz.dll! ActivePerl
installation will abort!

The distribution appears to have unpacked itself OK to E:\temp and I can see
the perlez.dll whilst the installer dialogs are being displayed.

Has anyone seen this before or have any suggestions.

Many thanks in advance for any help

Duncan Mackinder





------------------------------

Date: Fri, 08 Oct 1999 15:19:04 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Backtick programs
Message-Id: <37FE6DD8.369880C4@mail.cor.epa.gov>

oliver.cookUYNQFM@ukonline.co.uk wrote:
> 
> Thanks for all the suggestions. I solved it like this:
> 
> #!/usr/bin/perl

You forgot the -w flag and 'use strict;' here.

> open (DB, "/etc/data");

Oops.  You forgot to check the return on your open() .

> @data = <DB>;

I hope your DB is small, since this can be a major memory-pig
otherwise.

> close(DB);

It wouldn't hurt to check the return on your close() either.

> $ref = "0";

my $ref = 0;   #you really want a number, not a string

> foreach $line (@data) {
>  $ref++;
>  ($user[$ref],$domain[$ref],$logfile[$ref],$location[$ref]) = split
> (/:/, $line);

I would have written this as an array of arrays instead.
See the perldsc and perllol pages.

>  $location[$ref] =~ s/\n//;
> }
> 
> for $c (1..$ref) {
> $webmaster = "webmaster\@".$domain[$c];
> $baseurl = "http://www.".$domain[$c];
> #write out analog.cfg
> system("cp -f analog.txt /usr/local/apache/analog/analog.cfg");

I would have use File::Copy here..

> system("echo LOGFILE $logfile[$c]

and print() here..

> >>/usr/local/apache/analog/analog.cfg");
> print "-----------ANALOG DONE----------\n";
> #write out rmagic.ini
> system("cp -f rmagic.ini /root/statsrun/temp.ini");

and File::Copy again..

> system("echo Frame_File_Out = $location[$c]/index.html
> >>/root/statsrun/temp.ini");
> system("cat rmagic.ini.2 >>/root/statsrun/temp.ini");
> system("echo File_Out = $location[$c] >>/root/statsrun/temp.ini");
> system("cat rmagic.ini.3 >>/root/statsrun/temp.ini");
> system("echo File_Out = $locationpc]/navfile.html
> >>/root/statsrun/temp.ini");
> system("cat rmagic.ini.4 >>/root/statsrun/temp.ini");
> system("echo webmaster = $webmaster >>/root/statsrun/temp.ini");
> system("echo Base_URL = $baseurl >>/root/statsrun/temp.ini");

and a few print() statements here..

> system("rm -f /usr/local/apache/rmagic/report.dat");

and unlink() here.  You really ought to check the returns
on calls using system(), particularly when you do something
like rm .

> print "-----------RMAGIC DONE-----------\n";
> 
> #run analog
> system("/usr/local/apache/analog/analog");
> print "---------RUN ANALOG--------\n";
> #run rmagic
> system("rm -rf $location");
> system("cd /usr/local/apache/rmagic");

I see only two places so far where system() looks like
a decent idea.

> system("/usr/local/apache/rmagic/rmagic.pl /root/statsrun/temp.ini");

And I wouldn't do this using system() either.
Look up do() and require() in perlfunc.

> print "---------RUN RMAGIC-------\n";
> }
> exit;

You use an exit() at the end of your program? 
But you don't bother to define a return value?
I don't get either.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Fri, 8 Oct 1999 15:01:59 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Bug with localtime() in Perl 5.004 and 5.005
Message-Id: <MPG.126809b3d458554b98a063@nntp.hpl.hp.com>

In article <37FE5F8C.2FE2D568@home.com> on Fri, 08 Oct 1999 21:17:58 
GMT, Rick Delaney <rick.delaney@home.com> says...
> Ilya Zakharevich wrote:
> > 
> > Moreover, leap seconds are "mostly" governed by the changes in the
> > rate of Earth rotation, which IIRC are in turn mostly governed by
> > whether changes.  Since one cannot predict the latter, making
> > prediction about the former would be kinda stupid.
> 
> Predictions based on weather forecasts are suspect, but this has nothing
> (or negligible enough to be called nothing) to do with the rotation of
> the Earth or leap seconds.

Correct.

> Leap seconds are periodically added to a standard atomic clock (which I
> shall call SAC) because there are less than 86400 SAC seconds in one
> Earth rotation. ...

The rest of the world calls this International Atomic Time (TAI).

> Prediction is not really necessary.  When the SAC time is lagging by
> about a second as measured against the solar time then it is time to add
> a leap second.  These are usually added in June or December, I think,
> but could probably be added anytime the drift becomes too great.

It is now agreed that the June and December changes will suffice.

> It is possible that at some time before this ad hoc scheme was decided
> upon that there were suggestions of adding two leap seconds at once
> (perhaps instead of more than once per year when necessary).  I don't
> know if this was ever truly the case or not but it would explain the 61
> in the spec for struct tm.

Correct.

> The slowing in the rate of Earth's rotation is caused mostly by
> gravitational interaction with the moon (tidal forces) and is relevant
> to leap seconds only in that they will occur with greater frequency as
> the Earth slows more.

This second derivative is noticeable on a geological time scale only.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Fri, 08 Oct 1999 21:17:58 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Bug with localtime() in Perl 5.004 and 5.005
Message-Id: <37FE5F8C.2FE2D568@home.com>

[posted & mailed]

Ilya Zakharevich wrote:
> 
> Moreover, leap seconds are "mostly" governed by the changes in the
> rate of Earth rotation, which IIRC are in turn mostly governed by
> whether changes.  Since one cannot predict the latter, making
> prediction about the former would be kinda stupid.

Predictions based on weather forecasts are suspect, but this has nothing
(or negligible enough to be called nothing) to do with the rotation of
the Earth or leap seconds.

Leap seconds are periodically added to a standard atomic clock (which I
shall call SAC) because there are less than 86400 SAC seconds in one
Earth rotation.  The difference is such that a second must be added once
or twice a year so that the SAC time doesn't drift away from how a solar
year is measured.

Prediction is not really necessary.  When the SAC time is lagging by
about a second as measured against the solar time then it is time to add
a leap second.  These are usually added in June or December, I think,
but could probably be added anytime the drift becomes too great.

It is possible that at some time before this ad hoc scheme was decided
upon that there were suggestions of adding two leap seconds at once
(perhaps instead of more than once per year when necessary).  I don't
know if this was ever truly the case or not but it would explain the 61
in the spec for struct tm.

The slowing in the rate of Earth's rotation is caused mostly by
gravitational interaction with the moon (tidal forces) and is relevant
to leap seconds only in that they will occur with greater frequency as
the Earth slows more.

-- 
Rick Delaney
rick.delaney@home.com


------------------------------

Date: Fri, 08 Oct 1999 21:34:40 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Das GlasPerlenspiel
Message-Id: <7tlo0g$pho$1@monet.op.net>
Keywords: Baldwin betel Oxnard stoop

[Mailed and Posted]

In article <7ter2b$2b7@newshost.fujitsu.com.au>,
Fujitsu Australia Limited <andrew.yuen@fujitsu.com.au> wrote:
>Is Perl the Glass Bead Game or is the Glass Bead Game available as a Perl
>module?

I implemented a CGI version of this two or three years ago.
At your request, I revived the code.

http://www.plover.com/cgi-bin/mjd/gp.cgi

Best regards,


UN altered RE production of this IM portant IN formation is EN couraged.



------------------------------

Date: Sat, 09 Oct 1999 00:35:38 GMT
From: jimmyory@my-deja.com
Subject: matching
Message-Id: <7tm2kq$fa7$1@nnrp1.deja.com>

I am writing a script that is logging information
to a a file.  I then open this file and find how
many times a certain address is in the file.  How
can i put the number of times matches and set it
to a number


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Fri, 8 Oct 1999 17:39:43 -0700
From: "Lauren Smith" <laurensmith@sprynet.com>
Subject: Re: Modifying file timestamps
Message-Id: <7tm2sh$ld3$1@brokaw.wa.com>

Cory W. Aitchison wrote in message <37fe5798.0@news.provo.novell.com>...
>Is there a way to modify a file's timestamp?
RTFFAQ
TF perlfaq5 has exactly what you're looking for.

While you're at it, try typing 'perldoc perldoc' at your prompt.  This
will give you an online manual for perldoc, your built-in Perl
documentation finder.

After reading the documentation for perldoc, try typing 'perldoc -q
timestamp' and see how quickly and easily your Perl queries are
answered!

Enjoy,

Lauren




------------------------------

Date: 8 Oct 1999 20:28:22 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: newbie possibly barking up the wrong tree...
Message-Id: <37FE53A0.AB6DE837@vpservices.com>

Mike Blamires wrote:

> Can I set my web space provided by my ISP up to run perl scripts?

Only your ISP can answer that question.  Ask them if they allow users to
create cgi scripts  and, if so, if they have Perl installed.  If the
answer to both questions is yes (which it should be on any decent ISP),
away you go.

> the documentation that has come with
> ActivePerl has pretty much confused me.

ActivePerl would only be relevant if you want to test your scripts on
your own local machine.  You could use it and a free webserver (like a
windoze version of apache) to test your scripts at home.   But then, for
the rest of the world to see them, you'd need to upload them to your
ISP's server, for which, see my advice above.

> p.s sorry if this is off-topic for the ng I figured that it was the most
> appropriate.

Well, it is a bit off-topic, but gee, you asked so nicely.  One request
though: please use a subject line that identifies your question, not the
kind of subject line you did use which can apply to any question in the
world.

-- 
Jeff


------------------------------

Date: 08 Oct 1999 15:22:10 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: NEWBIE QUESTION ON ORACLE
Message-Id: <xkfiu4h8s59.fsf@valdemar.col.hp.com>

Jerry Preston <g-preston1@ti.com> writes:
> The insert is the only code in the sub debug called.  I have no problem
> reading the oracle data base.  What else do you need?

First off, it's irritating (and not a little bit rude) to quote the
entire post you're replying to.  It suggests you can't be bothered to
pick out the bits that are important, and hence just toss it all in,
willy-nilly.  It's also rude and against conventional USENET style to
place your replies before that which you reply to, as if you were playing
Jeopardy.

That said,

>       insert into twroot.scrap_status( C_REMOVED_BY, C_REMOVED_NAME,
>           C_REMOVED_REASON, c_removed_date )
>       values( $Emp_Number, $Emp_Name, $Reason, $c_date );

is SQL code.  It is not Perl code.  If you are trying to execute it
directly in perl, then it's no wonder you're getting errors-- it's like
trying to compile an ADA program with a C compiler.  I would expect to
see it wrapped up in a prepare() statement, and then an execute()
(assuming you're using DBI::DBD) call.

If you're using Oraperl, I can't help you; I've no experience with that.

-=Eric
-- 
"Cutting the space budget really restores my faith in humanity.  It
eliminates dreams, goals, and ideals and lets us get straight to the
business of hate, debauchery, and self-annihilation."
                -- Johnny Hart


------------------------------

Date: Fri, 08 Oct 1999 15:24:59 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Overkill of warnings in module
Message-Id: <37FE6F3B.D06D7C7E@mail.cor.epa.gov>

Willem Joosten wrote:
> 
> Hi,

Howdy,

> I'm writing some ODBC stuff with Activate state Perl. I use the strict and
> diagnostics modules to make life easier

Good!  Try the -w flag too.

>                                       but this module gives a lot (twice
> every single time I get row) of 'Use of unitialized value' warnings.

Oh.  You are using -w already.  This must be Win32::ODBC and not
DBD::ODBC .  Right?  I think there's a known glitch there in
the GetData subroutine.
 
> Is there a way to turn these warnings of locally?

Yes.  You can do this:

$^W = 0;
         # lines of troublesome code go here
$^W = 1;

[snip]

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Fri, 8 Oct 1999 15:32:14 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: parenthesizing arguments to grep - BLOCK form
Message-Id: <MPG.126810c9a73f062c98a064@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <x7aepto9n1.fsf@home.sysarch.com> on 08 Oct 1999 16:55:14 -
0400, Uri Guttman <uri@sysarch.com> says...
> >>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
> 
>   LR> Uh, oh.  I don't know what's going on here.
>   LR> Help!  I need somebody's help!
> 
> i always suspected that. with this breakthrough we can start to work on
> your deeper problems. now sit back and relax and repeat, "python is the
> one true language"

The next line is "Not just anybody's help!"  And certainly not yours!  
:-)

>   LR> print grep {$_ % 2} 0 .. 9;   # 13579
> 
> normal grep BLOCK syntax
> 
>   LR> print grep ({$_ % 2} 0 .. 9); # 13579
> 
> odd grep BLOCK syntax. maybe the parens are just grouping and removed
> before passing the contents to the grep op. or they are detected as a
> no-op and removed during the parse.
> 
>   LR> #print grep({$_ % 2} 0 .. 9); # Syntax error here!
> 
> looks like a function syntax, so there is a missing , after the anon
> hash (what we think is the BLOCK). this is expected.

The following all work equally well, interpreting the first argument as 
a filehandle regardless of the parentheses:

print STDOUT 'foo', 'bar';

print STDOUT ('foo', 'bar');

print (STDOUT 'foo', 'bar');

print(STDOUT 'foo', 'bar');

But 'grep BLOCK LIST' works differently.  Bug?

> so only the second one is odd as it is not a legal list in parens and it
> is not a function syntax. somehow that is converted into the first
> version in the parser.

There are situations where one must disambiguate an anonymous hashref 
from a block by prefixing the former with unary plus.  I don't know any 
syntax to do the opposite, to designate a block.  

> in any case, why did the original poster want the block form in parens?
> what good could it do? grep is a list operator so it can't need any
> major precedence hacking AFAIK. you could paren its list values without
> using parens around the grep and block.

Of course you could do that.  That's not the point.  *Every* declared 
function or built-in operator can be invoked without parentheses *or 
with them*.  Here we find a syntactic distinction based on whitespace 
between the name and the opening parenthesis.  Bug?

perlsyn says "Perl is, for the most part, a free-form language. (The 
only exception to this is format declarations, for obvious reasons.)"

The response by the original poster reads:  "I never thought of putting 
a space before the opening parenthesis.  Must be some deep heuristic 
magic going on here."  What might that be?  Bug?

Earlier today, you chomped on a newbie for yelling 'Bug?'.  Now bite on 
me.
 
-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: 08 Oct 1999 16:06:31 PDT
From: shawn fang <shawn@unifygroup.com>
Subject: Perl encryption modules for Solaris 2.7
Message-Id: <37FE7990.1F819E1A@unifygroup.com>

Has anybody successfully compiled any Perl encryption modules, DES or
IDEA on Sun Solaris 2.7.
I couldn't get either one compiled, keep getting following error:

gcc -B/usr/ccs/bin/ -c  -I/usr/local/include -I/opt/local/include -O
-DVERSION=\"1.01\" -DXS_VERSION=\"1.01\" -fPIC
-I/usr/local/lib/perl5/5.00503/sun4-solaris/CORE  DES.c
In file included from DES.xs:10:
des.h:3: parse error before `des_user_key'
des.h:3: warning: data definition has no type or storage class
des.h:4: parse error before `des_cblock'
des.h:4: warning: data definition has no type or storage class
des.h:5: parse error before `des_ks'
des.h:5: warning: data definition has no type or storage class
des.h:7: parse error before `in'
des.h:8: parse error before `userKey'
DES.xs: In function `XS_Crypt__DES_expand_key':
DES.xs:20: `des_ks' undeclared (first use in this function)
DES.xs:20: (Each undeclared identifier is reported only once
DES.xs:20: for each function it appears in.)
DES.xs:20: parse error before `ks'
DES.xs:26: `u_int8_t' undeclared (first use in this function)
DES.xs:26: parse error before `)'
DES.xs:28: `ks' undeclared (first use in this function)
DES.xs: In function `XS_Crypt__DES_crypt':
DES.xs:47: `des_ks' undeclared (first use in this function)
DES.xs:57: `u_int32_t' undeclared (first use in this function)
DES.xs:57: parse error before `)'
gcc: file path prefix `/usr/ccs/bin/' never used
make: *** [DES.o] Error 1

Any ideas ?

thanks.

-shawn



------------------------------

Date: 08 Oct 1999 14:56:11 -0700
From: luvisi@andru.sonoma.edu
Subject: Re: Please compare and contrast C and Perl.
Message-Id: <m2d7up4iv8.fsf@andru.sonoma.edu>

David Cassell <cassell@mail.cor.epa.gov> writes:
[snip]
> > file manipulation: find + sh
> 
> Sometimes.  But a lot of repetitive file manipulation tasks
> seem to work better/faster in Perl.

I'm refering to things like "rename all .JPGs to .jpg" or "add this
header to every file".

eg: find . -name \*.JPG -print |
     xargs -c 'for i; do mv $i ${i%.JPG}.jpg; done' dummy

or: find . -type f -print |
     xargs sh -c 'for i; do mv $i $i.old; cat header $i.old > $i; done' dummy

> > running other programs: sh
> 
> Often true [for simple programs with little flow control].
> But when one needs more flow control, better error-checking,
> pattern-matching, non-unix-box systems work, and/or a way 
> out of the pipes-are-my-life mentality, I find Perl is
> preferable.  For me, anyway.  YMMV.

Yes, but pipes-are-my-life works rather well for many things I have to
do...  I said "running other programs", not "running other programs
with weird input and validation of data passing between them and
translating every other character of the output into upper case".  I
would definately use perl for the latter ;-)

> > string manipulation: icon
> 
> Really?  Could you share an example?  I find icon's
> pattern-matching and substitution facilities to be way
> behind Perl's.  Maybe I don't know enough icon.

Icon tends to be more verbose, but I find it more flexible since icon
has backtracking built into the language, including
automatically-undone-when-backtracked assignments.  However, for the
sort of work I normally do, perl's regular expressions are usually
enough.  Icon isn't as good as perl at manipulating files and
connecting to databases, and icon's library is really tiny compared to
CPAN.  Icon also has even less freely modifiable and freely
redistributable documentation than perl, which might help account for
icon's shortage of libraries.  Oh, and it just so happens that string
manipulation was the main thing Ralph Griswold needed to do when he
designed icon...  I think I see the beginnings of a hypothesis forming
here...  I sense that there might be some kind of a slight
relationship between what a designer needs and what a language tends
to be good at.  nyah... ;-)

Here's an example of the classic balanced parenthesis problem (icon
has a scanning function built in that does this already, so I don't
recommend actually using this):

procedure main()
 while j := read()
 do if m := (j ? balpar() || pos(0))
    then write("true") else write("false");
end

procedure balpar()
  suspend (tab(many(~'()')) | "") ||
          ((tab(match("(")) || balpar() || tab(match(")")) || balpar()) | "");
  fail;
end

Icon also has coexpressions/generators, so let's say you wanted to
compare the branches of two binary trees of the form [ value, <left>,
<right> ], using &null for termination...

procedure main()
 tree1 := [ 8, [ 4, [ 1, &null, &null ], [ 5, &null, &null ]],
              [ 100, [ 75, &null, &null ], &null ] ];
 tree2 := [ 100, [ 75, [ 8, [ 5, [ 4, [ 1, &null, &null ], &null ], &null ],
                        &null ], &null ], &null ];
 tree3 := [ 9, [ 4, [ 1, &null, &null ], [ 5, &null, &null ]],
              [ 100, [ 75, &null, &null ], &null ] ];

 if leafcompare(tree1, tree2)
  then write("the same")
  else write("different");

 if leafcompare(tree2, tree3)
  then write("the same")
  else write("different");
end

procedure inorder(tree)
 if \tree[2] then suspend inorder(tree[2]);
 suspend tree[1];
 if \tree[3] then suspend inorder(tree[3]);
 fail;
end

procedure leafcompare(first, second)
 local iterator1, iterator2, j;
 iterator1 := create inorder(first);
 iterator2 := create inorder(second);

 while j := @iterator1
 do if j ~= @iterator2 then fail;

 return &null;
end

Icon's backtracking and coexpressions aren't as powerful as scheme's
call/cc, but icon has the built in string scanning functions and
really nice strings, arrays, and hashes.  These are much like perl's,
only arrays and hashes are all by reference already, and you can
subscript strings (including as lvalues, eg foo[2:4] = "hello there").
I prefer icon to scheme for string stuff for the same reason I prefer
perl to icon for integration stuff.

> > object oriented programming: C++, Eiffel, Pike, and any other language
> > that doesn't require that you know the names of a superclass's private
> > variables when subclassing in order to avoid clobbering them (note:
> > this kind of includes python, with it's support for automatically
> > mangling _foo into modulename_foo, but I'm not particularly fond of
> > that scheme either)
> 
> C++ ?  Yick.  Eiffel is better.

C++ still lets me use a name in a subclass if it's the same as a
superclass's private variable, without causing any problems.  This
means that I don't need to know anything about the implementation of a
class in order to use it and subclass it.  This is a Good Thing.  In
perl, using the standard way of representing objects as blessed hash
references, I need to know about the *private* implementation of a
class in order to subclass it safely.  This is a Bad Thing.  

Say what you will about C++... it provides a workable OO framework and
an almost functional one (when using STL, for some values of almost)
while keeping most of the speed of C (yes, I know: only when used by
someone who's rather competent).  It just so happens this is exactly
what Stroustrup needed: an OO framework which would allow him to
create independ agents in a managable fashion, but which ran at a
tollerable speed even with thousands of agents all going at the same
time...  in short, it's a jack-of-all-trades-master-of-few slut
language, much like perl.  It just prostituted itself to a different
set of trades. ;-)

[snip]
> C is a good language, and is the best language for some tasks.
> But then, a parachute is the best way to get off a mountaintop
> for certain values of 'best'.  Just don't try it if you're
> not already an expert.

heh heh.  Well, it's not the safest way, and it's not the fastest way,
but it might be fast *enough*, and safe *enough*... kinda like
perl...  *grin*

Andru
-- 
-------------------------------------------------------------------------- 
| Andru Luvisi                 | http://libweb.sonoma.edu/		 |
| Programmer/Analyst           |   Library Resources Online              | 
| Ruben Salazar Library        |-----------------------------------------| 
| Sonoma State University      | http://www.belleprovence.com/		 |
| luvisi@andru.sonoma.edu      |   Textile imports from Provence, France |
--------------------------------------------------------------------------


------------------------------

Date: 08 Oct 1999 15:10:04 -0700
From: luvisi@andru.sonoma.edu
Subject: Re: Please compare and contrast C and Perl.
Message-Id: <m2bta94i83.fsf@andru.sonoma.edu>

luvisi@andru.sonoma.edu writes:
[snip]
> procedure inorder(tree)
>  if \tree[2] then suspend inorder(tree[2]);
>  suspend tree[1];
>  if \tree[3] then suspend inorder(tree[3]);
>  fail;
> end
[snip]

Whoops!  That should be:
procedure inorder(tree)
 if /tree then fail;
 suspend inorder(tree[2]);
 suspend tree[1];
 suspend inorder(tree[3]);
 fail;
end

Pity I don't remember these things *before* hitting the send key...

Andru
-- 
-------------------------------------------------------------------------- 
| Andru Luvisi                 | http://libweb.sonoma.edu/		 |
| Programmer/Analyst           |   Library Resources Online              | 
| Ruben Salazar Library        |-----------------------------------------| 
| Sonoma State University      | http://www.belleprovence.com/		 |
| luvisi@andru.sonoma.edu      |   Textile imports from Provence, France |
--------------------------------------------------------------------------


------------------------------

Date: Fri, 08 Oct 1999 17:33:59 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: reading a hash using DBI
Message-Id: <37FE8D77.69B01840@synopsys.com>

Hi Eric,

Eric White wrote:

> The scenario:  I'd like to read in the values from a form and put them into
> a database.  I think I've got a handle on how to do this, but some weird
> things seem to be happening.  Here's what I've got:
>
> #!c:\Perl\bin\perl.exe -w
>
> use DBI;
> use CGI;
> use CGI::Carp qw(fatalsToBrowser);
> use Tie::IxHash;
>
> tie %FORM, "Tie::IxHash";
>
> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> @pairs = split(/&/, $buffer);
> foreach $pair (@pairs) {
>     ($name, $value) = split(/=/, $pair);
>     $value =~ tr/+/ /;
>     $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
>     $FORM{$name} = $value;
>

You're using CGI so why don't you use the CGI param function to access your
from data rather than this.

>
> $dbName     = "webtest";
> $dbDriver   = "ODBC";
> $dbUserName = "";
> $dbPassword = "";
>
> $dbh = DBI->connect("DBI:ODBC:webtest",
>         { RaiseError =>1 , AutoCommit => 0 });
>
> $dbh->do ("INSERT INTO webtest VALUES ('$FORM{third}', '$FORM{password}',
>          '$FORM{first}', '$FORM{second}', '$FORM{caseid}')");
>

Probably you have an error in the SQL for the data type being stored.  The best
way to find out is to put a die statement here.

I would do something like the following:

my $sql = "INSERT INTO webtest VALUES ..."

$dbh->do ($sql)  or die "Can't insert $sql: $DBI::errstr\n";

This should give you the reason for why you can't insert this stuff.

(rest of the script deleted).

Hope this helps,
-=dav




------------------------------

Date: Fri, 08 Oct 1999 22:49:50 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: sendmail problem
Message-Id: <iyuL3.9490$eM4.630360@typ11.nn.bcandid.com>

In article <7tle3d$2bt$1@news3.Belgium.EU.net>,
Robbertc <robbertc@ping.be> wrote:
>i have a problem with sendmail. I've written this piece of code and it works
>on my linux machine (with apache running on it).
>Whenever i upload the script to my ISP and run it, nothing happens. I'm sure
>the path is correct and i can use sendmail... so i guess there must me some
>kind of error i'm overlooking...
>
>What did i do wrong ? Can someone help me ?

I assume you're running it on a web server.

If I had this problem, I would:
1. verify that script die()s and warn()s are being processed properly,
by adding a warn "Hi" or something;
2. verify that sendmail is getting invoked properly by using a
shell-script substitute that simply writes the message, along with the
time of invocation, to a file, and verify that the file is getting
written;
3. take out the shell-script stub, look at the system logs to see if
sendmail is really getting invoked properly, and if so, what it's doing
with the mail.

>close(SENDMAIL) or warn "Sendmail werd niet goed afgesloten";

You might want to include $! and $? in this message, btw.

Good job on running sendmail securely, btw.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Fri Oct 08 1999
32 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


------------------------------

Date: 9 Oct 1999 00:32:30 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: sendmail problem
Message-Id: <7tm2eu$4f3$1@rguxd.viasystems.com>

Kragen Sitaker <kragen@dnaco.net> wrote:
:>In article <7tle3d$2bt$1@news3.Belgium.EU.net>,
:>Robbertc <robbertc@ping.be> wrote:
:>>i have a problem with sendmail. I've written this piece of code and it works
:>>on my linux machine (with apache running on it).
:>>Whenever i upload the script to my ISP and run it, nothing happens. I'm sure
:>>the path is correct and i can use sendmail... so i guess there must me some
:>>kind of error i'm overlooking...
:>>
:>>What did i do wrong ? Can someone help me ?

:>I assume you're running it on a web server.

:>If I had this problem, I would:
:>1. verify that script die()s and warn()s are being processed properly,
:>by adding a warn "Hi" or something;
:>2. verify that sendmail is getting invoked properly by using a
:>shell-script substitute that simply writes the message, along with the
:>time of invocation, to a file, and verify that the file is getting
:>written;
:>3. take out the shell-script stub, look at the system logs to see if
:>sendmail is really getting invoked properly, and if so, what it's doing
:>with the mail.

If your assumption is correct, he probably doesn't have access to the
system logs and may not even be able to create a file with the CGI
script.  I think the standard answer for this is to do whatever is
required to send the error messages to the browser instead of (or in
addition to) the server logs.  See

perldoc CGI::CARP
# and in particular 'use CGI::Carp qw(fatalsToBrowser);'

Oh, Robert, you are using CGI.pm, aren't you?

Welcome back Kragen.  Been on holiday?

-- 
// Lee.Lindley   /// I used to think that being right was everything.
// @bigfoot.com  ///  Then I matured into the realization that getting
////////////////////   along was more important.  Except on usenet.


------------------------------

Date: Fri, 08 Oct 1999 22:52:34 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Server-Push Script
Message-Id: <SAuL3.9499$eM4.620751@typ11.nn.bcandid.com>

In article <37FE6EE4.AB4A5A3D@arweb.de>, Florian Arndt  <arndt@arweb.de> wrote:
>I've got a little problem with a server-push script. I extracted it with
>gzip and tar as usual under linux and it worked so far. But when I just
>copied it and chmodded it to 755 it didn't work anymore.

What does "didn't work" mean?
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Fri Oct 08 1999
32 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


------------------------------

Date: Fri, 08 Oct 1999 17:53:42 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: Server-Push Script
Message-Id: <37FE9216.FA8B93AE@synopsys.com>

Hi Florian,

Florian Arndt wrote:

> I've got a little problem with a server-push script.

Here's a script I wrote that used the CGI module that should help you out.
Make sure you start the name of this script with 'nph-'  (e.g.
'nph-serverpush.cgi').  While some webservers won't need this, others might.

Hope this helps,
-=dav

#!/usr/local/bin/perl-5.004 -w
# Always use -w to catch errors.

#
# Author: Dav Amann (dove@synopsys.com)
# Version: 1.0
#

use strict;                       # Always use strict.
use CGI qw/:standard/;
use CGI::Carp qw/fatalsToBrowser/;


$| = 1;              #Turn off Perl's output buffering;

print
    header ("-nph"     => "1",          # Tell the script to
                                        # use non-parsed
                                        # headers
            "-status"  => "200 OK",     # Tell the client what status
                                        # you want.
            "-type"    => "text/html"),
    start_html("-title"  =>
               "Server Push Test"),
    h1("Server Push Test");



my @words = ("This", "is", "a", "test");

foreach my $word (@words) {
    print "<P>$word\n";                # Print each word out 1 at a
                                       # time.
    sleep (2);                         # Sleep 2 seconds between
                                       # printing.
}



------------------------------

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 1025
**************************************


home help back first fref pref prev next nref lref last post