[15762] in Perl-Users-Digest
Perl-Users Digest, Issue: 3175 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 26 14:05:45 2000
Date: Fri, 26 May 2000 11:05:20 -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: <959364319-v9-i3175@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 26 May 2000 Volume: 9 Number: 3175
Today's topics:
Re: "or" vs. "||" - operator precedence question <gwr@novia.net>
Re: "or" vs. "||" - operator precedence question <bmb@dataserv.libs.uga.edu>
Re: ([^|]+) vs (.*?) (Abigail)
Re: Basic scripting question <godzilla@stomp.stomp.tokyo>
Can I do this using Perl? (Tony O'Brien)
Re: Can I do this using Perl? <samay1NOsaSPAM@hotmail.com.invalid>
Re: Can't get my search and replace script to work dutchm@my-deja.com
Re: Can't get my search and replace script to work <red_orc@my-deja.com>
Re: can't run the perl CGI script. (Mark Badolato)
CGI and sytem calls.. <memmett@fraser.sfu.ca>
Re: comparing file content? Checksum? <flavell@mail.cern.ch>
concurrent access to a persistent hash <moem1@solar.pace.medtronic.COM>
Re: frustrating redirect() problem on Win2k <andrew@mahler.com>
Re: hashes vs associative arrays (was: Re: Array Questi <bmb@dataserv.libs.uga.edu>
How Sambar 4.2 run CGI ? <adolftw@tcts1.seed.net.tw>
Re: How Sambar 4.2 run CGI ? <glauber.ribeiroNOglSPAM@experian.com.invalid>
Re: How to COPY a website (Mark-Jason Dominus)
Re: How to COPY a website (Randal L. Schwartz)
IO::Socket::INET failure <bresie@arlut.utexas.edu>
Re: join " ", do {$x++}, do {$x++}, do {$x++}; (M.J.T. Guy)
my $x vs. my ($x) <tcuffel@exactis.com>
Re: my $x vs. my ($x) (Randal L. Schwartz)
Re: my $x vs. my ($x) <tcuffel@exactis.com>
Re: Namespace question <markp@mail1.jpl.nasa.gov>
Re: newbie question - dbi:mysql <nospam@devnull.com>
Re: newbie question - dbi:mysql <red_orc@my-deja.com>
Re: Newbie: DIV <aqumsieh@hyperchip.com>
Re: Newbie: DIV <red_orc@my-deja.com>
oops Re: seeking method to encode email addresses in we <nospam@devnull.com>
Re: oops Re: seeking method to encode email addresses i <godzilla@stomp.stomp.tokyo>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 May 2000 10:09:03 -0500
From: George Rapp <gwr@novia.net>
Subject: Re: "or" vs. "||" - operator precedence question
Message-Id: <_rwX4.8722$pX5.553531@sol.newscene.com>
Abigail <abigail@arena-i.com> wrote:
> [snip]
> However, that's only part of your problem.
>
> ($var) = EXPR1 or die;
>
> the assignment is in list context. If EXPR1 returns undef, the result
> of ($var) = EXPR1 is (undef), a *LIST* of one element. One would expect
> that such a list in scalar context returns its element, but assignment
> is special. A "list" assignment in scalar context returns the number
> of elements of the list on the right hand side of the assignment.
> (I fail to use why that's useful at the moment.)
> [snip]
> You could fix your problem by removing the ()s on the left hand side
> of the assignment.
Yep. That fixed the problem. I was assigning to a list without
thinking about the consequences. (This is my first foray into "use
strict" land, as I'm trying to develop better Perl habits, so the "my
($x) =" is a bad habit I'll need to break.)
Thanks for your help.
George
--
George Rapp (Bellevue, NE) Go 'Huskers!!!
Home: gwr@novia.net ICQ: 14583674 AIM: gwrboing
Work: grapp01@mail.dfas.msd.eds.com (or) george.rapp@dfas.mil
Why is it called "after dark" when it really is "after light"?
------------------------------
Date: Fri, 26 May 2000 11:39:14 -0400
From: Brad Baxter <bmb@dataserv.libs.uga.edu>
Subject: Re: "or" vs. "||" - operator precedence question
Message-Id: <Pine.GSO.4.21.0005261133150.29594-100000@dataserv.libs.uga.edu>
On 26 May 2000, George Rapp wrote:
> Abigail <abigail@arena-i.com> wrote:
> > [snip]
> > However, that's only part of your problem.
> >
> > ($var) = EXPR1 or die;
> >
> > the assignment is in list context. If EXPR1 returns undef, the result
> > of ($var) = EXPR1 is (undef), a *LIST* of one element. One would expect
> > that such a list in scalar context returns its element, but assignment
> > is special. A "list" assignment in scalar context returns the number
> > of elements of the list on the right hand side of the assignment.
> > (I fail to use why that's useful at the moment.)
> > [snip]
> > You could fix your problem by removing the ()s on the left hand side
> > of the assignment.
>
> Yep. That fixed the problem. I was assigning to a list without
> thinking about the consequences. (This is my first foray into "use
> strict" land, as I'm trying to develop better Perl habits, so the "my
> ($x) =" is a bad habit I'll need to break.)
Just watch out for this not uncommon mistake (line 8). There are various
solutions, line 13 included.
1 #!/usr/local/bin/perl -w
2 use strict;
3
4 bad( 'a', 'b', 'c' );
5 good( 1, 2, 3 );
6
7 sub bad {
8 my $x = @_;
9 print "$x\n";
10 }
11
12 sub good {
13 my ($x) = @_;
14 print "$x\n";
15 }
16
17 __END__
18 Output:
19
20 3
21 1
--
Brad
------------------------------
Date: 26 May 2000 17:53:58 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: ([^|]+) vs (.*?)
Message-Id: <8gmdnm$q7k$2@news.panix.com>
On Fri, 26 May 2000 05:54:18 GMT, Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
++ I was shocked! How could Abigail <abigail@arena-i.com>
++ say such a terrible thing:
++ >On Thu, 25 May 2000 22:12:07 +0200, Chantal <chantal@excite.nl> wrote:
++ >++ Hi all.
++ >++
++ >++ i know its not the same but i don't know the difference.
++ >++ who can tell me
++ >++ ([^|]+) and (.*?)
++ >++ (the pipe is part of the string)
++ >
++ >Well, they are very different:
++ >
++ > ([^|]+): matches a longest possible (sub)string, of at least one
++ > character, that doesn't contain a '|'.
++ > (.*?): matches a shortest possible (sub)string, possibly empty,
++ > that doesn't contain a newline (unless /s is in effect).
++
++ doesn't (.*?) match a string of zero length? No matter what the string
++ it was matching against contains I mean. I mean:
++
++ $st = "\n\n\n\n\n";
++ ($s) = $st =~ /(.*?)/;
++ print $s;
++
++ gives no warnings (it prints nothing out but that just means that $s is
++ zero length, not that it is undefined).
If (.*?) is all that's in the regex, sure. But if it's part of a regex,
it might match more.
"one fish, two fish, red fish, blue fish" =~ /fish(.*?)fish/;
print "<$1>\n";
prints
<, two >
Abigail
------------------------------
Date: Fri, 26 May 2000 09:34:11 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Basic scripting question
Message-Id: <392EA783.43A11A30@stomp.stomp.tokyo>
The WebDragon wrote:
>
> "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> | Except for one thing; it doesn't work right.
> not only does it work, but it even works on MY MACINTOSH
> *smiles sweetly.. gradually morphing into a maniacal grin*
Review the entire thread on this code
in question Mr. Dragon. I believe you
have a bassackwards notion on this.
Godzilla!
------------------------------
Date: Fri, 26 May 2000 15:30:10 GMT
From: tobrien@isintegration.co.uk (Tony O'Brien)
Subject: Can I do this using Perl?
Message-Id: <392e8d20.17607402@news.u-net.com>
How does perl handle graphics?
I am trying to implement the following on a website, but I am not sure
if it can be done using perl:
The user clicks a link on the website to view a report.
The script then has to connect to a partner website, run the report
and present the results back on this website.
i.e. the user clicks a link and a report is presented to them in a
frame. They are unaware of where the report was generated.
The report contains graphical elements (graphs) and I do not know if
perl will choke on this. Can anyone advise please?
------------------------------
Date: Fri, 26 May 2000 09:16:00 -0700
From: Samay <samay1NOsaSPAM@hotmail.com.invalid>
Subject: Re: Can I do this using Perl?
Message-Id: <00ce1bbb.a35d1454@usw-ex0104-031.remarq.com>
graphical content have some filenames.. and perl can process
that.. Perl can even process binary data ..
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Fri, 26 May 2000 15:28:22 GMT
From: dutchm@my-deja.com
Subject: Re: Can't get my search and replace script to work
Message-Id: <8gm55v$9sd$1@nnrp1.deja.com>
Thanks for the suggestions. As you might have guessed I am
modifying an existing script and I admit the syntax is not clean.
What I meant by does not work was that the expression did not
match due to the metacharaters within the expression.
I guess what I am looking for is a way take the expression as only
a string so that it is not interpreted.
Thanks again
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 26 May 2000 15:47:04 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: Can't get my search and replace script to work
Message-Id: <8gm69j$aq2$1@nnrp1.deja.com>
In article <8gm55v$9sd$1@nnrp1.deja.com>,
dutchm@my-deja.com wrote:
>
> I guess what I am looking for is a way take the expression as only
> a string so that it is not interpreted.
>
use single-quotes for the non-interpolated part of the string and
concatenate "%page" onto the end? 'course, you still have to escape any
regex metachars.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 26 May 2000 16:50:55 GMT
From: mbadolato@cybernox.com (Mark Badolato)
Subject: Re: can't run the perl CGI script.
Message-Id: <8F4062008mbadolatocybernoxcom@206.165.3.80>
ltlau@yahoo.com (JL) wrote in <392dd9c4@news02.imsbiz.com>:
>Actually, I am not talking about FTP. I use Perl Builder in win98
>to write the CGI script and save it in my server. But if I want to
>run the program, I have to use telnet, then use pico to save the
>file again.
In Perl Builder, go to Tools->Options->Preferences
and check off Save files in Unix format (\n only)
--Mark
------------------------------
Date: 26 May 2000 09:53:55 -0700
From: Matthew Wilson Emmett <memmett@fraser.sfu.ca>
Subject: CGI and sytem calls..
Message-Id: <yvw9og5ts15o.fsf@fraser.sfu.ca>
Hello,
I was wondering how "expensive" doing something like
$contents = `cat $name`;
in CGI script that will be run many many time is? Should I try and
avoid system calls like the above in my CGI scripts to keep
web-hosters happy?
Any thoughts and opinions are greaty appreciated,
Matt
------------------------------
Date: Fri, 26 May 2000 17:14:11 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: comparing file content? Checksum?
Message-Id: <Pine.GHP.4.21.0005261703260.508-100000@hpplus01.cern.ch>
On Fri, 26 May 2000 newsmf@bigfoot.com wrote:
> I need to find a way, preferable with an existing perl library, to
> check to see if content on another webpage has changed.
This isn't a Perl language question.
You need to learn about HTTP "validators", or find a module that
supports them. Basically you make a conditional request to the HTTP
server "I've got this document with these validators, send me a new
version if necessary", the server responds with status 304 if it
hasn't changed.
Starting here might help with the background
http://www.mnot.net/cache_docs/#VALIDATE
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5
Take up further questions on a more appropriate group, like
comp.infosystems.www.authoring.cgi.
------------------------------
Date: 26 May 2000 10:10:17 -0500
From: Mark Moe <moem1@solar.pace.medtronic.COM>
Subject: concurrent access to a persistent hash
Message-Id: <sdjn1ldtkiu.fsf@solar.pace.medtronic.COM>
Hi,
I'm trying to write a server script where the parent process and
childern that it forks off for new clients can all access the same
hash table without corrupting it. I also want it to be persistent
between sessions of the server.
I'm using perl 5.005_03 and have tried the BerkeleyDB module, but
the DB_INIT_CDB flag doesn't seem to be working for me. Has anybody
used BerkeleyDB in this way? Any other suggestions for what
I am trying to do?
Thanks,
- Mark
--
Mark Moe
mark.moe@medtronic.com
------------------------------
Date: Fri, 26 May 2000 12:13:21 -0400
From: "Andrew Kuster" <andrew@mahler.com>
Subject: Re: frustrating redirect() problem on Win2k
Message-Id: <959357554.754700@axilla.wwnet.net>
Thanks.
Using header and a meta tag, I figured a way around the problem, as detailed
below.
CODE FOLLOWS
#!/usr/bin/perl
use CGI qw(:standard -nph);
use CGI::Carp qw(fatalsToBrowser);
#use DB_File;
use SDBM_File;
use Fcntl;
$fusername = param("username");
$fpassword = param("password");
dbmopen(%h, "C:/InetPub/wwwroot/Vpacs/cgi-bin/vpacsusers", 0644);
$cook = cookie(-name => 'username',
-value => $fusername,
-path => '/');
if (exists $h{$fusername}) {
$redir = "../frames.htm";
} else {
$redir = "../logonfail.htm";
}
dbmclose(%h);
print header( -cookie => $cook);
print "<meta http-equiv='refresh' content='0; url=$redir'>";
exit;
END OF CODE
Andrew Kuster
andrew@mahler.com
------------------------------
Date: Fri, 26 May 2000 11:08:24 -0400
From: Brad Baxter <bmb@dataserv.libs.uga.edu>
Subject: Re: hashes vs associative arrays (was: Re: Array Question)
Message-Id: <Pine.GSO.4.21.0005261104310.29594-100000@dataserv.libs.uga.edu>
On Fri, 26 May 2000, Peter Lowe wrote:
> In article <Pine.GSO.4.21.0005261034020.29594-100000@dataserv.libs.uga.edu>,
> Brad Baxter wrote:
...
> >Probably not.
>
> Eh?
>
> > 1 => 'one',
> > 2 => 'two',
> > 3 => 'three',
>
> I said "that type of thing", and I was just using it as an
> example to try and explain why I thought "associative array"
> was a more informative term than "hash". I apologise for Not
> Quoting Where I Should Have Quote, but I wasn't writing any
> code, I was giving an example of associated items. I could
> was thinking of putting it something like:
>
> 1 is associated with one
> 2 is associated with two
> ...
>
> but I didn't.
Sorry, nasty habit. My wife slaps me when I correct her French
pronunciation. But I like it.
> >> --
> >> This is not the signature you are looking for. Move along now.
> >
> >
> >These aren't the net 'bots we're looking for. Move along. Move along.
>
> Sorry, I don't get it...
Hmmm, perhaps it is I who don't get it ...
--
Brad
------------------------------
Date: 26 May 2000 16:29:51 GMT
From: "Adolf" <adolftw@tcts1.seed.net.tw>
Subject: How Sambar 4.2 run CGI ?
Message-Id: <8gm8pv$ejt$1@news.seed.net.tw>
I put *.cgi & *.pl & *.plx in the /cgi-bin/
and link them with <a pref=...>...</a>
why they can not run?
(I do not change the default of config.ini)
------------------------------
Date: Fri, 26 May 2000 09:33:33 -0700
From: glauber <glauber.ribeiroNOglSPAM@experian.com.invalid>
Subject: Re: How Sambar 4.2 run CGI ?
Message-Id: <0a8f1d9e.f61bd21d@usw-ex0103-019.remarq.com>
In article <8gm8pv$ejt$1@news.seed.net.tw>, "Adolf"
<adolftw@tcts1.seed.net.tw> wrote:
>I put *.cgi & *.pl & *.plx in the /cgi-bin/
>and link them with <a pref=...>...</a>
>why they can not run?
>(I do not change the default of config.ini)
Many, many possible reasons. You don't give enough detail for
people to be able to help you.
glauber
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Fri, 26 May 2000 16:03:40 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: How to COPY a website
Message-Id: <392ea05c.65a4$1d3@news.op.net>
In article <8gdepe$f83$1@as102.tel.hr>, Vjeran <user0201@vjeran.com> wrote:
>Mark-Jason Dominus <mjd@plover.com> wrote in message
>news:39298c79.5fee$12a@news.op.net...
>
>> >Which is blocked on my website because it has been shown not to
>> >respect robots.txt. Evil Product. Do not buy. Do not promote.
>
>> Yeah, it's a real stinker. It appears that whoever wrote it couldn't
>> figure out how to tell it not to fetch the same document twice, and so
>> it has a propensity to get stuck in loops, fetching the same files
>> over and over and over.
>
>Actually it (TeleportPRO) can identify itself as any program there is
>or even name you can think of. It can simulate ordinary browser
>witking with only 1 connection to server, so I really dont know how
>can you block it when it looks definitely like a web browser (can
>work even with pause)?
I don't block it. You seem to have me confused with Randal Schwartz.
------------------------------
Date: 26 May 2000 09:27:57 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: How to COPY a website
Message-Id: <m1r9apff8y.fsf@halfdome.holdit.com>
>>>>> "Mark-Jason" == Mark-Jason Dominus <mjd@plover.com> writes:
Mark-Jason> I don't block it. You seem to have me confused with Randal Schwartz.
Yes, MJD is taller and thinner than me. How could you have ever
confused us!
:-)
But kidding aside, I block Teleport Pro for the default user agent
string, so on the first hit, it's dead in the water. If they
configure it to pretend to be another agent, it gets blocked anyway by
usage pattern instead, but it takes a few dozen hits for me to
recognize it.
So I block many Evil Agents by who they say they are, and I block the
rest by what they do instead. Like IE 5, which in "offline browsing
mode" can hammer my site... my blocker triggers on two or three of
those each day.
I have some friends at a Very Large online consumer shopping site that
were using a version of my code during the big christmas rush last
year, and caught many people trying to download their entire 60,000+
item catalog with "offline browsing mode" from a cable modem. Without
my blocker, their system would have come to its knees at least a few
times trying to service all those dynamic requests, and they would
have lost real dollars during their peak season -- they estimate 6
figures of loss had that happened.
Evil Sucking Agents - just say no.
--
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: Fri, 26 May 2000 12:46:55 -0500
From: Eric Bresie <bresie@arlut.utexas.edu>
Subject: IO::Socket::INET failure
Message-Id: <392EB88F.D0F868F6@arlut.utexas.edu>
I am posting this for a friend.
Why doesn't this Perl program work on a Windows machine?
It always dies.
use IO::Socket;
$remote = IO::Socket::INET->new(
Proto => "tcp",
PeerAddr => "localhost",
PeerPort => "daytime(13)",
)
or die "cannot connect to daytime port at localhost";
while ( <$remote> ) {print}
Eric Bresie
ebresie@usa.net
------------------------------
Date: 26 May 2000 16:17:28 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: join " ", do {$x++}, do {$x++}, do {$x++};
Message-Id: <8gm82o$fi3$1@pegasus.csx.cam.ac.uk>
Bart Lateur <bart.lateur@skynet.be> wrote:
>Hmmm... that isn't very explicit, isn't it? In scalar context, it is
>garanteed to be executed from left to right, but in list context, it's
>not said in so many words.
>
>Just a gap in the docs?
No gap in the docs. In general, the order of evaluation of expressions
is undefined, as in C. ',' in a scalar context is one of the few
exceptions.
Mike Guy
------------------------------
Date: Fri, 26 May 2000 09:23:02 -0500
From: "Tim" <tcuffel@exactis.com>
Subject: my $x vs. my ($x)
Message-Id: <ApwX4.1378$Rx.292977@den-news1.rmi.net>
Abigail wrote in message <8gkg6o$9nc$1@news.panix.com>...
>However, that's only part of your problem.
>
> ($var) = EXPR1 or die;
>
>the assignment is in list context. If EXPR1 returns undef, the result
>of ($var) = EXPR1 is (undef), a *LIST* of one element. One would expect
>that such a list in scalar context returns its element, but assignment
>is special. A "list" assignment in scalar context returns the number
>of elements of the list on the right hand side of the assignment.
>(I fail to use why that's useful at the moment.)
We have a minor holy war at work. Most of our code uses my ($x) to
declare lexicals. I think this is poor style, because it is not
equivalent to my $x, and can lead to errors like the one above. Plus it
looks dumb (my is not a function, dammit! :) ). I suspect it is a result of
some cargo cult programming, where one rare case needed my ($x) = @_ in order
to work, and it became a standard without truly understanding what was going on.
However, I have seen my ($x) in posted code, some of the books, and other
semi-respectable sources. Is there any kind of concensus on which is more
appropriate?
------------------------------
Date: 26 May 2000 09:29:47 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: my $x vs. my ($x)
Message-Id: <m1n1ldff5w.fsf@halfdome.holdit.com>
>>>>> "Tim" == Tim <tcuffel@exactis.com> writes:
Tim> However, I have seen my ($x) in posted code, some of the books, and other
Tim> semi-respectable sources. Is there any kind of concensus on which is more
Tim> appropriate?
Depends on what you want:
my $x = @_; # number of elements passed to this subroutine
my ($x) = @_; # first element
So, it's not a matter of which is "right", but which is "right for the
use". You gotta know about both.
--
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: Fri, 26 May 2000 10:57:13 -0500
From: "Tim" <tcuffel@exactis.com>
Subject: Re: my $x vs. my ($x)
Message-Id: <PNxX4.1704$Rx.296215@den-news1.rmi.net>
Randal L. Schwartz wrote in message ...
>>>>>> "Tim" == Tim <tcuffel@exactis.com> writes:
>
>Tim> However, I have seen my ($x) in posted code, some of the books, and other
>Tim> semi-respectable sources. Is there any kind of concensus on which is more
>Tim> appropriate?
>
>Depends on what you want:
>
> my $x = @_; # number of elements passed to this subroutine
> my ($x) = @_; # first element
>
>So, it's not a matter of which is "right", but which is "right for the
>use". You gotta know about both.
Right. When one works and the other doesn't, it is real easy to decide.
What I want to know is which is better when it doesn't matter. I see
a lot of stuff like:
my ($x) = 42;
which I think is kinda silly. But I see it a lot, so I was wondering if
someone has ever made a call on this.
------------------------------
Date: Fri, 26 May 2000 07:50:22 -0700
From: Marc Pestana <markp@mail1.jpl.nasa.gov>
Subject: Re: Namespace question
Message-Id: <392E8F29.9A75F7BC@mail1.jpl.nasa.gov>
Hello friend,
The marvelous wonderful thing about PERL is the consistancy of the
syntax. So, yes, &foo::bar() is the fully qualified name of bar()
outside of foo. You could use the exporter module to import bar() into
the namespace of another package. Create a file that contains the
following
package foo;
use Exporter ();
@ISA = qw(Exporter);
sub bar {
#do things
}
EOF
then in the file into which you would import foo,
package soandso;
use foo;
#do things with bar() and not foo::bar()
I hope this helps. Marc P
------------------------------
Date: 26 May 2000 15:15:21 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: newbie question - dbi:mysql
Message-Id: <8gm4e9$nbb$0@216.155.32.216>
In article <392CDCB3.3E0AB73B@ford.com>, Richard Hardicre
<rhardicr@ford.com> wrote:
| just check the value of the return code on the way out:
| try:
| $sth->prepare(blah);
| my $rc = $sth->execute;
| if ($rc eq '0E0') {
| print "failed\n";
| }
how many people, upon reading this, suddenly heard voices from "Wizard
of Oz" chanting in the background?
aside from the fact that you knew the error code was '0E0', how would
one discover this obscure code .. reading the pod manual in DBI::MYSQL ?
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Fri, 26 May 2000 15:58:13 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: newbie question - dbi:mysql
Message-Id: <8gm6ub$b8p$1@nnrp1.deja.com>
In article <392CDCB3.3E0AB73B@ford.com>,
Richard Hardicre <rhardicr@ford.com> wrote:
> Jon Andrew wrote:
> >
> > Forgive me if this is blindingly obvious - probably a case of wood
not being
> > seen for the trees.
> >
> > I am writing a script to insert values into a Mysql database using
dbi from
> > an html form. The script is at a point where it inserts the values
ok,
> > however I would like to verify that the sql insert statement has
completed
> > successfully. How do I do this? Is it via the Do () function? If so
how do I
> > access the rows affected information? I have just noted that $rv is
returned
> > by Do() would I just need to print the content of the variable?
> >
> > I would also be grateful if somebody could point me in the direction
of a
> > good online dbi tutorial/information - I have looked at the
'official FAQ'
> > but that didn't really help me on this occasion.
> >
> > Many thanks.
>
> just check the value of the return code on the way out:
> try:
> $sth->prepare(blah);
> my $rc = $sth->execute;
why not just:
$sth->execute() || die $dbh->errstr;
like it says in the doc?
> if ($rc eq '0E0') {
> print "failed\n";
> }
>
> Richard H
>
--
Some drink at the fountain of knowledge...others just gargle.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 26 May 2000 15:16:43 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Newbie: DIV
Message-Id: <7awvkh4a02.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>
Stephan Canisius <SCanisius@dusnet.de> writes:
> Cal anyone tell me, how i can do a DIV in Perl 5.???
What's a DIV?
> A function which gives me back a "3" if I give it 10 and 3.
>
> 10/3 is 3.333333333 and I only want the 3 given to me.
Do you mean you want to round 3.333333 to 3? Checkout the FAQs:
perldoc -q round
my $div = sprintf "%.0f", 10/3;
--Ala
------------------------------
Date: Fri, 26 May 2000 16:16:11 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: Newbie: DIV
Message-Id: <8gm7vq$c5k$1@nnrp1.deja.com>
In article <392E0DD3.F01F4E98@dusnet.de>,
Stephan Canisius <SCanisius@dusnet.de> wrote:
> Hi Guys!
>
> Cal anyone tell me, how i can do a DIV in Perl 5.???
>
> A function which gives me back a "3" if I give it 10 and 3.
>
> 10/3 is 3.333333333 and I only want the 3 given to me.
int(10/3);
=========================
see:
perldoc -q integer
perldoc -f int
>
> Thanks
>
> Stephan
>
>
--
Some drink at the fountain of knowledge...others just gargle.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 26 May 2000 16:26:10 GMT
From: The WebDragon <nospam@devnull.com>
Subject: oops Re: seeking method to encode email addresses in web page forms
Message-Id: <8gm8j2$vg6$1@216.155.32.216>
In article <392CF01C.BE324457@stomp.stomp.tokyo>, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:
| $email = "callgirl\@la.znet.com";
DOH, forgot one thing too.. you can leave off escaping the @ if you use
$email = 'callgirl@la.znet.com';
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Fri, 26 May 2000 10:13:02 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: oops Re: seeking method to encode email addresses in web page forms
Message-Id: <392EB09E.B018AB1F@stomp.stomp.tokyo>
The WebDragon wrote:
> Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> | $email = "callgirl\@la.znet.com";
> DOH, forgot one thing too.. you can leave off escaping
> the @ if you use
> $email = 'callgirl@la.znet.com';
However, I am not using apostrophes for quotes.
This @ character needs to be escaped or a syntax
error is encountered.
Would you mind citing a rule indicating I must
use apostophes for quote marks? Seems a matter
of personal preference, when syntax variations
are used correctly.
You have tried to force a method upon me. Now
it is my turn. Henceforth, you will wear your
pants inside out to prevent thieves from
picking your pockets. You will do this.
Godzilla!
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3175
**************************************