[13223] in Perl-Users-Digest
Perl-Users Digest, Issue: 633 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 24 20:07:39 1999
Date: Tue, 24 Aug 1999 17:05:13 -0700 (PDT)
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, 24 Aug 1999 Volume: 9 Number: 633
Today's topics:
Archive::Tar <admin3@teleport.com>
Re: Briles' Law (elephant)
Re: Briles' Law <cassell@mail.cor.epa.gov>
Computing n.th root of a given number marcza@my-deja.com
Re: Computing n.th root of a given number <cassell@mail.cor.epa.gov>
Re: Computing n.th root of a given number <cassell@mail.cor.epa.gov>
Re: Desperately searching for perl lint <johan.schon@capgemini.se>
Re: Extracting Data From HTML <cassell@mail.cor.epa.gov>
Re: filtering files on opendir / readdir (Martien Verbruggen)
Re: Flash & Perl or CGI? (elephant)
how to setuid? <edwardv@jps.net>
I have a fork() problem... <baal@c2i.net>
Re: I have a fork() problem... <cassell@mail.cor.epa.gov>
Re: I have a fork() problem... (Gyepi SAM)
Re: I have a fork() problem... (elephant)
my() vs. local() marcza@my-deja.com
Re: my() vs. local() (elephant)
Re: my() vs. local() <cassell@mail.cor.epa.gov>
Re: my() vs. local() <vmurphy@gamora.ndhm.gtegsc.com>
Re: newbi: Registry Help under NT (elephant)
Re: output format (Martien Verbruggen)
Re: PERL & EXCEL <cassell@mail.cor.epa.gov>
perl Ad <One.Bored.Guru........@p0.f1.n30.z30.fidonet.org>
perlcc <new_conclusions@bigfoot.com>
Re: POP is pooped! <flavell@mail.cern.ch>
Re: Problem processing form variables in CGI (elephant)
Re: textarea problem <cassell@mail.cor.epa.gov>
Thanks for the quick Reply. 1 Other question - Limitati <pdobbs@home.com>
Re: Thanks for the quick Reply. 1 Other question - Limi <cassell@mail.cor.epa.gov>
Re: Why use Perl when we've got Python?! <xah@best.com>
Re: Why use Perl when we've got Python?! (Moritz Moeller-Herrmann)
Re: Win32::ODBC and Sql <rasmus@remove-this_byggeinfo.dk>
Re: Win32::ODBC and Sql <kangas@anlon.com>
Re: Win32::ODBC and Sql <cassell@mail.cor.epa.gov>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 24 Aug 1999 16:11:35 -0700
From: Teleport Admin--Jereme <admin3@teleport.com>
Subject: Archive::Tar
Message-Id: <Pine.GSO.4.10.9908241607370.16864-100000@eng1.teleport.com>
I am trying to use the Archive::Tar PM to backup the database on our
listserver. I am having problems getting Archive::Tar to work. here is
what I have:
use Archive::Tar;
sub backup{
# if(&is_running){
# print "Lyris is currently running, so a backup cannot be
performed!\n";
# return(1);
# }else{
if(Archive::Tar->create_archive ("$backup_dir/$backup_filename",
9, "/opt/lyris")){
print "Lyris backup completed.\n";
return(0);
}else{
print "Lyris backup failed! $!\n";
return(1);
}
# }
}
The other part that is commented out is a sub looking like:
sub is_running{
open(PID, "/etc/lyris.pid") or die "Could not open Lyris PID file!\n";
chomp($pid = <PID>);
if($is_running = kill -0, $pid){
return(1);
}else{
return(0);
}
}
The problem I am running into is with Archive::Tar.. I get:
Lyris backup failed! Illegal seek
This is on a Solaris 7 box.. Any ideas?
Jereme Claussen | T E L E P O R T I N T E R N E T |
System Administrator I | #1 in the Northwest! |
admin3@teleport.com | http://www.teleport.com/ |
503.223.0076x259 | 503.223.4245/888.223.4245 |
------------------------------
Date: Wed, 25 Aug 1999 09:25:18 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Briles' Law
Message-Id: <MPG.122dd4e5ddf0e169989c7b@news-server>
Tom Briles writes ..
>The quality of questions and answers in c.l.p.misc is inversely
>proportional to the number of Perl programmers attending conferences.
I suspect that it makes no difference to the quality of the questions at
all
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: Tue, 24 Aug 1999 16:33:47 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Briles' Law
Message-Id: <37C32BDB.D7BC0A0F@mail.cor.epa.gov>
Tom Briles wrote:
>
> The quality of questions and answers in c.l.p.misc is inversely
> proportional to the number of Perl programmers attending conferences.
>
> - Tom
The questions don't change. Only the quality of the responders.
Which today would be me instead of TomC and Larry R, I suppose. :-)
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Tue, 24 Aug 1999 22:36:07 GMT
From: marcza@my-deja.com
Subject: Computing n.th root of a given number
Message-Id: <7pv6ol$l8m$1@nnrp1.deja.com>
Given is a integer number n say n=11.
I am searching the lowest integer number x which is
taken as power(2) greater equal that this number n. Read:
n <= 2**x with min x && x = integer
example
11 <= 2**x => x = 4
mathematically the solution should be something like
roundup(ln(n)/ln(2))
But what is the most efficient way to compute the solution ?
Bye
Marcus
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 24 Aug 1999 16:41:58 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Computing n.th root of a given number
Message-Id: <37C32DC6.24F5EE41@mail.cor.epa.gov>
marcza@my-deja.com wrote:
>
> Given is a integer number n say n=11.
> I am searching the lowest integer number x which is
> taken as power(2) greater equal that this number n. Read:
>
> n <= 2**x with min x && x = integer
>
> example
> 11 <= 2**x => x = 4
>
> mathematically the solution should be something like
> roundup(ln(n)/ln(2))
>
> But what is the most efficient way to compute the solution ?
>
> Bye
>
> Marcus
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
--
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Tue, 24 Aug 1999 16:48:22 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Computing n.th root of a given number
Message-Id: <37C32F46.C76E83FE@mail.cor.epa.gov>
marcza@my-deja.com wrote:
>
> Given is a integer number n say n=11.
> I am searching the lowest integer number x which is
> taken as power(2) greater equal that this number n. Read:
>
> n <= 2**x with min x && x = integer
>
> example
> 11 <= 2**x => x = 4
>
> mathematically the solution should be something like
> roundup(ln(n)/ln(2))
>
> But what is the most efficient way to compute the solution ?
Well, you can
use POSIX;
to get the ceil() function.
$x = ceil( log($n)/log(2) );
Before you try doing this as int(...) + 1
consider how you'd handle the case where $n==1024 so you
don't go up to the next integer.
If you're going to be doing this a *lot*, you'll probably
want to pre-compute the value of log(2) so you don't
compute it a few million times in your program.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 25 Aug 1999 00:52:04 +0200
From: "johan schoen" <johan.schon@capgemini.se>
Subject: Re: Desperately searching for perl lint
Message-Id: <7pv7g5$lgc$1@news.capgemini.se>
I suggest the -w switch!
# schoen
T. Alex Beamish wrote in message
<37c29f88.141743940@news1.on.sympatico.ca>...
>Hello,
>
[DELETED]
>
>Since moving over to perl a year ago I've tried to follow the same
>practices, but I do not see a perl lint anywhere. Before I attempt to
>write one myself (in perl, naturally), is there a tool that anyone can
>suggest?
>
>Thanks so much.
>
>
>T. Alex Beamish, Principal -- TAB Software
> Toronto, Ontario -- www.tabsoft.on.ca
------------------------------
Date: Tue, 24 Aug 1999 16:23:50 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Extracting Data From HTML
Message-Id: <37C32986.278D4294@mail.cor.epa.gov>
wired2000@my-deja.com wrote:
>
> Hello,
>
> Quick question. I have a line of HTML code like this:
> <tr><td><a
> href=http://www.secapl.com/secapl/quoteserver/glossary.html#last>Last
> Traded at</a></td><td align=right><strong>39.1250</strong></td><td><a
> href=http://www.secapl.com/secapl/quoteserver/glossary.html#datetime>Dat
> e/Time</a></td><td
> align=right>1999/08/24 15:47:00</td></tr>
>
> How abouts can I exptract the date/time and the stock price and store
> them into variables? (Note: Stock price must be recognized as digits,
> not text)
In Perl that's not a problem. It converts back and forth
for you automagically.
> My idea was to grab this line, so a search and replace on all the text
> around it, that could work, but not exactly since there's 2 unknowns on
> the same line (time/date and stock price). Isn't there any easy way to
> grab the value between <strong> and the time/date like that?
You might want to try using the HTML::Parser module instead.
General HTML is too complex for a simple regex, because of
all the arbitrary nesting of symbols which can occur. Some of
the potential pitfalls are discussed in the FAQ.
Alternatively, you could start with Tom Christiansen's
striphtml program available at CPAN.
If you can guarantee that the HTML will always be exactly
as listed above, with no new tags or comments interjected,
then you can write a regex which will grab both values at
the same time. Read up on regexen in the 'perlre' page,
paying carefully attention to what parentheses do, and how
to use the variables $1 and $2 .
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 25 Aug 1999 00:00:24 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: filtering files on opendir / readdir
Message-Id: <smGw3.2578$hf4.4677@nsw.nnrp.telstra.net>
In article <slrn7s62dj.l1t.eric@plum.fruitcom.com>,
eric@fruitcom.com (Eric Smith) writes:
>
> Hi is it possible to filter for say .csv files at the opendir or readdir
> level or does one have to do this as a seperate statement.
Maybe you should read the documentation on these functions.
# perldoc -f readdir
[snip]
@dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR);
[snip]
The 'grep' in there is what you want.
# perldoc -f grep
Martien
--
Martien Verbruggen |
Interactive Media Division | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd. | again. Then quit; there's no use being
NSW, Australia | a damn fool about it.
------------------------------
Date: Wed, 25 Aug 1999 08:28:27 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Flash & Perl or CGI?
Message-Id: <MPG.122dc7997596fb35989c78@news-server>
Kent Delcastillo writes ..
>Has anyone done anything trying to combine the two?
Flash4 enables the markup and submission of thr typical form fields ..
you submit it to a standard CGI script .. which could be written in Perl
or any other language
this has nothing to do with Perl
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: Tue, 24 Aug 1999 16:43:09 -0700
From: "Edward Villalovoz" <edwardv@jps.net>
Subject: how to setuid?
Message-Id: <37c32e6b@news1.jps.net>
Hi,
Can anyone show me how to do a simple setuid in a perl script? I've read
the perlsec but I'm not sure how to code it. I just need to change the
setuid from 0,(root), to say user "X" uid 2000. Thanks for the help.
------------------------------
Date: Tue, 24 Aug 1999 22:10:20 GMT
From: "[L] Vicious!" <baal@c2i.net>
Subject: I have a fork() problem...
Message-Id: <gLEw3.2505$nd.175029@juliett.dax.net>
I have a fork problem...
I am running Win98 with the latest ActiveState Perl
use Tk;
use POSIX; ### Do I need this?
sub func {
$pid = fork();
if ($pid == 0) {
print "child";
exit 0;
} else {
print "parent";
}
}
and I get this errormessage:
Tk::Error: The Unsupported function fork function is unimplemented at
searchw.pl line 75
Is this a Tk error? If I need to "implement" the fork function, how do I do
that?
Have I used the fork function wrong?
Thnx 4 great response on my previous posts!
------------------------------
Date: Tue, 24 Aug 1999 16:37:51 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: I have a fork() problem...
Message-Id: <37C32CCF.8F253451@mail.cor.epa.gov>
[L] Vicious! wrote:
>
> I have a fork problem...
> I am running Win98 with the latest ActiveState Perl
>
> use Tk;
> use POSIX; ### Do I need this?
You don't need the POSIX module for the snippet of code
shown below. But you do need an OS. Win32 does not support
fork() . Not even NT. ActiveState is currently working
on a solution to the problem, which sounds like they're
going to use threads to fake the fork-and-exec model of
unix. [Believe it or not, Microsoft is paying them to do
this.] Until then, your code will not run.
> sub func {
> $pid = fork();
[snip]
> Is this a Tk error? If I need to "implement" the fork function, how do I do
> that?
> Have I used the fork function wrong?
No, it is not a Tk error. And your code looks okay. It
just won't run on win32. Yet...
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Tue, 24 Aug 1999 19:40:28 -0400
From: gyepi@magnetic.praxis-sw.com (Gyepi SAM)
Subject: Re: I have a fork() problem...
Message-Id: <slrn7s6c3r.qcs.gyepi@magnetic.praxis-sw.com>
On Tue, 24 Aug 1999 22:10:20 GMT, [L] Vicious! <baal@c2i.net> wrote:
>I have a fork problem...
>I am running Win98 with the latest ActiveState Perl
>and I get this errormessage:
>
>Tk::Error: The Unsupported function fork function is unimplemented at
>searchw.pl line 75
>
>Is this a Tk error?
No.
>If I need to "implement" the fork function, how do I do that?
You'll have to hack the kernel to implement fork on Windows. What,
you don't have the sources, you say? Well, can't help you there.
Windows does not have fork.
You might want to investigate its poor imitation, CreateProcess.
--
Gyepi Sam --+-- Designer/Programmer --+-- Network/System Administrator
gyepi@praxis-sw.com --+-- http://www.praxis-sw.com/gyepi
we: The single most important word in the world.
------------------------------
Date: Wed, 25 Aug 1999 09:38:53 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: I have a fork() problem...
Message-Id: <MPG.122dd81a48ab45e6989c7d@news-server>
[L] Vicious! writes ..
>I have a fork problem...
>I am running Win98 with the latest ActiveState Perl
>
>use Tk;
>use POSIX; ### Do I need this?
>
>sub func {
> $pid = fork();
> if ($pid == 0) {
> print "child";
> exit 0;
> } else {
> print "parent";
> }
>}
>
>and I get this errormessage:
>
>Tk::Error: The Unsupported function fork function is unimplemented at
>searchw.pl line 75
no .. the error is that you're trying to use fork() on a Win32 platform
.. if you're use ActiveState's port of Perl then you'll have their
documentation .. read perlwin32faq5 ("Quirks" on the table of contents)
.. specifically the section entitled "Certain functions don't seem to
work on Perl for Win32."
>Is this a Tk error? If I need to "implement" the fork function, how do I do
>that?
try Win32::Process .. also included with the standard ActiveState port
>Have I used the fork function wrong?
yep .. you used it at all on Win32 .. it's unimplemented (hey - that's
exactly what that error said)
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: Tue, 24 Aug 1999 22:47:38 GMT
From: marcza@my-deja.com
Subject: my() vs. local()
Message-Id: <7pv7e6$ln9$1@nnrp1.deja.com>
What is the difference between a variable declaration with
my() and with local(). Shouldn't it be the same ?
Bye
Marcus
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 25 Aug 1999 09:31:01 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: my() vs. local()
Message-Id: <MPG.122dd63d54bffb92989c7c@news-server>
marcza@my-deja.com writes ..
>What is the difference between a variable declaration with
>my() and with local(). Shouldn't it be the same ?
hee hee .. yeah .. that's actually what TMTOWTDI means .. it means that
a whole heap of Perl syntax is completely redundant .. you're not in
Kansas anymore Toto
read the documentation .. start with the FAQ
perldoc -q "local.*my"
and move on to
perldoc perlsub
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: Tue, 24 Aug 1999 16:54:52 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: my() vs. local()
Message-Id: <37C330CC.47C494B2@mail.cor.epa.gov>
marcza@my-deja.com wrote:
>
> What is the difference between a variable declaration with
> my() and with local(). Shouldn't it be the same ?
There is a big difference. In fact, there are *several*
big differences. my() declares variables to be lexically
scoped. my()'ed variables do not appear in the symbol table.
You can't my() a global var like $/ , nor can you my() a
typeglob like *FILEHANDLE . Dynamic variables created with
local() are not concealed from outside the scope, as are
variables declared with my(). This makes a huge difference
in subroutines and modules.
For more info, read the perlsub manpage:
perldoc perlsub
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Tue, 24 Aug 1999 23:57:41 GMT
From: Vincent Murphy <vmurphy@gamora.ndhm.gtegsc.com>
Subject: Re: my() vs. local()
Message-Id: <xjgaergg2a3.fsf@gamora.ndhm.gtegsc.com>
>>>>> "jason" == jason <elephant@squirrelgroup.com> writes:
jason> marcza@my-deja.com writes ..
>> What is the difference between a variable declaration with
>> my() and with local(). Shouldn't it be the same ?
jason> hee hee .. yeah .. that's actually what TMTOWTDI means .. it means that
jason> a whole heap of Perl syntax is completely redundant .. you're not in
jason> Kansas anymore Toto
From Jeffrey Friedl's _Mastering Regular Expression_ explained it best for
me.
Normal Perl:
{
local($SomeVar); # save copy
$SomeVar = 'My Value';
:
:
}
Equivalent Meaning:
my $TempCopy = $SomeVar;
$SomeVar = undef;
$SomeVar = 'My Value';
:
:
$SomeVar = $TempCopy;
}
You can also use local with $/. Best run in a subroutine - or if you post
it to this news group, Larry from HP will get mad. :-)
Something like:
foreach my $patch_file ( @files ) {
my $file = "$mail_dir/$patch_file";
local $/;
undef $/;
# slurp in whole file.
open( MAIL, "<$file" ) || die "can't open $file: \n";
:
:
}
jason> read the documentation .. start with the FAQ
jason> perldoc -q "local.*my"
Not in 5.004. Some people actually have to live in the past. :-(
--
Vinny
------------------------------
Date: Wed, 25 Aug 1999 09:02:31 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: newbi: Registry Help under NT
Message-Id: <MPG.122dcf8eb702208d989c79@news-server>
[ item posted to comp.lang.perl.misc and CCed to Andrew C. Holmes ]
Andrew C. Holmes writes ..
>I am trying to extract a value from an NT Server registry.
>When I run this I get "Query: Cannot create a file when that file already
>exists."
>Obviously the QueryValue is failing, but why. any ideas anybody???
my recommendation is to use Win32::TieRegistry instead of
Win32::Registry .. IMHO it's neater / easier / better
failing that - if you really want to pursue with Win32::Registry then
get Jenda's patch for Win32::Registry from her web site
http://Jenda.Krynicky.cz/
because even though I still believe that even patched TieRegistry kicks
its buttocks - it's certainly a big improvement over the standard
Win32::Registry .. and most importantly it has documentation
which will tell you
"
GetValue
$value = $obj->GetValue("value name")
$obj->GetValue("value name",$value)
This is what Query value should be. It returns the named value
from the current key, instead of the default value of the
named subkey.
You should never use QueryValue, it's present only for
backwards compatibility with Win3.x.
"
amongst other gems .. if you're still having problems after you've read
the documentation and you ask nicely then someone will probably help you
on the Win32-Perl-Users mailing list (see the Support section of
www.activestate.com for more details)
but - once you've read the documentation - you will understand
completely .. in any case - it's better to use TieRegistry
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: Wed, 25 Aug 1999 00:03:46 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: output format
Message-Id: <CpGw3.2581$hf4.4677@nsw.nnrp.telstra.net>
[Trimmed nonsensical alt.perl group. I wish news admins would stop
feeding it]
In article <Pine.LNX.4.10.9908241446250.18363-100000@server.1011tenn.net>,
Dean Wilson <deano@server.1011tenn.net> writes:
>
> I'd like to write a program that outputs information to
> STDOUT, but instead of scrolling the text upward, I'd like it to replace
> current text.
Have a look at the Curses module, available from CPAN;
http://www.perl.com/CPAN
Martien
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | Can't say that it is, 'cause it ain't.
NSW, Australia |
------------------------------
Date: Tue, 24 Aug 1999 16:32:02 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: PERL & EXCEL
Message-Id: <37C32B72.1B0E3F7D@mail.cor.epa.gov>
Michael Hill wrote:
>
> Will this run in unix or is this only for dos versin of perl?
>
> Mike
>
> Eduard Wulff wrote:
[snip of code]
> > use Win32::OLE;
> > use Win32::OLE::Const 'Microsoft Excel';
[more snippage]
This uses OLE and a functional copy of M$ Excel, so it will
only work on a win32 system.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Tue, 24 Aug 1999 15:55:01
From: "One Bored Guru " <One.Bored.Guru........@p0.f1.n30.z30.fidonet.org>
Subject: perl Ad
Message-Id: <000023db@madnet.net>
Attention Perl-5/Linux Programmers.
The Sync3 Developement Team is looking for Perl-5/Linux programmers
to help on an open source project writing a new type of bbs designed
for Linux and The Internet. If you think you have the skill and are
interested, please send email to devteam[at]sync3.com indicating your
interest and providing us with the relevant details pertaining to
your skill level and previous experience. Thank you for your time
and interest.
Steve Byers,
Project Administrator,
The Sync3 Project.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ The Talamasca Internet Newsgroup Gateway +
telnet://talamasca-bbs.com
------------------------------
Date: Tue, 24 Aug 1999 13:25:05 -1000
From: Govind Shridhare <new_conclusions@bigfoot.com>
Subject: perlcc
Message-Id: <37C329D1.E0C4BFF7@bigfoot.com>
This is a multi-part message in MIME format.
--------------757C5BBED3CAA73961A75C9C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi Folks
I have 5.005_03 on my machine...
Where do I get the latest copy of perlcc (compiler front end for Perl)?
I tried to compile this simple script
-----------------------------------------
#!/usr/bin/perl
use strict;
use CGI;
my $query = new CGI;
print "test\n";
----------------------------------------
--------------------------------------------------------------------------------Compiling
test.p:
--------------------------------------------------------------------------------Making
C(test.p.c) for test.p!
perl -I/usr/lib/perl5/5.00503/i386-linux -I/usr/lib/perl5/5.00503
-I/usr/lib/perl5/site_perl/5.005/i386-linux
-I/usr/lib/perl5/site_perl/5.005 -I. -MO=CC,-otest.p.c test.p
test.p syntax OK
MultipartBuffer has method DESTROY: -uMultipartBuffer assumed
CGI has method new: -uCGI assumed
substcont: op = LOGOP (0x82bbbb8) pp_substcont, pmop = PMOP (0x82bb960)
pp_substpmopsym = (OP*)&pmop_list[19]
substcont: op = LOGOP (0x82bb020) pp_substcont, pmop = PMOP (0x82bad58)
pp_substpmopsym = (OP*)&pmop_list[21]
Compiling C(test) for test.p!
perl -I/usr/lib/perl5/5.00503/i386-linux -I/usr/lib/perl5/5.00503
-I/usr/lib/perl5/site_perl/5.005/i386-linux
-I/usr/lib/perl5/site_perl/5.005 -I. /tmp/test.p.tst
cc -Dbool=char -DHAS_BOOL -I/usr/local/include -O2
-I/usr/lib/perl5/5.00503/i386-linux/CORE
/usr/lib/perl5/5.00503/i386-linux/auto/Fcntl/Fcntl.so -o test test.p.c
-L/usr/local/lib -L/usr/lib/perl5/5.00503/i386-linux/CORE -lperl -lnsl
-lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
test.p.c:2696: warning: initialization from incompatible pointer type
test.p.c:2697: warning: initialization from incompatible pointer type
test.p.c:2698: warning: initialization from incompatible pointer type
test.p.c:2699: warning: initialization from incompatible pointer type
test.p.c:2700: warning: initialization from incompatible pointer type
test.p.c:2701: warning: initialization from incompatible pointer type
test.p.c:2702: warning: initialization from incompatible pointer type
test.p.c:2703: warning: initialization from incompatible pointer type
test.p.c:2704: warning: initialization from incompatible pointer type
test.p.c:2705: warning: initialization from incompatible pointer type
test.p.c:2706: warning: initialization from incompatible pointer type
test.p.c:2707: warning: initialization from incompatible pointer type
When I ran ./test, I got the following error...
./test
Undefined subroutine CGI::read_from_cmdline
How do I solve this problems...
Many thanks in advance.
Govind
--------------757C5BBED3CAA73961A75C9C
Content-Type: text/x-vcard; charset=us-ascii;
name="new_conclusions.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Govind Shridhare
Content-Disposition: attachment;
filename="new_conclusions.vcf"
begin:vcard
n:Shridhare;Govind
x-mozilla-html:FALSE
org:MediaBreeze
adr:;;;;;;
version:2.1
email;internet:Govind@MediaBreeze.com
note;quoted-printable:If you are not living on the edge, you are taking up too much space!=0D=0ASri Sri Ravi Shankar
x-mozilla-cpt:;25920
fn:Govind Shridhare
end:vcard
--------------757C5BBED3CAA73961A75C9C--
------------------------------
Date: Wed, 25 Aug 1999 00:02:27 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: POP is pooped!
Message-Id: <Pine.HPP.3.95a.990824235429.7670A-100000@hpplus03.cern.ch>
On 24 Aug 1999, Randal L. Schwartz wrote:
> Well, I think the chance of those numbers changing is pretty small.
Yessir, you may well be right; but there are other reasons for using
symbolic representations. Suppose - just for example - one wanted to
find all the places in your techniques code where you used a particular
kind of lock. One can hardly go searching for all occurrences of "2",
but one _could_ search for the appropriate symbolic value.
> Then again, that's how I got into trouble on chat2.pl. :)
;-)
all the best
------------------------------
Date: Wed, 25 Aug 1999 09:24:17 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Problem processing form variables in CGI
Message-Id: <MPG.122dd4a82554a644989c7a@news-server>
siafhir2@my-deja.com writes ..
>Does anyone know how to fix this problem?
yeah .. we know exactly how to fix that problem .. of course - no one
can know how you'll fix this problem until we can see what your code
looks like
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: Tue, 24 Aug 1999 16:30:16 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: textarea problem
Message-Id: <37C32B08.45E6E0EA@mail.cor.epa.gov>
Blair Heuer wrote:
>
> I have a script that opens a text file, and then puts that text file into a
> list with this code:
>
> open(FILE,"$in{'loc'}\\$in{'current'}"); #
> "$in{'loc'}\\$in{'current'}" is the location of the file.
You really ought to check the return value on any open(). And
inside Perl you can use forward slashes in there, even on
win32 systems.
open(FILE,"$in{'loc'}/$in{'current'}") or die "Can't open: $!\n";
> @file = <FILE>;
This is reaosnable if FILE is never large, but you will
often want to do this line-by-line instead.
> close FILE;
And you ought to check the return here too.
As well as on the open() and close() below.
> chomp @file;
>
> Then that is put into the textarea in the html file like so, which shows up
> just as it is in the file:
>
> <textarea>@file</textarea>
>
> Then when saved, the returned input is stored like so:
>
> open(FILE,">$in{'loc'}\\$in{'current'}");
> truncate(FILE, 0);
The truncate isn't needed. You open()ed the file for
write-only, so it gets over-written.
> print FILE "@file";
print FILE @file;
> close FILE;
Putting unneeded quotes around variables isn't a good idea.
Here, putting quotes around an array in a print() statement
causes spaces to be inserted between elements (which here are
your lines).
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Tue, 24 Aug 1999 23:09:14 GMT
From: Paul Dobbs <pdobbs@home.com>
Subject: Thanks for the quick Reply. 1 Other question - Limitations?
Message-Id: <37C3282D.255CBAC0@home.com>
> If someone has an explanation that really made it clear for
> them and think it will help here please feel free to share.
Thanks very much to each of you for the help with that. I
also found through another posting in here an excellent site
for cleaning the mind-block on such things.. its a very
basic intro to Perl, but hey, sometimes its best to get as
basic as you can if you really want to absorb this stuff..
:) The site is
http://www.netcat.co.uk/rob/perl/win32perltut.html
I don't recall who posted it, but thank-you.
Now just one thing I'm curious about - limitations.
What are the specific limits perl has for things like
maximum array size,
string length, and such? I want to be sure I don't overflow
a variable
like a string by making it too long with some of what I'm
doing (which at
the moment, is taking a string, ripping it up a little, then
tying it back
together with new stuff added in). The string might get as
large as 30 or 40K
I guess.. can Perl handle that in one variable?
------------------------------
Date: Tue, 24 Aug 1999 16:59:37 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Thanks for the quick Reply. 1 Other question - Limitations?
Message-Id: <37C331E9.41CBE207@mail.cor.epa.gov>
Paul Dobbs wrote:
[snip]
> Thanks very much to each of you for the help with that. I
> also found through another posting in here an excellent site
> for cleaning the mind-block on such things.. its a very
> basic intro to Perl, but hey, sometimes its best to get as
> basic as you can if you really want to absorb this stuff..
> :) The site is
> http://www.netcat.co.uk/rob/perl/win32perltut.html
>
> I don't recall who posted it, but thank-you.
You're welcome.
> Now just one thing I'm curious about - limitations.
> What are the specific limits perl has for things like
> maximum array size,
Available memory.
> string length,
Available memory.
> and such? I want to be sure I don't overflow
> a variable
> like a string by making it too long with some of what I'm
> doing (which at
> the moment, is taking a string, ripping it up a little, then
> tying it back
> together with new stuff added in). The string might get as
> large as 30 or 40K
> I guess.. can Perl handle that in one variable?
Sure. Try it and see.
$longstring = 'this is a short string now... ' x 20000;
print $x;
See? Piece of cake.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Tue, 24 Aug 1999 15:15:42 -0700
From: "Xah" <xah@best.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37c3198f$0$215@nntp1.ba.best.com>
In article <37b6500c.2143627@read.news.global.net.uk>,
dave@see.sig.for.address (Dave) wrote:
>
> John, please refrain from cross-posting all your messages to
> comp.lang.python. If there is anything worse than getting a long and
> pointless flame war, it is getting half a flame war. By cross posting
> you are clearly trying to drag the readers of c.l.py into the
> argument, which is pure trolling. If you continue you will merely
> succeed in pissing off two newsgroups instead of one.
In geek religion wars, there are two types of people. One of them are the
nincompoops, who try to do everything in their power to advocate their
superiority. The other is the super-nincompoops, who, instead of sitting
their asses on high clouds, have to dive in to make an announcement that the
nincompoops' behaviors are inappropriate.
I have a message for the super-nincompoops class: "shut ya pie hole".
> The 'my language is better than yours' debates are always pointless
> and counterproductive, and perl vs. python has been done countless
> times before. Life is too short, live and let live [insert other
> cliches to taste].
Perhaps YOUR life is too short, not mine! I have thoroughly enjoyed the
intricate discussions, and Perl is the language that will save the universe
from collapsing.
> Incidentally you are wrong about perl arrays and python lists being
> different data structures - internally they are both implemented as C
> arrays, only the names are different.
Incidentally really? Gather your brain cells and let's see if you can pull
off some real content. You might magically get out of my killfile.
> Dave Kirby
>
> --------------------------------------------------
> All great ideas start as heresy and end as dogma.
>
> dkirby@ <-figure this out, spambots!
> bigfoot. My opinions are my own,
> com but I'm willing to share.
Xah
best.com@xah <- figure this out, donkey!
http://www.best.com/~xah/PageTwo_dir/more.html
"All stupid sayings start and end as tomfool's quotes."
------------------------------
Date: Tue, 24 Aug 1999 20:24:49 +0200
From: moritz@news.uni-mannheim.de (Moritz Moeller-Herrmann)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7s5orh.1ck.moritz@Gertrud.chaos.wg>
On Mon, 23 Aug 1999 21:33:32 GMT, Gareth Rees <garethr@cre.canon.co.uk> wrote:
>xah@weborder.com wrote:
>> The ivy tower class of buttheads insist on symbolism for math,
>> clinging to the fancy that certain ideas are better expressed in
>> certain language. They created a whole barrier of entry [...]
>> [...] If someone cannot read my code, it is their shortcoming.
>Can you spot the contradiction?
Wow! I think people should always shorten posts.
I think the original post is parody though.
I hope so at least. It is, isn't it? Please tell me it is.
--
Moritz Moeller-Herrmann mmh@gmx.net ICQ# 3585990 # Not only
Get my public pgp / gpg key from # Open Source(TM)
http://webrum.uni-mannheim.de/jura/moritz/pubkeymoritz # but also
KDE forever! Use Linux to impress your friends! # Open Minded!
------------------------------
Date: Wed, 25 Aug 1999 00:49:22 +0200
From: "Rasmus Aaen" <rasmus@remove-this_byggeinfo.dk>
Subject: Re: Win32::ODBC and Sql
Message-Id: <DfFw3.912$cB5.1103@news.get2net.dk>
Just escape the quotes like this:
$stmt = "insert into TableName (field1, field2, field3) values (\"$var1\",
$var2, $var3)";
Rasmus
Andrew Crawford <lottopescado@yahoo.com> wrote in message
news:37C2F0F1.2E624187@yahoo.com...
> First-time caller, long-time listener.
> I'm using Win32:ODBC to interface with an Access database. The following
> code:
>
> my $stmt = "insert into TableName (field1, field2, field3) values
> ($var1, $var2, $var3)";
> $db->Sql($stmt);
>
> would ordinarily do a fine job of what we'd expect it to do. However,
> say the value of $var1 is a text string. Since strings need to be in
> single quotes when used in Sql insert statements, I've placed single
> quotes at the start and end of $var1's value by the time the above code
> is executed. My quandary is that $var1 has other single quotes in it, so
> a word like "don't" is causing an error because that apostrophe is being
> read as an end-of-string quote by the sql statement. Any suggestions?
> Many thanks.
>
>
------------------------------
Date: Tue, 24 Aug 1999 18:03:12 -0500
From: Kangas <kangas@anlon.com>
Subject: Re: Win32::ODBC and Sql
Message-Id: <37C324AF.2D86E17E@anlon.com>
this is a sql question. escape your single quotes with a single quote.
put in this line before your sql statement.....
$var1 =~ s/'/''/g;
Andrew Crawford wrote:
> First-time caller, long-time listener.
> I'm using Win32:ODBC to interface with an Access database. The following
> code:
>
> my $stmt = "insert into TableName (field1, field2, field3) values
> ($var1, $var2, $var3)";
> $db->Sql($stmt);
>
> would ordinarily do a fine job of what we'd expect it to do. However,
> say the value of $var1 is a text string. Since strings need to be in
> single quotes when used in Sql insert statements, I've placed single
> quotes at the start and end of $var1's value by the time the above code
> is executed. My quandary is that $var1 has other single quotes in it, so
> a word like "don't" is causing an error because that apostrophe is being
> read as an end-of-string quote by the sql statement. Any suggestions?
> Many thanks.
--
Michael Kangas
Anlon Systems, Inc.
kangas@anlon.com
------------------------------
Date: Tue, 24 Aug 1999 16:17:18 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Win32::ODBC and Sql
Message-Id: <37C327FE.4381B4B@mail.cor.epa.gov>
Kangas wrote:
>
> this is a sql question. escape your single quotes with a single quote.
> put in this line before your sql statement.....
>
> $var1 =~ s/'/''/g;
And just to add a little Perl value to this thread, in
the DBI::* modules there is a quote() function which will
handle this for you, so you don't have to escape all your
quotemarks. [I don't work with Win32::ODBC so I can't tell
you whether it has the same function, but one can go the
DBI::ODBC route instead of Win32::ODBC.]
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 633
*************************************