[19881] in Perl-Users-Digest
Perl-Users Digest, Issue: 2076 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 6 09:05:43 2001
Date: Tue, 6 Nov 2001 06:05:13 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1005055513-v10-i2076@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 6 Nov 2001 Volume: 10 Number: 2076
Today's topics:
Re: Best language for low IQ programmers? <kenny@kacweb.com>
Re: Best language for low IQ programmers? <peter_icaza@REMOVE2REPLYuhc.com>
Re: Best language for low self-esteem programmers? <dhinojosa@qwest.net>
Re: Can you help optimize this?? <pne-news-20011106@newton.digitalspace.net>
DBI $dbh->prepare(q{SELECT .... }); question???? <mario.lat@libero.it>
Re: DBI $dbh->prepare(q{SELECT .... }); question???? <jeff@vpservices.com>
format() help! newbie question <infullflight@22000rpm.com>
helo :) (hugh1)
Re: helo :) <s_grazzini@hotmail.com>
If statement in perl script not working! <harm.bouwman@mediasys.nl>
Re: If statement in perl script not working! <bill.kemp@wire2.com>
Re: If statement in perl script not working! <eod_spam@yahoo.es>
Re: If statement in perl script not working! <nobody@nowhere.com>
Re: If statement in perl script not working! <s_grazzini@hotmail.com>
Re: Leftmost SHORTEST <csaba.raduly@sophos.com>
MySQL table detection <Anthony.Heuveline@wanadoo.fr>
Re: MySQL table detection (Rafael Garcia-Suarez)
Re: Naive Q: Why Java speed >> Perl speed? <tintin@snowy.calculus>
Re: Naive Q: Why Java speed >> Perl speed? <edgue@web.de>
Perl modules from a C Program <bnswami@india.hp.com>
Re: Perl modules from a C Program <binary@eton.powernet.co.uk>
Re: Perl modules from a C Program <eod_spam@yahoo.es>
Problem with make while installing Perl 5.6.1 on Solari (Real Newbie)
Question about file locking. <J.E.J.opdenBrouw@st.hhs.nl>
question about perl-cgi (hugh1)
Re: question about perl-cgi <eod_spam@yahoo.es>
Re: Scalar Context Automatically Provided to Function A (Anno Siegel)
Re: Scalar Context Automatically Provided to Function A <eod_spam@yahoo.es>
Re: Sending Content Type in email <tintin@snowy.calculus>
Re: Sending Content Type in email <tassilo.parseval@post.rwth-aachen.de>
Some very basic questions <robin1@otenet.gr>
Re: Some very basic questions <edgue@web.de>
Re: Some very basic questions <tintin@snowy.calculus>
Re: sorry ! (Joe Smith)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 6 Nov 2001 05:37:53 -0700
From: Kenny Chaffin <kenny@kacweb.com>
Subject: Re: Best language for low IQ programmers?
Message-Id: <MPG.1651878ac0b2c806989f3b@news.dimensional.com>
In article <1004990076967295@aol.com>, BrianMetc@aol.com says...
> I would like to get into the programing field. My problem is that I have low IQ due to
> early childhool learning deprivation and TV overdose. Simply said I am stuped, I am
> pretty good amongst my friends, but not solving problems. You know what I
> mean. Anyways, I want to go into computor programing because of money
> issue. I now need to choose languege for programming, simple enough
> for me.
>
> My friend wh does C plus plus recommended that I learn either Visual Basic or Eiffel.
> My ex girlfriend who is a sys admin who did perl, sugested that I learn Ada because
> it has "serious type system" which is fool proof.
>
> She dis couraged me from using Eiffel because itr was a language going out of the
> market, no longer used by any serious corporation, She said the same thing for Ada.
>
> Java is simple compared to c plus plus but a scam language, based on hype.
>
> This only leaves visual basic. Especally because it is used under Windows, Microsoft
> stuff is always easier.
>
> Would any one sugest the best language for me.
>
> Brian
>
IQ is inherent, like personality. It has nothing to do with
learning/deprivation/TV.
KAC
--
Kenny A. Chaffin
KAC Website Design - http://www.kacweb.com
Custom/Contract Programming, Graphics, Design
Poetry Page: http://www.kacweb.com/poems/
------------------------------
Date: Tue, 06 Nov 2001 07:49:01 -0500
From: peter <peter_icaza@REMOVE2REPLYuhc.com>
Subject: Re: Best language for low IQ programmers?
Message-Id: <3BE7DC3D.2A2C2818@REMOVE2REPLYuhc.com>
for you, i suggest logo for a few years then move onto basic :)
------------------------------
Date: Tue, 06 Nov 2001 01:11:27 -0700
From: Dan Hinojosa <dhinojosa@qwest.net>
Subject: Re: Best language for low self-esteem programmers?
Message-Id: <3BE79B2F.4040805@qwest.net>
It's not the IQ, but the persistence that makes a programmer.
Brian Metc wrote:
> I would like to get into the programing field. My problem is that I have low IQ due to
> early childhool learning deprivation and TV overdose. Simply said I am stuped, I am
> pretty good amongst my friends, but not solving problems. You know what I
> mean. Anyways, I want to go into computor programing because of money
> issue. I now need to choose languege for programming, simple enough
> for me.
>
> My friend wh does C plus plus recommended that I learn either Visual Basic or Eiffel.
> My ex girlfriend who is a sys admin who did perl, sugested that I learn Ada because
> it has "serious type system" which is fool proof.
>
> She dis couraged me from using Eiffel because itr was a language going out of the
> market, no longer used by any serious corporation, She said the same thing for Ada.
>
> Java is simple compared to c plus plus but a scam language, based on hype.
>
> This only leaves visual basic. Especally because it is used under Windows, Microsoft
> stuff is always easier.
>
> Would any one sugest the best language for me.
>
> Brian
>
>
------------------------------
Date: Tue, 06 Nov 2001 09:51:14 +0100
From: Philip Newton <pne-news-20011106@newton.digitalspace.net>
Subject: Re: Can you help optimize this??
Message-Id: <068futc7ghb7vrgs33g6gf6l7kclg6290n@4ax.com>
On Mon, 05 Nov 2001 18:18:39 GMT, "Rob" <robsjobs@hotmail.com> wrote:
> I realize that index is a horrible function for speed.
Why do you think that?
I presume you mean "it's slow". Slow compared to what?
It should be faster than regular expressions since searching for
constant text is easier than for a regular expression.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Tue, 06 Nov 2001 13:43:23 GMT
From: "_Mario Latens" <mario.lat@libero.it>
Subject: DBI $dbh->prepare(q{SELECT .... }); question????
Message-Id: <20011106.143525.1662739668.2538@localhost.localdomain>
What does it means "q" in:
$dbh->prepare(q{SELECT .... });
I'm talking about DBI.
where can I get more informations about DBI functions?
I saw CPAN but I did not find nothing!
Thank you in advance, Mario.
------------------------------
Date: Tue, 06 Nov 2001 05:56:16 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: DBI $dbh->prepare(q{SELECT .... }); question????
Message-Id: <3BE7EC00.41AC1A32@vpservices.com>
_Mario Latens wrote:
>
> What does it means "q" in:
> $dbh->prepare(q{SELECT .... });
>
> I'm talking about DBI.
No you aren't. q{} is a perl quote operator covered in the perlop
manpage and is not specific to DBI in any way.
> where can I get more informations about DBI functions?
> I saw CPAN but I did not find nothing!
At http://dbi.perl.org/
--
Jeff
------------------------------
Date: Tue, 06 Nov 2001 19:10:35 +1100
From: gixxer6 <infullflight@22000rpm.com>
Subject: format() help! newbie question
Message-Id: <3be79a0b@news.iprimus.com.au>
Hi all,
I'm trying to convert a raw data file into a report and I'm having a bit of
problem with outputting the data in my desired format using the format
function.
I've checked the perlform manpage but that didn't really help.
My datafile contains sensitive information so I can't provide a real
sample so let's assume that my datafile looks like this:
AAAAAA AAAAAAAA AAAAAAAAA AAAAAAAA
HHHHH HHHHHHH HHHHHHHH HHHHHHH
JJJJJJJJ JJJJJJJJJJJ JJJJJJJJJJJJJ JJJJJJJJJJJ
JJJJJJJJ JJJJJJJJJJJ JJJJJJJJJJJJJ JJJJJJJJJJJ
KKKKKK KKKKKKKK KKKKKKKKK KKKKKKKK
AAAAAA AAAAAAAA AAAAAAAAA AAAAAAAA
AAAAAA AAAAAAAA AAAAAAAAA AAAAAAAA
HHHHH HHHHHHH HHHHHHHH HHHHHHH
JJJJJJJJ JJJJJJJJJJJ JJJJJJJJJJJJJ JJJJJJJJJJJ
JJJJJJJJ JJJJJJJJJJJ JJJJJJJJJJJJJ JJJJJJJJJJJ
KKKKKK KKKKKKKK KKKKKKKKK KKKKKKKK
AAAAAA AAAAAAAA AAAAAAAAA AAAAAAAA
The last field is a dollar amount which I keep a total of to print out at
the end.
I would like my report to print out in the following format:
NAME OF REPORT
DATE: dd-mm-yy
Field1 Field2 Field3 Field4
-------------------------------------------------------------------------------------------------------
List A:
AAAAAA AAAAAAAA AAAAAAAAA AAAAAAAA
AAAAAA AAAAAAAA AAAAAAAAA AAAAAAAA
AAAAAA AAAAAAAA AAAAAAAAA AAAAAAAA
AAAAAA AAAAAAAA AAAAAAAAA AAAAAAAA
TOTAL: AAAAAAAA
List B:
HHHHH HHHHHHH HHHHHHHH HHHHHHH
HHHHH HHHHHHH HHHHHHHH HHHHHHH
TOTAL: HHHHHHH
List C:
JJJJJJJJ JJJJJJJJJJJ JJJJJJJJJJJJJ JJJJJJJJJJJ
JJJJJJJJ JJJJJJJJJJJ JJJJJJJJJJJJJ JJJJJJJJJJJ
JJJJJJJJ JJJJJJJJJJJ JJJJJJJJJJJJJ JJJJJJJJJJJ
JJJJJJJJ JJJJJJJJJJJ JJJJJJJJJJJJJ JJJJJJJJJJJ
TOTAL: JJJJJJJJJJJ
List D:
KKKKKK KKKKKKKK KKKKKKKKK KKKKKKKK
KKKKKK KKKKKKKK KKKKKKKKK KKKKKKKK
TOTAL: KKKKKKKK
I've got everything worked out except for printing out the report. To
extract the data from the raw file, I use a while loop but I can't figure
out how to format it and where to call the write function from. If I put
the write function within the while loop, then it does not sort out the
data and it prints a running total after each line. Can the data being
read be stored 'somewhere' to be printed out later on??
Can someone please give me some ideas on how this can be achieved.
Thanks in advance
------------------------------
Date: 6 Nov 2001 00:16:58 -0800
From: weiwe1@yeah.net (hugh1)
Subject: helo :)
Message-Id: <7dcf30ba.0111060016.504c7da@posting.google.com>
CGI-perl , CGI.pm
print "Hi , @{[ $q->param( 'user' ) ]}! " ;
i not understand it .
------------------------------
Date: Tue, 06 Nov 2001 13:33:55 GMT
From: "Steve Grazzini" <s_grazzini@hotmail.com>
Subject: Re: helo :)
Message-Id: <7FRF7.40007$XA5.9356828@typhoon.nyc.rr.com>
"hugh1" <weiwe1@yeah.net> wrote in message
news:7dcf30ba.0111060016.504c7da@posting.google.com...
> CGI-perl , CGI.pm
>
> print "Hi , @{[ $q->param( 'user' ) ]}! " ;
>
> i not understand it .
# square brackets create an array reference
my $array_ref = [ $q->param( 'user' ) ];
# the '@{ }' syntax dereferences one
my @array = @{ $array_ref };
# and you can interpolate arrays into "" strings
print "Hi, @array!";
So if you put all three in one step, you can
interpolate the object method (or any other
expression) right into the string!
See 'perlref'
-Steve
------------------------------
Date: Tue, 6 Nov 2001 10:38:24 +0100
From: <harm.bouwman@mediasys.nl>
Subject: If statement in perl script not working!
Message-Id: <9s8b2l$9qn$1@news1.xs4all.nl>
Hello,
I try to write a script which checks if a user my open some html pages.
I have made a html form which passes $FORM{'username'} and
$FORM{'passoword'} trough to statement below after splitting the url. When
both username and password are ok, the first if statement functions ok. when
the username or password is not ok, then the second and thirth if statement
does working.
I used both numiric or string values' like 'eq' or '==', 'ne' or '!=', but
doesn't matter.
Does anybody now what's going wrong here!
Regards Harm
harm.bouwman@mediasys.nl <mailto:harm.bouwman@mediasys.nl>
---- Part of Script --------
sub check_user {
my $dbh = DBI->connect("DBI:mysql:${db}", "${user}", "${password}",(
{'RaiseError' => 1}));
my $sth = $dbh->prepare("${sql}");
$sth->execute();
while (my $field = $sth->fetchrow_hashref()) {
if ($FORM{'username'} eq my $field->{'username'} && $FORM{'password'} eq my
$field->{'password'} ) {
print"<html><head><title>Logon to sysadmin</title></head>\n";
print"<body><h3>Welcom $field->{'username'} <B>$FORM{'username'}</B> to
sysadmin of bouwman-online.com</h3>\n";
print "Return to the <a href=\"$sysadminnurl\">sysadmin</a>.";
print "\n</body></html>\n";
exit;
}
if ($FORM{'username'} ne my $field->{'username'} && $FORM{'password'} eg my
$field->{'password'}) {
print"<html><head><title>No username found!</title></head>\n";
print"<body><h3>User does not exist</h3>\n";
print "Return to the <a href=\"$sysadminnurl\">sysadmin</a>.";
print "\n</body></html>\n";
exit;
}
if ($FORM{'password'} ne my $field->{'password'} && $FORM{'username'} eq my
$field->{'username'} ) {
print"<html><head><title>Password incorrect!</title></head>\n";
print"<body><h3>Wrong password! Please try again.</h3>\n";
print "Return to the <a href=\"$sysadminnurl\">sysadmin</a>.";
print "\n</body></html>\n";
exit;
}
}
}
---- End Part of Script ----
------------------------------
Date: Tue, 6 Nov 2001 11:18:02 -0000
From: "W K" <bill.kemp@wire2.com>
Subject: Re: If statement in perl script not working!
Message-Id: <CHPF7.18$yw1.184@news.uk.colt.net>
<harm.bouwman@mediasys.nl> wrote in message
news:9s8b2l$9qn$1@news1.xs4all.nl...
> Hello,
>
> I try to write a script which checks if a user my open some html pages.
<...>
> if ($FORM{'username'} eq my $field->{'username'} && $FORM{'password'} eq
my
> $field->{'password'} ) {
<...>
I've not looked into this - but - what on earth are those 'my's supposed to
be doing?
------------------------------
Date: Tue, 06 Nov 2001 10:59:00 +0100
From: Eduardo Oliveros <eod_spam@yahoo.es>
To: harm.bouwman@mediasys.nl
Subject: Re: If statement in perl script not working!
Message-Id: <3BE7B464.AAB3A751@yahoo.es>
I have tried this in my perl, version 5.005_03 built for sun4-solaris
...if("hola" eq my $field->{name});
and I get the error:
Can't declare hash elem in my at ./bugmy.pl line 9, near "})"
try removing the "my" from the if sentence.
--edu
harm.bouwman@mediasys.nl wrote:
>
> if ($FORM{'username'} eq my $field->{'username'} && $FORM{'password'} eq my
> $field->{'password'} ) {
...
------------------------------
Date: Tue, 6 Nov 2001 22:17:21 +1000
From: "Gregory Toomey" <nobody@nowhere.com>
Subject: Re: If statement in perl script not working!
Message-Id: <HuQF7.130968$g8.82853@newsfeeds.bigpond.com>
<harm.bouwman@mediasys.nl> wrote in message
news:9s8b2l$9qn$1@news1.xs4all.nl...
> if ($FORM{'username'} ne my $field->{'username'} && $FORM{'password'} eg
my
Should eg be eq. This won't compile.
gtoomey
------------------------------
Date: Tue, 06 Nov 2001 13:54:12 GMT
From: "Steve Grazzini" <s_grazzini@hotmail.com>
Subject: Re: If statement in perl script not working!
Message-Id: <8YRF7.40009$XA5.9366044@typhoon.nyc.rr.com>
<harm.bouwman@mediasys.nl> wrote in message
news:9s8b2l$9qn$1@news1.xs4all.nl...
> Hello,
>
[ ..]
> I used both numiric or string values' like 'eq' or '==', 'ne' or '!=', but
> doesn't matter.
>
[..]
> while (my $field = $sth->fetchrow_hashref()) {
>
> if ($FORM{'username'} eq my $field->{'username'} && $FORM{'password'} eq
my
> $field->{'password'} ) {
[ ..code ]
> }
[..]
Use strict...
( Can't use an undefined value as a HASH reference )
And only use 'my $field' once--it goes in the while statement, where you
define $field--then 'eq' should work.
-Steve
------------------------------
Date: Tue, 6 Nov 2001 10:20:29 +0000 (UTC)
From: "csaba.raduly" <csaba.raduly@sophos.com>
Subject: Re: Leftmost SHORTEST
Message-Id: <OFAE7E5EE7.0BADB49D-ON80256AFC.0038A0DB@uk.sophos>
Google for "spool celestial" :
http://groups.google.com/groups?selm=Pine.GSO.3.96.970923072340.1200E-100000%40usertest.teleport.com&output=gplain
--
Csaba Ráduly, Software Engineer Sophos Anti-Virus
email: csaba.raduly@sophos.com http://www.sophos.com
US Support: +1 888 SOPHOS 9 UK Support: +44 1235 559933
--
Posted from viking.sophos.com [194.203.134.132]
via Mailgate.ORG Server - http://www.Mailgate.ORG
------------------------------
Date: Tue, 6 Nov 2001 10:08:07 +0100
From: "Anthony Heuveline" <Anthony.Heuveline@wanadoo.fr>
Subject: MySQL table detection
Message-Id: <9s8972$l2g$1@wanadoo.fr>
Hi,
Does anybody know how to detect if a table exists or not in a mySQL database
with perl?
Thanks.
Anthony.
------------------------------
Date: 6 Nov 2001 09:22:10 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: MySQL table detection
Message-Id: <slrn9ufauu.f7t.rgarciasuarez@rafael.kazibao.net>
Anthony Heuveline wrote in comp.lang.perl.misc:
>
> Does anybody know how to detect if a table exists or not in a mySQL database
> with perl?
You can issue the SHOW TABLES sql statement. This will return rows that
contain the table names. There's maybe a better method ; check out some
doc on MySQL language.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
perl -sleprint -- -_='Just another Perl hacker,'
------------------------------
Date: Tue, 6 Nov 2001 23:17:54 +1100
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: Naive Q: Why Java speed >> Perl speed?
Message-Id: <iwQF7.10$xS5.568432@news.interact.net.au>
"kj0" <kj0@mailcity.com> wrote in message
news:9s7ju3$kqj$3@news.panix.com...
>
> Why is it that, typically, the Java VM runs programs so much faster
> than the Perl interpreter?
Your proof?
------------------------------
Date: Tue, 06 Nov 2001 13:52:24 +0100
From: Edwin =?iso-8859-1?Q?G=FCnthner?= <edgue@web.de>
Subject: Re: Naive Q: Why Java speed >> Perl speed?
Message-Id: <3BE7DD08.88A408C@web.de>
kj0 wrote:
>
> Why is it that, typically, the Java VM runs programs so much faster
> than the Perl interpreter? Is it because of Java's strong typing? Or
> is it some other difference between the languages that accounts for
> this disparity?
First of I all: I think that might depend on the job that
is acutally done.
print "Hello world\n"; will be way faster than public class HelloWorld {
... }
But some blind guesses:
With Java there is SUN. SUN may have thoughts like this:
* we want people to buy our hardware
* we want that Java runs FAST on our hardware
(because a lot of people like java;
and if we can give them fast Java on our machines - they
will buy those machines)
* we want that Java runs FAST on other platforms too
(because Java is a big advantage when competing against Microsoft)
So, SUN pays a lot of money to a lot of very bright people to
make Java fast.
Dont get me wrong: I know that there are a lot of bright people
that work on the same item for Perl.
But that is not exactly the same as when a company like SUN
has a whole R&D department to work on goals like "we want to
ship the best JIT on the planet" and "we want to improve
our JIT every year by xx %".
I am wondering: how many people are in the "core perl team"?
How many people spend all their working time just with
"Perl speed concerns"? I assume that the numbers are simply
smaller compared to the corresponding departments from SUN or IBM
for example.
------------------------------
Date: Tue, 6 Nov 2001 14:28:46 +0530
From: "Narayanaswami B." <bnswami@india.hp.com>
Subject: Perl modules from a C Program
Message-Id: <9s88n7$b0o$1@pavan.india.hp.com>
This is a multi-part message in MIME format.
------=_NextPart_000_003A_01C166CF.585BA8F0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
Can anyone give me some ideas on how to call perl modules ( or how to=20
execute a perl script ) from a c program with some cmd line arguments to =
the perl script?
Thanks in advance
--=20
Best Regards-
Swami
-
------=_NextPart_000_003A_01C166CF.585BA8F0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4613.1700" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Can anyone give me some ideas on how to =
call perl=20
modules ( or how to </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>execute a perl script ) from a c =
program with some=20
cmd line arguments to the perl script?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thanks in advance</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>-- <BR>Best=20
Regards-<BR>Swami<BR>-</FONT></DIV></BODY></HTML>
------=_NextPart_000_003A_01C166CF.585BA8F0--
------------------------------
Date: Tue, 06 Nov 2001 09:24:20 +0000
From: Richard Heathfield <binary@eton.powernet.co.uk>
Subject: Re: Perl modules from a C Program
Message-Id: <3BE7AC44.601047AE@eton.powernet.co.uk>
> "Narayanaswami B." wrote:
>
> Hi,
> Can anyone give me some ideas on how to call perl modules ( or how to
> execute a perl script ) from a c program with some cmd line arguments
> to the perl script?
system("perl_script args go here");
--
Richard Heathfield : binary@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
------------------------------
Date: Tue, 06 Nov 2001 11:02:06 +0100
From: Eduardo Oliveros <eod_spam@yahoo.es>
To: "Narayanaswami B." <bnswami@india.hp.com>
Subject: Re: Perl modules from a C Program
Message-Id: <3BE7B51E.937F7889@yahoo.es>
why not:
#include <stdlib.h>
int system(const char *string);
--edu
"Narayanaswami B." wrote:
> Hi,Can anyone give me some ideas on how to call perl modules ( or how
> toexecute a perl script ) from a c program with some cmd line
> arguments to the perl script?Thanks in advance--
> Best Regards-
> Swami
> -
------------------------------
Date: 6 Nov 2001 03:41:22 -0800
From: realnewbie2000@yahoo.com (Real Newbie)
Subject: Problem with make while installing Perl 5.6.1 on Solaris 8
Message-Id: <a2b38b4d.0111060341.2574ceef@posting.google.com>
I have a Solaris 8 (Intel) box with the OS and gcc 3.0.1 installed.
When I used make (after the sh Configure -Dcc=gcc -Dprefix=/opt/perl
step), I got the foll messages:
# make
make: Warning: Both `makefile' and `Makefile' exist
`sh cflags libperl.a perl.o` perl.c
CCCMD = gcc -DPERL_CORE -c -fno-strict-aliasing
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O
Assembler: perl.c
"/var/tmp/ccOonZeT.s", line 4308 : Illegal mnemonic
"/var/tmp/ccOonZeT.s", line 4308 : Syntax error
*** Error code 1
make: Fatal error: Command failed for target `perl.o'
Has anyone installed with a sililar configuration and got this error ?
Rgds,
------------------------------
Date: Tue, 06 Nov 2001 12:29:51 +0100
From: "J.E.J. op den Brouw" <J.E.J.opdenBrouw@st.hhs.nl>
Subject: Question about file locking.
Message-Id: <3BE7C9AF.9068A690@st.hhs.nl>
Hi,
I've a question about flocking. In chapter 16 of Perl Programming 3RD
edition, there are some routines for file locking based on eval, alarm
and die. The trick is to let alarm break in to the flock after some
time and return a die. The die is then checked.
Seems nice, but I can't get it working. I have a workaround now of
using a variable and letting the die set it to some value, but I
cannot imagine the original code not working. Can anyone shine
a light on this? Code is appended. Also using same code but modified for
shared locks.
#!/usr/local/bin/perl
use strict;
use Fcntl qw(:DEFAULT :flock);
my $code = 0;
sysopen(FH, "/tmp/flock", O_WRONLY | O_CREAT)
or die "Cannot open file";
eval {
local $SIG{ALRM} = sub { $code = 1; die "alarm" };
alarm 10;
eval {
print "Trying to get lock...\n";
flock (FH, LOCK_EX)
or die "can't flock";
};
alarm 0;
};
alarm 0;
# Here $@ should be checked, but it doesn't work...
if ($code) {
print "Failed to get lock!\n";
} else {
print "Got lock!\n";
print "Sleeping....\n";
sleep(60);
}
close(FH);
--
--jesse
----------------------------------------------------------------------
J. op den brouw Johanna Westerdijkplein 75
Haagse Hogeschool 2521 EN DEN HAAG
Sector Techniek The Netherlands
Opleiding Elektrotechniek +31-70-4458936
----------------------------------------------------------------------
"Programmers are busy writing the next best idiot-proof software.
The universe, in the meantime, is busy making the best idiot.
The universe is winning"
-- Linux Journal
------------------------------
Date: 6 Nov 2001 00:26:14 -0800
From: weiwe1@yeah.net (hugh1)
Subject: question about perl-cgi
Message-Id: <7dcf30ba.0111060026.716baa3f@posting.google.com>
if cgi call another cgi. in perl i can use <> and CGI.pm's $q->param
get the parameters (POST).
but how can i transfer them to another cgi program ??
------------------------------
Date: Tue, 06 Nov 2001 14:45:27 +0100
From: Eduardo Oliveros <eod_spam@yahoo.es>
To: hugh1 <weiwe1@yeah.net>
Subject: Re: question about perl-cgi
Message-Id: <3BE7E977.C4B4CE88@yahoo.es>
a hint ...
The information is passed from the web server to the cgi by a environment
variable (QUERY_STRING perhaps)
You can try to set this variable with the new values.
--edu
hugh1 wrote:
> if cgi call another cgi. in perl i can use <> and CGI.pm's $q->param
> get the parameters (POST).
>
> but how can i transfer them to another cgi program ??
------------------------------
Date: 6 Nov 2001 08:22:55 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Scalar Context Automatically Provided to Function Argument?
Message-Id: <9s86kv$a4p$1@mamenchi.zrz.TU-Berlin.DE>
According to David Reiss <reiss_david@yahoo.com>:
> Can I design a function (subroutine) that will automatically provide
> scalar context to its argument? For example, how can I modify the
> definition of foo() in the following script so that "1" is printed?
>
> #!/usr/bin/perl -w
> use strict;
>
> sub foo {
> my $var = $_[0];
> print $var, "\n" ;
> }
>
> sub bar {
> return 1 unless wantarray ;
> return (2,3); # Only reached if wantarray is true.
> }
>
> foo(bar());
>
> __END__
>
> I don't want to have to write foo(scalar(bar)), but I can do another
> workaround if necessary. TIA.
Give foo a scalar prototype:
sub foo ($) { ...
For more about prototypes and their restrictions see perldoc perlsub.
Anno
------------------------------
Date: Tue, 06 Nov 2001 12:03:20 +0100
From: Eduardo Oliveros <eod_spam@yahoo.es>
To: David Reiss <reiss_david@yahoo.com>
Subject: Re: Scalar Context Automatically Provided to Function Argument?
Message-Id: <3BE7C378.4E9D46BD@yahoo.es>
I have found this way:
#!/usr/bin/perl -w
use strict;
sub foo ($) {
my $var = $_[0];
print $var, "\n" ;
}
sub bar {
return 1 unless wantarray ;
return (2,3); # Only reached if wantarray is true.
}
foo(bar());
just slightly different. :)
Regards,
--edu
David Reiss wrote:
> Can I design a function (subroutine) that will automatically provide
> scalar context to its argument? For example, how can I modify the
> definition of foo() in the following script so that "1" is printed?
>
> #!/usr/bin/perl -w
> use strict;
>
> sub foo {
> my $var = $_[0];
> print $var, "\n" ;
> }
>
> sub bar {
> return 1 unless wantarray ;
> return (2,3); # Only reached if wantarray is true.
> }
>
> foo(bar());
>
> __END__
>
> I don't want to have to write foo(scalar(bar)), but I can do another
> workaround if necessary. TIA.
------------------------------
Date: Tue, 6 Nov 2001 23:10:33 +1100
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: Sending Content Type in email
Message-Id: <qpQF7.9$eP5.482360@news.interact.net.au>
"Tassilo von Parseval" <tassilo.parseval@post.rwth-aachen.de> wrote in
message news:3BE73F7B.8030903@post.rwth-aachen.de...
> > I find it's much easier to just type "d", as in "delete".
>
>
> But no! You might just delete a HTMLized love-confession of a pleasant
> female human being.
And look where the "Love Bug" got us.
------------------------------
Date: Tue, 06 Nov 2001 14:52:39 +0100
From: Tassilo von Parseval <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: Sending Content Type in email
Message-Id: <3BE7EB27.8090903@post.rwth-aachen.de>
Tintin wrote:
> "Tassilo von Parseval" <tassilo.parseval@post.rwth-aachen.de> wrote in
>>But no! You might just delete a HTMLized love-confession of a pleasant
>>female human being.
>>
>
> And look where the "Love Bug" got us.
This wasn't send by a female (I presume).
Tassilo
--
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};
------------------------------
Date: Tue, 6 Nov 2001 11:50:02 -0800
From: "Dynamo" <robin1@otenet.gr>
Subject: Some very basic questions
Message-Id: <9s8c3d013mi@enews2.newsguy.com>
Hello,
Sorry if some of these questions seem very basic but I have searched the web
for answers and all the sites I have been to talk in technical jargon that I
do not understand being a total newbie. My server does not support FPE and
as such I have to use scripts to do some of the more fancy stuff with my
website. My preference would be to use pre written scripts but the write ups
talk of many security holes in the scripts and badly written scripts. So I
thought I would be bold and have a go at writing a script for myself.
I have downloaded activestate perl for win 32 which is waiting in the wings
in my temp directory but I am frightened to install it without understanding
(in simple laymans terms) what it will do to my system and how it will help
me.
Am I correct in saying that activestate perl is an environment (similar to a
shell) that will allow me to write commands using a simple text editor and
execute them at the prompt (similar to dos batch commands.)?
Since javascript and HTML can also be written in a text editor, and I only
want to use perl as a tool for my website, what advantages will I gain by
using perl instead of javascript or HTML.?
Do I really need activestate perl on MY machine if I am only going to write
scripts that will be executed on my ISP's machine (provided of course that I
read all the documentation :-))
Are perl compilers similar to web authoring software in that you tell it
what you want to do and it converts it to the HTML code for you, or are they
simply script editors that tell you where your coding has gone wrong and
debug it for you.
Thats about it for now. If he is asking questions like this "DONT DO IT!!" I
hear you shouting. Well I've gotta start somewhere.
Regards
Paul Robinson
------------------------------
Date: Tue, 06 Nov 2001 12:39:33 +0100
From: Edwin =?iso-8859-1?Q?G=FCnthner?= <edgue@web.de>
Subject: Re: Some very basic questions
Message-Id: <3BE7CBF5.5E80360@web.de>
Hi,
Dynamo wrote:
> Am I correct in saying that activestate perl is an environment (similar to a
> shell) that will allow me to write commands using a simple text editor and
> execute them at the prompt (similar to dos batch commands.)?
No. ActiveState-Perl is just an enhanced perl distribution. It will
bring
you the perl binaries and dlls. In addition it has a compiled version of
all the HTML documents that describe perl. It does not come with its
own shell or a special perl editor. [perl itself is an interpreter. you
start it to execute a perl script. thats it]
I had never problems with ActiveState perl. You install it, you
uninstall it ...
like any other good Windows software.
> Do I really need activestate perl on MY machine if I am only going to write
> scripts that will be executed on my ISP's machine (provided of course that I
> read all the documentation :-))
I assume you want to test your scripts, won't you? Thats easier if you
can do it on your own machine.
> Thats about it for now. If he is asking questions like this "DONT DO IT!!" I
> hear you shouting. Well I've gotta start somewhere.
Well, the best point to start is usually to first scan a group before
posting to it. Then you would see that there is a lot of documentation
available.
Have a look at:
- http://www.perldoc.com/
- http://www.perldoc.com/perl5.6.1/pod/perlfaq.html
- http://learn.perl.org/
Your other questions are very basic. It doesnt make much sense
to answer them here because the answers are available on the above web
sites.
regards,
eg
------------------------------
Date: Tue, 6 Nov 2001 23:31:41 +1100
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: Some very basic questions
Message-Id: <dJQF7.11$oQ5.542785@news.interact.net.au>
"Dynamo" <robin1@otenet.gr> wrote in message
news:9s8c3d013mi@enews2.newsguy.com...
> Hello,
>
> Sorry if some of these questions seem very basic but I have searched the
web
> for answers and all the sites I have been to talk in technical jargon that
I
> do not understand being a total newbie. My server does not support FPE and
> as such I have to use scripts to do some of the more fancy stuff with my
> website. My preference would be to use pre written scripts but the write
ups
> talk of many security holes in the scripts and badly written scripts. So I
> thought I would be bold and have a go at writing a script for myself.
>
> I have downloaded activestate perl for win 32 which is waiting in the
wings
> in my temp directory but I am frightened to install it without
understanding
> (in simple laymans terms) what it will do to my system and how it will
help
> me.
There's nothing to be frightened of. It just installs on your system very
much like any other software (and can be removed in the same way).
>
> Am I correct in saying that activestate perl is an environment (similar to
a
> shell) that will allow me to write commands using a simple text editor and
> execute them at the prompt (similar to dos batch commands.)?
Easiest to think of Perl as scripting language. You write Perl code in a
text editor and then run your script.
>
> Since javascript and HTML can also be written in a text editor, and I only
> want to use perl as a tool for my website, what advantages will I gain by
> using perl instead of javascript or HTML.?
Perl, Javascript and HTML are three different things. Javascript is
(mostly) a scripting language to run client side in your browser. HTML is
just a markup language, not a programming language.
>
> Do I really need activestate perl on MY machine if I am only going to
write
> scripts that will be executed on my ISP's machine (provided of course that
I
> read all the documentation :-))
You don't, but it sure makes development and debugging much, much easier.
>
> Are perl compilers similar to web authoring software in that you tell it
> what you want to do and it converts it to the HTML code for you, or are
they
> simply script editors that tell you where your coding has gone wrong and
> debug it for you.
Best not to think of a perl compiler (at this stage), think of it as an
interpreter. The perl binary is the interpreter that interprets your Perl
code and executes it.
------------------------------
Date: Tue, 06 Nov 2001 09:28:50 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: sorry !
Message-Id: <m3OF7.3338$Le.81375@sea-read.news.verio.net>
In article <7dcf30ba.0111051633.7c473fd6@posting.google.com>,
hugh1 <weiwe1@yeah.net> wrote:
> i want to know in perl programing how should call one cgi program which
>maybe complied with C or some other languages.
> how can i trans argv to it!!
First of all, CGI programs do not call CGI programs.
Browsers invoke CGI programs.
Therefore, you want CGI program #1 to act like a browser in order to
invoke CGI program #2.
Go to http://search.cpan.org and search for LWP.
Either LWP::UserAgent or LWP::Simple should meet your needs.
-Joe
P.S. If CGI program #2 is on the same server as CGI program #1,
you may be able to use $_=`/dir/prog2.cgi arg1 arg2` instead.
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 2076
***************************************