[19481] in Perl-Users-Digest
Perl-Users Digest, Issue: 1676 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 1 14:05:27 2001
Date: Sat, 1 Sep 2001 11:05:07 -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: <999367506-v10-i1676@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 1 Sep 2001 Volume: 10 Number: 1676
Today's topics:
Re: Alternations in Parse::RecDescent (Randal L. Schwartz)
Re: Beginner PERL Book <Crazydj@web.de>
Bijeenkomst Amsterdam Perl Mongers, Dinsdag 4 September (Johan Vromans)
Re: Calling sub funcs with scalar variables? <iltzu@sci.invalid>
Re: Calling sub funcs with scalar variables? <uri@sysarch.com>
Re: geting data with in two points. (Martien Verbruggen)
Re: geting data with in two points. (Tad McClellan)
Re: getting ip <Crazydj@web.de>
Re: getting ip <godzilla@stomp.stomp.tokyo>
Re: getting ip <jbritain@home.com>
Re: home directory in use lib (Tad McClellan)
Re: Net::FTP question <jdrumm@blazenetme.net>
Net::Telnet.pm and the Escape Key <matze@e-travel.de>
Re: Pattern matching, grabing everything right of the m (Randal L. Schwartz)
Re: Pause for time. <joe+usenet@sunstarsys.com>
Re: perl "study" function in java? <iltzu@sci.invalid>
Perl Project (renntech)
Re: Perl Project (Chris Fedde)
Posting a pre-existing cookie using LWP? vze2nddi@mail.verizon.net
Script Error? <us@webhostwatch.co.ukNOSPAM>
Re: Script Error? <ilya@martynov.org>
Re: Script Error? <us@webhostwatch.co.ukNOSPAM>
Re: sharing sockets between processes (Chris Fedde)
Syntax with attributes <trondmm-usenet@crusaders.no>
Re: use CGI qw(param) (Tad McClellan)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 01 Sep 2001 11:02:54 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Alternations in Parse::RecDescent
Message-Id: <m11ylqiyb5.fsf@halfdome.holdit.com>
>>>>> "Andreas" == Andreas Weymer <weymer@mediawise.de> writes:
Andreas> I'm using alternations in some productions but in contrast to
Andreas> the definition of the |-operator, I'm looking for a behaviour
Andreas> which is XOR (^) not OR (|). So far I used the <reject>
Andreas> directive to simulate such a behaviour.
[..]
Andreas> Is there any easy solution to this?
Sure. Use a set.
use Parse::RecDescent;
use Data::Dumper; $|++;
my $parser = Parse::RecDescent->new(q{
line: word(s) /\z/ {
my @words = @{$item[1]};
my %count;
(grep ++$count{$_} > 1, @words) ? undef : \@words;
}
word: "one" | "two" | "three"
}) or die;
for ("one two", "one one", "two three one", "three one two one") {
print "$_ =>\n";
print Dumper($parser->line($_));
}
which generates:
one two =>
$VAR1 = [
'one',
'two'
];
one one =>
$VAR1 = undef;
two three one =>
$VAR1 = [
'two',
'three',
'one'
];
three one two one =>
$VAR1 = undef;
You could also set up the list of allowed words in a local variable
for the rule, plucked out one at a time as the words are seen:
use Parse::RecDescent;
use Data::Dumper; $|++;
my $parser = Parse::RecDescent->new(q{
line: <rulevar: local %left = map { $_ , 1 } qw(one two three) >
line: words /\z/ { $item{words} }
words: word(s)
word: /\w+/ { delete $left{$item[1]} ? $item[1] : undef }
}) or die;
for ("one two", "one one", "two three one", "three one two one") {
print "$_ =>\n";
print Dumper($parser->line($_));
}
Same output as above.
Parse::RecDescent rules!
You might also want to join the P::RD mailing list, one of the lists
hosted at perl.org.
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Sat, 01 Sep 2001 12:13:42 +0200
From: Crazydj <Crazydj@web.de>
Subject: Re: Beginner PERL Book
Message-Id: <3B90B4D6.F97B33CB@web.de>
Hi,
try "Learning Perl" from O' Reilly http://www.oreilly.com/catalog/lperl3/
Greets
Bastian Ballmann
Philip Newton schrieb:
> On Tue, 28 Aug 2001 15:39:19 -0600, "Paris Bookstore"
> <parisbookstore@qwest.net> wrote:
>
> > I started out with Elizabeth Castro's "Perl and CGI for the Worldwide Web -
> > Visual Quickstart Guide" and it did me great for getting up and running
> > quickly.
>
> I'm told that the second edition of this book is a lot better than the
> first, which should be avoided. I don't know the absolute quality of the
> book, though.
>
> 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.
--
Djz rule the world! ...and some other staff ;-p Find out at http://www.crazydj.de
------------------------------
Date: 31 Aug 2001 13:25:34 +0200
From: JVromans@Squirrel.nl (Johan Vromans)
Subject: Bijeenkomst Amsterdam Perl Mongers, Dinsdag 4 September 2001
Message-Id: <m2pu9co4i9.fsf@phoenix.squirrel.nl>
[English version follows the dutch text]
Amsterdam.pm staat voor de "Amsterdamse Perl Mongers", een groep van
gebruikers van Perl. In tegenstelling tot wat de naam suggereert is
Amsterdam.pm niet beperkt tot alleen Amsterdam, maar functioneert, tot
er meer gebruikersgroepen in Nederland zijn, als Nederlandse
gebruikersgroep.
Amsterdam.pm organiseert informele bijeenkomsten waar Perl gebruikers
kunnen samenkomen en informatie en gebruikservaringen met betrekking
tot Perl kunnen uitwisselen. Deze bijeenkomsten vinden normaliter
plaats op elke eerste dinsdag van de maand. De voertaal binnen
Amsterdam.pm is in pricipe Nederlands, maar indien nodig zal Engels
worden gebruikt, b.v. om te communiceren met niet-Nederlandssprekende
aanwezigen.
De eerstvolgende bijeenkomst vindt plaats op dinsdag 4 september 2001 van
20:00 tot 22:00 uur op het (nieuwe!) kantoor van XS4All, Eekholt 42,
Diemen.
Voor meer details, waaronder een routebeschrijving, zie
http://www.amsterdam.pm.org/Meetings/next_meeting.html
Liefhebbers van een etentje vooraf kunnen tussen 17:45 en 18:15
verzamelen. Om 18:15 (écht om 18:15!) zoeken we een restaurantje in de
buurt om een hapje te eten.
Bezoek onze Web site http://www.Amsterdam.pm.org voor meer details.
[English version]
Amsterdam.pm stands for the Amsterdam Perl Mongers. We're basically a
Perl user group. Despite its name, it is not local to the Amsterdam
environment, but it welcomes Perl mongers from all over the
Netherlands.
Amsterdam.pm organises informal meetings where Perl users can meet,
and exchange information and experiences with regard to using Perl.
The meetings are normally held every first Tuesday of the month.
Although the preferred language for communication is Dutch, English
will be spoken if necessary.
Our next meeting is Tuesday September 4th, from 20:00 till 22:00
at the (new!) office of XS4All, Eekholt 42, Diemen.
See http://www.amsterdam.pm.org/Meetings/next_meeting.html for
more detail and the directions to get there.
Should you want to join some of us for dinner, please gather between
17:45 and 18:15. At 18:15 sharp we'll leave for a restaurant somewhere
nearby for dinner.
See http://www.Amsterdam.pm.org for more details.
------------------------------
Date: 1 Sep 2001 12:23:48 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Calling sub funcs with scalar variables?
Message-Id: <999346423.21653@itz.pp.sci.fi>
In article <x7vgj5h2lu.fsf@home.sysarch.com>, Uri Guttman wrote:
>>>>>> "n" == nobull <nobull@mail.com> writes:
>
> n> Symbolic method references are still eqaually dangerous from a
> n> security standpoint since $method can contain a package qualified name
> n> and there's no recursive check made of @Foo::Bar::ISA to ensure that
> n> the package specified in $method is really an ancestor of Foo::Bar.
>
>use can() to check that first. again, i do that in stem. if you call an
>unknown method it is runtime fatal (unless caught with eval) so that is
>a caveat to the coder. you can use symbolic methods but check them
>before you call them.
#!/usr/bin/perl -w
use strict;
sub unsafe { die "Unsafe subroutine called" }
my $method = 'main::unsafe'; # user input
Foo::Bar->can($method) or die "Foo::Bar can't $method";
Foo::Bar->$method();
Of course, it *is* possible to do this safely, if...
Okay, pop quiz. What do you have to do to $method to make it safe?
And the answer is...
$method =~ /::|'/ and die "$method contains a package separator";
Now, how many of you remembered to check for "'" too?
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post something,
we discuss its implications. If the discussion happens to answer a question
you've asked, that's incidental." -- nobull in comp.lang.perl.misc
------------------------------
Date: Sat, 01 Sep 2001 16:49:58 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Calling sub funcs with scalar variables?
Message-Id: <x7d75ahn3y.fsf@home.sysarch.com>
>>>>> "IK" == Ilmari Karonen <iltzu@sci.invalid> writes:
IK> sub unsafe { die "Unsafe subroutine called" }
IK> my $method = 'main::unsafe'; # user input
IK> Foo::Bar->can($method) or die "Foo::Bar can't $method";
IK> Foo::Bar->$method();
IK> Of course, it *is* possible to do this safely, if...
IK> Okay, pop quiz. What do you have to do to $method to make it safe?
IK>
IK> And the answer is...
IK> $method =~ /::|'/ and die "$method contains a package separator";
IK> Now, how many of you remembered to check for "'" too?
or just check the method's name in your own private hash. also called a
dispatch table.
i would never take user input and directly call a sub/method based on
it.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs -------------------------- http://jobs.perl.org
------------------------------
Date: Sat, 1 Sep 2001 19:56:59 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: geting data with in two points.
Message-Id: <slrn9p1c7b.3ga.mgjv@martien.heliotrope.home>
On Sat, 1 Sep 2001 17:02:09 +1000,
nathan <michealo@ozemail.com.au> wrote:
> is there a way to get data from a two points in perl example
> lalalala
><start>
> yeah
><end>
> lalalalalla
I _think_ you are asking about how to pull the text between those two
markers out of a file, right? Your question is so incredibly vague and
underspecified that it's hard to understand what exactly you're asking.
I think that you might find one of the questions in the Perl FAQ,
section 6 handy:
How can I pull out lines between two patterns that are
themselves on different lines?
Next time, _please_ check the FAQ yourself before posting. It's
installed with all the other Perl documentation on any system that has
Perl installed.
Martien
--
Martien Verbruggen |
Interactive Media Division | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd. | make up 3/4 of the population.
NSW, Australia |
------------------------------
Date: Sat, 1 Sep 2001 07:57:14 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: geting data with in two points.
Message-Id: <slrn9p1j8q.7af.tadmc@tadmc26.august.net>
F. Xavier Noria <fxn@retemail.es> wrote:
>On Sat, 1 Sep 2001 17:02:09 +1000, nathan <michealo@ozemail.com.au> wrote:
>
>: is there a way to get data from a two points in perl example
>: lalalala
>:<start>
>: yeah
>:<end>
>: lalalalalla
>
>Yeah, if $text contains the whole document and you are interested
>just in the first occurrence of an <start>/<end> pair
>
> ($data) = $text =~ /<start>(.*)?<end>/s;
>
>assigns `yeah' to $data,
It assigns 6 characters, not 4: "\nyeah\n"
>and if there are more instances of those
>delimiters
Then both of your code snippets will fail :-)
>and you want to catch all of them
>
> @data = $test =~ /<start>(.*)?<end>/sg;
>
>puts all the `yeah's in the array @data in the same order as they
>appear in $text.
Please test your code before posting. Your question mark is
in the wrong place. It is a no-op where you have it, but I think
you want non-greedy...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 01 Sep 2001 12:10:29 +0200
From: Crazydj <Crazydj@web.de>
Subject: Re: getting ip
Message-Id: <3B90B415.D03F150@web.de>
Hi,
just use the Net::DNS module from CPAN.
To test how it works just run the following script:
#!/usr/bin/perl
use Net::DNS;
$query = $ARGV[0];
$res = new Net::DNS::Resolver;
$echo = $res->search($query);
if($echo)
{
foreach $found ($echo->answer)
{
next unless $found->type eq "A";
print "$found->{'address'}\n";
}
}
Greets
Bastian Ballmann
Matthew Frick schrieb:
> I have a webpage calling a script on another server and I need the script to
> be able to get the ip of the webpage not of the person navigating. Does
> anyone know how I would go about this??
>
> --
> ___________________________________________________________
> - l e a r n . e d s o l u t i o n s p t y l t d -
>
> Matthew Frick Systems Administrator / Programmer
> www.learnedsolutions.com mfrick@learnedsolutions.com
>
> Level 1, 214 Greenhill Road, EASTWOOD, South Australia 5063
> Phone: +61 8 8272 3111 (Ext. 643) Fax: +61 8 8272 3211
> ___________________________________________________________
> E-mail Disclaimer:
> http://www.learnedsolutions.com/disclaimer.html
> ___________________________________________________________
--
Djz rule the world! ...and some other staff ;-p Find out at http://www.crazydj.de
------------------------------
Date: Sat, 01 Sep 2001 09:25:52 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: getting ip
Message-Id: <3B910C10.A1444D5@stomp.stomp.tokyo>
Matthew Frick wrote:
> I have a webpage calling a script on another server and I need the script to
> be able to get the ip of the webpage not of the person navigating. Does
> anyone know how I would go about this??
Why do you not know the ip address of your own webpage?
203.30.237.1 would seem a logical presumption.
Godzilla!
------------------------------
Date: Sat, 01 Sep 2001 17:02:11 GMT
From: Jim Britain <jbritain@home.com>
Subject: Re: getting ip
Message-Id: <9052ptgm9s6mfia75r5cvb4op2ah1pd5dn@4ax.com>
On Sat, 1 Sep 2001 17:30:00 +0930, "Matthew Frick"
<mfrick@chariot.net.au> wrote:
>I have a webpage calling a script on another server and I need the script to
>be able to get the ip of the webpage not of the person navigating. Does
>anyone know how I would go about this??
You can't.
Web pages don't call scripts. Web pages are data files.
------------------------------
Date: Sat, 1 Sep 2001 08:20:54 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: home directory in use lib
Message-Id: <slrn9p1kl5.7af.tadmc@tadmc26.august.net>
Marty Jones <jones1ai14@yahoo.com> wrote:
>use lib "~jones/perl/lib";
[snip]
>Also, why doesn't perl expand the ~jones within the use directive?
Because it is the shell that "knows" that tilde means "home directory",
and perl is not the shell.
Perl is a different language, so the funny characters mean
different things. Even not-funny characters mean different
things in different languages. "for" in the shell is different
than "for" in Perl.
Also,
grep 'home directory' *.pod
finds this in perlop.pod:
---------------------
a reasonably portable way to find out the home directory
(assuming it's not "0") might be:
$home = $ENV{'HOME'} || $ENV{'LOGDIR'} ||
(getpwuid($<))[7] || die "You're homeless!\n";
---------------------
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 01 Sep 2001 09:55:01 -0400
From: Jeffrey Drumm <jdrumm@blazenetme.net>
Subject: Re: Net::FTP question
Message-Id: <n2q1pt8vh8vcnqju7r97592jbf7bbcdnpi@4ax.com>
[posted to comp.lang.perl.misc]
On Fri, 31 Aug 2001 21:13:00 GMT, davidkrainess@yahoo.com (David Krainess)
wrote:
>Please Anybody???
There was a response to your post yesterday that contained the correct
answer. Perhaps it didn't show up on your news server.
In any event, you need to set binary mode *AFTER* you log in, not before.
--
- Jeff Drumm
Insert dumb Dubya quote here . . . there are plenty to choose from
------------------------------
Date: Sat, 01 Sep 2001 18:35:31 +0200
From: Matthias Wegener <matze@e-travel.de>
Subject: Net::Telnet.pm and the Escape Key
Message-Id: <3B910E53.4F0CF13D@e-travel.de>
Hi,
is it possible to emulate a stroke on the escape key on the keyboard via
the Telnet.pm? I mean, what (and how escaped) string is to be send to
accomplish this?
$telnet->cmd('???');
I sniffed the traffic between the telnet-server and an ordinary
telnet-client and learned that in hex it looks something like 0x1b when
I hit the escape key, but I dont know how to encapsulate this to put it
in an ordinary Telnet.pm-like command-string : (
Thanks in advance for your help! : )
matze
------------------------------
Date: 01 Sep 2001 07:08:38 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Pattern matching, grabing everything right of the match
Message-Id: <m1lmjzj95l.fsf@halfdome.holdit.com>
>>>>> "Philip" == Philip Newton <pne-news-20010901@newton.digitalspace.net> writes:
Philip> On 30 Aug 2001 08:23:47 -0700, merlyn@stonehenge.com (Randal L.
Philip> Schwartz) wrote:
>> >>>>> "Steve" == Steve McDonald <steve_mcdonald@choicehotels.com> writes:
>>
Steve> Thanks! the .* worked great!
>>
>> Presuming you have no newlines then. For that, you either need
>> something easy to understand like /[\0-\377]*/, or hard to understand
>> like /(?s).*/ or /.*/s .
Philip> $ perl -le 'if("\x{20ac}" =~ /^[\0-\377]*\z/) { print "Match!" } else {
Philip> print "No match." }'
Philip> No match.
Philip> $ perl -le 'if("\x{20ac}" =~ /^.*\z/s) { print "Match!" } else { print
Philip> "No match." }'
Philip> Match!
You and your big fat bytes... that's soooooo... Un-American! I'm
going to report you to the Un-American Activities Committe immediately!
:-)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 01 Sep 2001 09:30:56 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Pause for time.
Message-Id: <m3pu9bjawf.fsf@mumonkan.sunstarsys.com>
Julia Kempe <kempe@uclink4.berkeley.edu> writes:
> How do I make perl pause between steps in a program?
>
> For example, I want it to output a series of notices, but with a, say,
> one or two second pause in between.
In *nix, you'd be looking for sleep(1)-
% man sleep
On linux, the info pages are often more comprehensive:
% info sleep
> Is there some sort of pause for time funtion I can invoke, or any
> module I can use??
>
Perl provides the same function:
% perldoc -f sleep
HTH
--
Joe Schaefer "The surest protection against temptation is cowardice."
--Mark Twain
------------------------------
Date: 1 Sep 2001 11:43:07 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: perl "study" function in java?
Message-Id: <999343510.20339@itz.pp.sci.fi>
In article <slrn9ouc62.vug.abigail@alexandra.xs4all.nl>, Abigail wrote:
>Trewth Seeker (trewth_seeker@yahoo.com) wrote on MMCMXXII September
>MCMXCIII in <URL:news:d690a633.0108302158.1f9d8643@posting.google.com>:
>@@
>@@ Saying "please" doesn't make you any less unpleasant a person.
>
>I never claim I wasn't.
However, adding a scorefile entry for
[comp.lang.perl.*]
Score: -9999
Subject: [Jj]ava
might make you appear less unpleasant to those of us who are just
passing by, looking for interesting posts about Perl.
I don't mind crossposts between Perl and Java groups, particularly if
both languages are mentioned in the subject line. What I do mind is
such crossposts degenerating into flamewars. If I notice a single
poster involved in a disproportionate number of such incidents, I start
thinking about adding a scorefile entry myself.
While I have a lot of people and subjects scored down in clpm, just to
reduce the volume, only one poster so far has earned a negative score
for all followups to her posts too. I'd hate to add another. I'd
really hate to score down a Perl expert just because she's starting more
flamewars than I care to read.
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post something,
we discuss its implications. If the discussion happens to answer a question
you've asked, that's incidental." -- nobull in comp.lang.perl.misc
------------------------------
Date: 1 Sep 2001 06:59:14 -0700
From: renntech750@yahoo.com (renntech)
Subject: Perl Project
Message-Id: <674fb37c.0109010559.5910007@posting.google.com>
I'm bouncing around the perl discussion boards today looking for
someone I can hire to write a perl script for me. Is anyone out there
interested, or know someone who is?
Many thanks,
Burt
renntech750@yahoo.com
------------------------------
Date: Sat, 01 Sep 2001 14:20:05 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Perl Project
Message-Id: <p86k7.51$Owe.135400960@news.frii.net>
In article <674fb37c.0109010559.5910007@posting.google.com>,
renntech <renntech750@yahoo.com> wrote:
>I'm bouncing around the perl discussion boards today looking for
>someone I can hire to write a perl script for me. Is anyone out there
>interested, or know someone who is?
>
If you are looking to hire someone you might want to make a posting to a
news group that has the word 'jobs' in its title.
Good Luck!
--
This space intentionally left blank
------------------------------
Date: Sat, 01 Sep 2001 12:44:51 -0400
From: vze2nddi@mail.verizon.net
Subject: Posting a pre-existing cookie using LWP?
Message-Id: <3B911083.1E127F64@mail.verizon.net>
I am writing a bot that I want to gather all the information I have
access to on a particular site, but the site wants to see a cookie
validating me.
I want to copy the existing cookie from my Netscape cookie file rahter
than setting up a cookie jar with LWP and having the server generate a
new cookie from scratch. How can I specify a cookie as a string, without
waiting to see what the server wants to set?
TIA,
clay
------------------------------
Date: Sat, 1 Sep 2001 15:36:08 +0100
From: "WHW" <us@webhostwatch.co.ukNOSPAM>
Subject: Script Error?
Message-Id: <su6k7.22479$wX5.2537073@news6-win.server.ntlworld.com>
Hi,
Can you see an error in the code below?
[CODE]
# Use the DBI module
use DBI qw(:sql_types);
# Declare local variables
my ($databaseName, $databaseUser, $databasePw, $dbh);
my ($stmt, sth, @newRow);
my ($domain, $password, $name, $street, $town, $county, $postcode, $country,
$email, $phone, $fax, $nameserver1, $nameserver2, $ip1, $ip2);
#Line 50 is here
# Set the parameter values for the connection
$databaseName = "DBI:mysql:database_name";
$databaseUser = "database_username";
$databasePw = "database_password";
# Connect to the database
# Note this connection can be used to
# execute more than one statement
# on any number of tables in the database
$dbh = DBI->connect($databaseName, $databaseUser,
$databasePw) || die "Connect failed: $DBI::errstr\n";
INSERT INTO phpSP_users (user, password, userlevel, name, street, town,
county, postcode, country, email, phone, fax, nameserver1, nameserver2, ip1,
ip2);
VALUES ('$domain', '$password', '1', '$name', '$street', '$town', '$county',
'$postcode', '$country', '$email', '$phone', '$fax', '$nameserver1',
'$nameserver2', '$ip1', '$ip2');
# Prepare and execute the SQL query
$sth = $$dbh->prepare($$stmt)
|| die "prepare: $$stmt: $DBI::errstr";
$sth->execute || die "execute: $$stmt: $DBI::errstr";
# Clean up the record set and the database connection
$sth->finish();
$dbh->disconnect();
[/CODE]
Here is the error log record:
[CODE]
[Sat Sep 1 07:11:04 2001] [error] [client 213.104.96.124] Premature end of
script headers: /home/path/cgi-bin/ukcoorder.cgi
Execution of /home/path/cgi-bin/ukcoorder.cgi aborted due to compilation
errors.
Can't declare constant item in "my" at /home/path/cgi-bin/ukcoorder.cgi line
47, near ");"
[/CODE]
Thanks for any help!
Rob
------------------------------
Date: 01 Sep 2001 18:53:57 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: Script Error?
Message-Id: <87ae0fj722.fsf@abra.ru>
>>>>> On Sat, 1 Sep 2001 15:36:08 +0100, "WHW" <us@webhostwatch.co.ukNOSPAM> said:
W> Hi,
W> Can you see an error in the code below?
W> [CODE]
W> # Use the DBI module
W> use DBI qw(:sql_types);
W> # Declare local variables
W> my ($databaseName, $databaseUser, $databasePw, $dbh);
W> my ($stmt, sth, @newRow);
^^^^^
It should be $sth
W> my ($domain, $password, $name, $street, $town, $county, $postcode, $country,
W> [..skip..]
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/) |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/) |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: Sat, 1 Sep 2001 18:08:59 +0100
From: "WHW" <us@webhostwatch.co.ukNOSPAM>
Subject: Re: Script Error?
Message-Id: <IJ8k7.28395$Nb2.4608014@news2-win.server.ntlworld.com>
Hi,
> It should be $sth
Thanks, Im also getting the following error on the same piece of perl:
Undefined subroutine &main::phpSP_users
On the line referencing to the table 'phpSP-users'. Any ideas?
Thanks,
Rob
------------------------------
Date: Sat, 01 Sep 2001 14:27:34 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: sharing sockets between processes
Message-Id: <qf6k7.52$Owe.171079168@news.frii.net>
In article <Ob2k7.116365$SC.2684851@amsnews02.chello.com>,
ninpo <bla@bla.bla> wrote:
>
>In that way, only communication between parents and children is
>possible,right?,
>but i'm looking for a way to have the children chatter amongst eachother.
>Every forked process gets its own socket. a newly spawned child has no
>knowledge of other clients and hence, their sockets.
>I've read perlipc again, maybe I'm missing something ?
>
Look at the exampls that are in the IO::Select and IO::Socket::INET manual
pages. I think you will like what you see.
Good Luck!
--
This space intentionally left blank
------------------------------
Date: Sat, 01 Sep 2001 14:46:32 GMT
From: "Trond Michelsen" <trondmm-usenet@crusaders.no>
Subject: Syntax with attributes
Message-Id: <cx6k7.3446$5R2.678156@news01.chello.no>
Hi.
I'm experimenting a bit with attributes, and at the moment I'm working on a
module to automagically lock files.
My goal was to be able to say something like this:
open my $fh : LockedFile, $file;
but this is a syntax error :(
Invalid separator character ',' in attribute list at -e line 1, near "$fh :
LockedFile"
To get it to work I have to say either
open my $fh : LockedFile => $file;
or
open +(my $fh : LockedFile), $file
which is slightly annoying.
Is it possible to do anything to the LockedFile attribute to change how perl
parses this line, or am I stuck with the fancy comma?
--
tm
------------------------------
Date: Sat, 1 Sep 2001 08:29:34 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: use CGI qw(param)
Message-Id: <slrn9p1l5e.7af.tadmc@tadmc26.august.net>
alex <aort527@hotmail.com> wrote:
>how do I tell my script to go to this
>\PERL\LIB directory to find the CGI.PM
>module. do i code something like:
>use C:\PERL\LIB\CGI qw(param)
use lib 'C:\PERL\LIB';
You might even be able to use sane slashes:
use lib 'C:/PERL/LIB';
>this doesn't work. help....
We are happy to help, but we prefer that you do a tiny little
bit to try and solve your problem yourself first.
perldoc -q module
finds:
"How do I keep my own module/library directory?"
Which includes the above solution, along with a few others.
You are expected to check the Perl FAQs *before* posting to
the Perl newsgroup.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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 1676
***************************************