[18355] in Perl-Users-Digest
Perl-Users Digest, Issue: 523 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 19 00:05:48 2001
Date: Sun, 18 Mar 2001 21:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <984978310-v10-i523@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 18 Mar 2001 Volume: 10 Number: 523
Today's topics:
Re: (OFF TOPIC - IGNORE) Re: Beginners question please (Miguel Cruz)
error =? <anjan50@home.com>
Help Putting data from an file that Perl reads into a J (Falc2199)
Re: Moving and mkdir in Unix <mjcarman@home.com>
Re: Perl for Windows <carvdawg@patriot.net>
Re: Print "tar" Success or Failure (BUCK NAKED1)
Re: Print "tar" Success or Failure (BUCK NAKED1)
Re: Print "tar" Success or Failure (Garry Williams)
readdir out of memory mike at NOSPAM whatibelieve dot org
Re: readdir out of memory (Eric Bohlman)
Re: Restricting access using passwords <mike@NOSPAMcomputersurgery.com>
Sub question <hafateltec@hotmail.com>
Re: Sub question (Paul Tomblin)
Re: Sub question <krahnj@acm.org>
Re: Sub question <persicom@acedsl.com>
Re: Sub question <mjcarman@home.com>
Re: Sub question (Tad McClellan)
Re: Sub question <uri@sysarch.com>
supporting ssl. <jekim@etri.re.kr>
Re: supporting ssl. <anjan50@home.com>
use Net::SMTP <jtjohnston@courrier.usherb.ca>
web robot <vincentg@datashaping.com>
Re: web robot (Damian James)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 19 Mar 2001 04:04:01 GMT
From: mnc@admin.u.nu (Miguel Cruz)
Subject: Re: (OFF TOPIC - IGNORE) Re: Beginners question please help on the verge of throwing PC out the window
Message-Id: <Ryft6.10439$on6.4251072@typhoon2.ba-dsg.net>
In article <3AB53DDC.5BEA4517@la.znet.com>, Kira <callgirl@la.znet.com> wrote:
> My system is not enabled for Russian Cyrillic characters, nor is yours.
You can't determine that; Agent, unlike Netscape, doesn't say.
> I've also read this "I speak Russian" story before, a number of times.
One potential explanation for this is that there are in fact hundreds of
millions of Russian-speakers on this planet.
miguel
------------------------------
Date: Mon, 19 Mar 2001 03:01:53 GMT
From: <anjan50@home.com>
Subject: error =?
Message-Id: <BEet6.397108$w35.63420054@news1.rdc1.nj.home.com>
Response.pm: BEGIN not safe after errors--compilation aborted at
GKGSRS/Response.pm l
------------------------------
Date: 19 Mar 2001 03:16:57 GMT
From: falc2199@aol.comNOJUNK (Falc2199)
Subject: Help Putting data from an file that Perl reads into a JavaScript array
Message-Id: <20010318221657.07323.00002080@ng-fn1.aol.com>
I have been trying for the past week to get information from a file that Perl
reads into a JavaScript array.
Can anyone help me figure this out? As of right now I am getting a syntax error
at the open command.
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<html><h1>Hello!</h1></html>\n";
print <<ENDOFHTML
script <language = "javascript" >
var questions = [
ENDOFHTML
open (QUESTIONS, "questions.txt");
$line = <QUESTIONS>;
chop($line);
chop($line);
print "\"$line\"";
while($line = <QUESTIONS>)
{
chop($line);
chop($line);
print ",\"$line\"";
}
print <<END
];
var i;
for (i = 0; i < questions.length; i++)
{
alert("The value of question is " + questions[i]);
}
</script>
</html>
END
Jehan
To e-mail, remove NOJUNK
------------------------------
Date: Mon, 19 Mar 2001 02:47:08 GMT
From: Michael Carman <mjcarman@home.com>
Subject: Re: Moving and mkdir in Unix
Message-Id: <3AB57381.733B0EB1@home.com>
[Posted and mailed.]
Milliwave wrote:
>
> I need to some to inform me by means of an example how would go
> about what I have asked for, as I don't have access to the perldoc
> manuals
Here's what you think you said:
"I don't think I have the documentation, so please take pity on
a poor soul and help me out."
Here's what that sounds like on Usenet:
"I don't think I have the documentation, and I'm too lazy to
look for it. I'd rather have you read it to me. Better yet,
fix my problem for me."
Not quite the same, huh? As you might expect, people get upset when
someone says the latter and are not inclined to help.
Part of the problem, you see, is that I don't believe that you don't
have access to the docs. The documentation is part of the standard
distribution. Unless you have a broken installation or are on a
rare/exotic platform, you have it - right there on the very same
computer that you're running perl from. Even if it's not on your
computer (doubtful) you still have access to it if you have access to
the web, or FTP. All you have to do is type 'perldoc' into your favorite
search engine. http://www.perldoc.com is the very first thing that
Google turns up.
A person is expected to spend 10-15 minutes of their own time searching
the docs and trying to answer their own question before posting. "Not
having" them isn't accepted as an excuse here. If you don't know where
they are, find them. If you don't have them, get them.
So as you can see, you kind of hit a nerve around here by saying that.
Try not to do it again, okay? :)
-mjc
------------------------------
Date: Sun, 18 Mar 2001 22:30:22 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: Perl for Windows
Message-Id: <3AB57D4E.5174C4DB@patriot.net>
> Is Activestate teh only binary compiled.
Nope. IndigoPerl has the Apache webserver compiled into it.
> I don't the most recent
> compile.
Syntax error: missing verb
> What I do need is to install lib-net.
Comes with ActiveState.
It might also help if you included the os you're using, as well as your
current version
of Perl (ie, output of "perl -v")
------------------------------
Date: Sun, 18 Mar 2001 20:08:07 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Print "tar" Success or Failure
Message-Id: <27990-3AB56A07-98@storefull-244.iap.bryant.webtv.net>
garry@ifr.zvolve.net (Garry=A0Williams)
> No clue. What does "doesn't work" mean?
Sorry. It means that I get a zombie whether the tar operation is
successful or fails.
> Further code would be appreciated.
> Why not post the code (cut and pasted) > you're having a problem with
and the results
> you expected and the results you got?
Here is the real code, cut and pasted. I expect the following code it to
either (1) make $tmpdir, and untar $tmpfile to $tmpdir OR (2) die and
print a custom failure message, remove $tmpdir and $tmpfile and exit the
program. (Again, the result was a zombie.)
[$tmpdir and $tmpfile are defined above this part in the script]
mkdir $tmpdir, 0705;
system("tar -zxf $tmpfile -C $tmpdir 2>&1, Tarfile has been Extracted")
|| print "<HTML><BODY><!--#echo banner=3D''--><font size=3D4
face=3DVerdana,Arial color=3D990033>Un-Tar FAILED</font></BODY>/HTML>\n",
rmdir $tmpdir, unlink $tmpfile, exit;
Best regards,
--Dennis
------------------------------
Date: Sun, 18 Mar 2001 20:31:28 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Print "tar" Success or Failure
Message-Id: <28809-3AB56F80-14@storefull-245.iap.bryant.webtv.net>
> bart.lateur@skynet.be (Bart=A0Lateur)
> > BUCK NAKED1 wrote:
> > I've tried...
> > if (system("tar -zxf $tmpfile -C $tmpdir 2>&1")=3D=3D0) {
> > print "SUCCESS";
> > }
> > else {print "FAILURE";
> > };
> > ..and this doesn't work. Why?
> Probably because this tar doesn't return > a proper exit value.
Hmmm... I thought I learned from the other thread where I asked about
this that "tar" returned a value of "0" upon success, so why is an exit
value of "0" wrong?
> But why are you using system()? What is
> the output from tar to STDOUT good for?
> Wouldn't it be better to capture it, by using
> backticks ("`") instead of system(), and parsing
> tar=B4s textual output? Plus, the user need > never see it.
That was another question I had (whether I should've used backticks
instead), but I didn't want to ask too many questions. Thanks for
answering it. Here is my revised code replacing "system" with
"backticks," and adding a "\n" after Extracted.
mkdir $tmpdir, 0705;
`tar -zxf $tmpfile -C $tmpdir 2>&1, Tarfile has been Extracted\n`=3D=3D0 |=
|
print "<HTML><BODY><!--#echo banner=3D''-->
<font size=3D4 face=3DVerdana,Arial color=3D990033>
Un-Tar FAILED</font></BODY>/HTML>\n", rmdir $tmpdir, unlink
$tmpfile, exit;
Best regards,
--Dennis
------------------------------
Date: Mon, 19 Mar 2001 04:50:39 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Print "tar" Success or Failure
Message-Id: <slrn9bb40u.dd5.garry@zfw.zvolve.net>
On Sun, 18 Mar 2001 20:08:07 -0600 (CST), BUCK NAKED1
<dennis100@webtv.net> wrote:
> garry@ifr.zvolve.net (Garry Williams)
>> No clue. What does "doesn't work" mean?
>
> Sorry. It means that I get a zombie whether the tar operation is
> successful or fails.
Well, now I am still confused. I know that "zombie" is sometimes used
to refer to a process that has exited, but whose parent has not
wait()ed on it, How would the code you've shown even know ("get"?)
that, let alone cause that?
>> Further code would be appreciated.
>> Why not post the code (cut and pasted) > you're having a problem with
>> and the results
>> you expected and the results you got?
>
> Here is the real code, cut and pasted. I expect the following code it to
> either (1) make $tmpdir, and untar $tmpfile to $tmpdir OR (2) die and
> print a custom failure message, remove $tmpdir and $tmpfile and exit the
> program. (Again, the result was a zombie.)
Again, what do you mean by that?
Does the shell not prompt again?
What shell _are_ you using?
By the way, how can the program "die", if you do not call die()? Your
second case seems to be out of order and your code does not call
die().
> [$tmpdir and $tmpfile are defined above this part in the script]
>
> mkdir $tmpdir, 0705;
> system("tar -zxf $tmpfile -C $tmpdir 2>&1, Tarfile has been Extracted")
This will not be taken well by the shell that will be called on behalf
of system(). It's a syntax error to the shell. Perhaps this is why
you don't get the result you were expecting.
> || print "<HTML><BODY><!--#echo banner=''--><font size=4
> face=Verdana,Arial color=990033>Un-Tar FAILED</font></BODY>/HTML>\n",
> rmdir $tmpdir, unlink $tmpfile, exit;
Do you have a broken semicolon key?
Your code would be a lot clearer and easier to understand and debug,
if you would separate this into the obvious cases:
[ untested ]
#!/usr/bin/perl -w
use strict;
my $tmpfile = "file.tar.gz";
my $tmpdir = "tmp";
mkdir $tmpdir, 0705 or die "mkdir $tmpdir failed: $!";
if ( my $rc = system "tar -zxf $tmpfile -C $tmpdir 2>&1" ) {
rmdir $tmpdir;
unlink $tmpfile;
die "un-tar failed with $rc";
}
else {
print "un-tar succeeded\n";
}
__END__
Here's a suggestion:
Run the command from the command line and print its exit status. How
you do that will depend on the shell you're using, but many shells
return the exit code from a command in the $? variable. That will
tell you what your program should expect. After that, try running the
version I included above. Was that what you expected?
Here's another suggestion:
Debug your problem from the command line before running this from a
Web server.
Here's another suggestion:
Re-read the system() section of the perlfunc manual page.
One last (minor) suggestion:
Check the advice about the mask used in mkdir() in the same manual
page.
Good luck!
--
Garry Williams
------------------------------
Date: 19 Mar 2001 04:14:58 GMT
From: mike at NOSPAM whatibelieve dot org
Subject: readdir out of memory
Message-Id: <994142615nf@news1.newsguy.com>
Problem:
this command causes machines to run out of memory.
> perl -e 'opendir (SCF_DIR, "_SCF"); @scf_files=(readdir(SCF_DIR)); print @scf_files;'
results in:
Out of memory!
(watching top I see that is takes up about 1GB of RAM before it finally dies)
BUT only on our Linux (2.2.14) machines.
Our Solaris (2.6) and SGI versions run fine. We compiled the linux version with
the 64 bit flags (gcc -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64) as
we did with Solaris.
The directory contains ~55,000 symbolic links that I need to read in
and then do something to each file. This statement was a part of a
larger program that I got down to this single point of failure.
This works with a directory of ~32,000 real files. Is there something
special with symbolic links for readdir ? or just too many files for readdir ?
I know I can patch it with a system call to `ls` and a split but
that doesn't seem proper. Any help would be appreciated.
Thanks,
Mike
Mike at REMOVE whatibelieve dot org
==================================
Posted via http://nodevice.com
Linux Programmer's Site
------------------------------
Date: 19 Mar 2001 05:03:09 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: readdir out of memory
Message-Id: <9943ud$6k9$1@bob.news.rcn.net>
mike wrote:
> Problem:
> this command causes machines to run out of memory.
>> perl -e 'opendir (SCF_DIR, "_SCF"); @scf_files=(readdir(SCF_DIR)); print @scf_files;'
> results in:
> Out of memory!
> (watching top I see that is takes up about 1GB of RAM before it finally dies)
> BUT only on our Linux (2.2.14) machines.
> Our Solaris (2.6) and SGI versions run fine. We compiled the linux version with
> the 64 bit flags (gcc -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64) as
> we did with Solaris.
> The directory contains ~55,000 symbolic links that I need to read in
> and then do something to each file. This statement was a part of a
How about calling readdir in scalar context so you get one entry at a
time? Since you haven't shown any code, I could be wrong about this, but
I've got a hunch that you're reading all the entries into an array and
then just looping over the array. No need to have them all in memory at
the same time if that's the case.
> larger program that I got down to this single point of failure.
> This works with a directory of ~32,000 real files. Is there something
> special with symbolic links for readdir ? or just too many files for readdir ?
> I know I can patch it with a system call to `ls` and a split but
> that doesn't seem proper. Any help would be appreciated.
------------------------------
Date: Mon, 19 Mar 2001 03:08:10 GMT
From: "Mike Scott" <mike@NOSPAMcomputersurgery.com>
Subject: Re: Restricting access using passwords
Message-Id: <uKet6.1749$oi6.1175733@news2.cableinet.net>
Damian
>> This is really a CGI question that is best taken up on
comp.infosystems.authoring.cgi... Hangman... HTH <<
Cheers - that's just the information I was looking for.
Mike.
------------------------------
Date: Mon, 19 Mar 2001 11:35:34 +1000
From: Michael McPherson <hafateltec@hotmail.com>
Subject: Sub question
Message-Id: <dtnabtg87k5k6ki01d4d1mbf9n3prkgjtu@4ax.com>
Question on subs.
sub common_query {
my $id = $_[0];
my @customer = queryrow("SELECT * FROM customer WHERE id = '$id'");
my @billing = queryrow("SELECT * FROM billing_address WHERE id =
'$id'");
my @servicetype = queryrow("SELECT * FROM phone_service WHERE id =
'$id'");
return (@customer,@billing,@servicetype);
}
In order to save programing I created the above sub.
I call this sub like such.
my $id = @q->param('id');
my (@customer,@billing,@servicetype) = common_query($id);
Now if I print here
my $id = @q->param('id');
my (@customer,@billing,@servicetype) = common_query($id);
print "@customer\n";
print "@billing\n";
print "@servicetype\n";
it ONLY prints my @customer array .......
However if I print here.
sub common_query {
my $id = $_[0];
my @customer = queryrow("SELECT * FROM customer WHERE id = '$id'");
my @billing = queryrow("SELECT * FROM billing_address WHERE id =
'$id'");
my @servicetype = queryrow("SELECT * FROM phone_service WHERE id =
'$id'");
print "@customer\n"; #HERE
print "@billing\n";
print "@servicetype\n";
return (@customer,@billing,@servicetype);
}
It prints all... I am wondering what am I doing wrong. Please help.
TYIA
------------------------------
Date: 19 Mar 2001 02:45:13 GMT
From: ab401@freenet.carleton.ca (Paul Tomblin)
Subject: Re: Sub question
Message-Id: <993rrp$d9a$1@freenet9.carleton.ca>
In a previous article, Michael McPherson <hafateltec@hotmail.com> said:
>return (@customer,@billing,@servicetype);
>my (@customer,@billing,@servicetype) = common_query($id);
I think you're returning one big array consisting off all three arrays
concatenated together. I think what you want to do is return references
to the three arrays.
return (\@customer, \@billing, \@servicetype);
my ($customerRef, $billingRef, $servicetypeRef) = common_query($id);
I'm a relative Perl newbie. I'm sure the old timers are going to come in
here and tell me how wrong I am, and then Godzilla will step in and tell
you to use LWP or something.
--
Paul Tomblin <ptomblin@xcski.com>, not speaking for anybody
There is no substitute for good manners, except, perhaps, fast reflexes.
------------------------------
Date: Mon, 19 Mar 2001 02:45:36 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Sub question
Message-Id: <3AB5744E.BE808447@acm.org>
Michael McPherson wrote:
>
> Question on subs.
>
> sub common_query {
> my $id = $_[0];
> my @customer = queryrow("SELECT * FROM customer WHERE id = '$id'");
> my @billing = queryrow("SELECT * FROM billing_address WHERE id =
> '$id'");
> my @servicetype = queryrow("SELECT * FROM phone_service WHERE id =
> '$id'");
> return (@customer,@billing,@servicetype);
This is the same as:
my @return = ( @customer, @billing, @servicetype );
return @return;
> }
>
> In order to save programing I created the above sub.
>
> I call this sub like such.
>
> my $id = @q->param('id');
> my (@customer,@billing,@servicetype) = common_query($id);
>
> Now if I print here
>
> my $id = @q->param('id');
> my (@customer,@billing,@servicetype) = common_query($id);
> print "@customer\n";
> print "@billing\n";
> print "@servicetype\n";
>
> it ONLY prints my @customer array .......
>
> However if I print here.
>
> sub common_query {
> my $id = $_[0];
> my @customer = queryrow("SELECT * FROM customer WHERE id = '$id'");
> my @billing = queryrow("SELECT * FROM billing_address WHERE id =
> '$id'");
> my @servicetype = queryrow("SELECT * FROM phone_service WHERE id =
> '$id'");
> print "@customer\n"; #HERE
> print "@billing\n";
> print "@servicetype\n";
> return (@customer,@billing,@servicetype);
> }
>
> It prints all... I am wondering what am I doing wrong. Please help.
perldoc perlsub
The return value of the subroutine is the value of the
last expression evaluated. Alternatively, a return
statement may be used to exit the subroutine, optionally
specifying the returned value, which will be evaluated in
the appropriate context (list, scalar, or void) depending
on the context of the subroutine call. If you specify no
return value, the subroutine will return an empty list in
a list context, an undefined value in a scalar context, or
nothing in a void context. If you return one or more
^^^^^^^^^^^^^^^^^^^^^^^^^
arrays and/or hashes, these will be flattened together
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
into one large indistinguishable list.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
John
--
use Perl;
program
fulfillment
------------------------------
Date: Sun, 18 Mar 2001 22:06:24 -0500
From: "Matthew O. Persico" <persicom@acedsl.com>
Subject: Re: Sub question
Message-Id: <3AB577B0.3F678CE7@acedsl.com>
Paul Tomblin wrote:
>
> In a previous article, Michael McPherson <hafateltec@hotmail.com> said:
> >return (@customer,@billing,@servicetype);
>
> >my (@customer,@billing,@servicetype) = common_query($id);
>
> I think you're returning one big array consisting off all three arrays
> concatenated together. I think what you want to do is return references
> to the three arrays.
>
> return (\@customer, \@billing, \@servicetype);
>
> my ($customerRef, $billingRef, $servicetypeRef) = common_query($id);
>
> I'm a relative Perl newbie. I'm sure the old timers are going to come in
> here and tell me how wrong I am, and then Godzilla will step in and tell
> you to use LWP or something.
Nope, you are correct. When you return multiple values from a subroutine
(or pass multiple values TO a sub, for that matter), all of the values
are "flattened" into one big list. Arrays are flattened into the list of
elements. Hashes are flattened into a list fo key, value pairs, order
undefined. All of these are joined into one big list and passed up or
down.
Ad Paul says, if you do NOT want flattening, pass refs.
However, upon further examination of the code, I'd like to ask these
questions:
1) Are the three arrays related?
2) Are you expecting the i'th elements of the three arrays to be
coordinated? Meaning that
the billing type for $customer[6] is $billing[6]? Ditto for
$servicetype[6]?
If not, then fine. If so, you are NOT guarranteed that this will occur -
there is no common sort clause on the queries and an RDBMS is not
guarranteed to give out results in the same order entered (assuming that
these data are entered in some coordinated manner). If you have been
getting them out coordinated, you are a very lucky coder.
--
Matthew O. Persico
http://www.acecape.com/dsl
AceDSL:The best ADSL in Verizon area
------------------------------
Date: Mon, 19 Mar 2001 03:14:04 GMT
From: Michael Carman <mjcarman@home.com>
Subject: Re: Sub question
Message-Id: <3AB579D2.667E88CF@home.com>
Michael McPherson wrote:
>
> Question on subs.
>
> sub common_query {
> my $id = $_[0];
> my @customer = queryrow("SELECT * FROM customer WHERE id = '$id'");
> my @billing = queryrow("SELECT * FROM billing_address WHERE id =
> '$id'");
> my @servicetype = queryrow("SELECT * FROM phone_service WHERE id =
> '$id'");
> return (@customer,@billing,@servicetype);
> }
>
> In order to save programing I created the above sub.
>
> I call this sub like such.
>
> my $id = @q->param('id');
> my (@customer,@billing,@servicetype) = common_query($id);
Stop right there -- you've missed one very important detail about how
subroutines are implemented in Perl: All arguments and return values are
flattened into a single list. The three arrays you're returning are
getting mushed into one. (cf. the perlsub manpage)
If you want to pass multiple arrays you need to use references. (cf. the
perlref and perlreftut manpages)
One way to do it is to return arrayrefs:
sub common_query {
my $id = shift;
my @customer =
queryrow("SELECT * FROM customer WHERE id = '$id'");
my @billing =
queryrow("SELECT * FROM billing_address WHERE id = '$id'");
my @servicetype =
queryrow("SELECT * FROM phone_service WHERE id = '$id'");
return (\@customer, \@billing, \@servicetype);
}
my $id = @q->param('id');
my ($customer, $billing, $servicetype) = common_query($id);
print "@{$customer}\n";
#...
But if you would rather have full arrays outside your sub instead of
references, you can pass references in instead of getting them back:
sub common_query {
my ($id, $customer, $billing, $servicetype) = @_;
@{$customer} =
queryrow("SELECT * FROM customer WHERE id = '$id'");
@{$billing} =
queryrow("SELECT * FROM billing_address WHERE id = '$id'");
@{$servicetype} =
queryrow("SELECT * FROM phone_service WHERE id = '$id'");
}
my $id = @q->param('id');
my (@customer, @billing, @servicetype);
common_query($id, \@customer, \@billing, \@servicetype);
print "@customer\n";
#...
-mjc
------------------------------
Date: Sun, 18 Mar 2001 21:28:30 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Sub question
Message-Id: <slrn9barme.2ju.tadmc@tadmc26.august.net>
Paul Tomblin <ab401@freenet.carleton.ca> wrote:
>In a previous article, Michael McPherson <hafateltec@hotmail.com> said:
>>return (@customer,@billing,@servicetype);
>
>>my (@customer,@billing,@servicetype) = common_query($id);
>
>I think you're returning one big array consisting off all three arrays
^^^^^
list, not array.
>concatenated together. I think what you want to do is return references
>to the three arrays.
>
>return (\@customer, \@billing, \@servicetype);
>
>my ($customerRef, $billingRef, $servicetypeRef) = common_query($id);
>
>
>I'm a relative Perl newbie. I'm sure the old timers are going to come in
>here and tell me how wrong I am,
Yes, you are wrong about what the old timers will say.
No, you are not wrong about how to fix the OP's problem.
:-)
>and then Godzilla will step in and tell
>you to use LWP or something.
But nobody with any sense even sees her posts, so it won't matter much
what she does.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 19 Mar 2001 04:26:49 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Sub question
Message-Id: <x7u24q4c50.fsf@home.sysarch.com>
>>>>> "MM" == Michael McPherson <hafateltec@hotmail.com> writes:
MM> sub common_query {
MM> my $id = $_[0];
MM> my @customer = queryrow("SELECT * FROM customer WHERE id = '$id'");
MM> my @billing = queryrow("SELECT * FROM billing_address WHERE id =
MM> '$id'");
MM> my @servicetype = queryrow("SELECT * FROM phone_service WHERE id =
MM> '$id'");
MM> return (@customer,@billing,@servicetype);
MM> }
plenty of others corrected your return bug. but i have comments about
your coding style.
first, use of $_[0] is not typical unless you need the speedup. it is
much more common and clearer to use:
my $id = shift ;
or
my( $id ) = @_ ;
secondly, your code has no indenting and that makes it very hard to
read. read perlstyle and learn how to indent it.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Mon, 19 Mar 2001 11:21:31 +0900
From: "±èÁö¾ð" <jekim@etri.re.kr>
Subject: supporting ssl.
Message-Id: <993qaa$lqj$1@news2-2.kornet.net>
Hi all.
I installed Apache-SSL webserver.
I want to communicate with SSL.
Do you have perl example using HTTPS protocol.
I don't care any type.
Thank you.
------------------------------
Date: Mon, 19 Mar 2001 04:06:42 GMT
From: <anjan50@home.com>
Subject: Re: supporting ssl.
Message-Id: <mBft6.397721$w35.63457972@news1.rdc1.nj.home.com>
Any page should work with SSL just put
https://www.yoursite.com/test.html
where test.html is any html in root of web server
±èÁö¾ð <jekim@etri.re.kr> wrote in message
news:993qaa$lqj$1@news2-2.kornet.net...
> Hi all.
> I installed Apache-SSL webserver.
> I want to communicate with SSL.
> Do you have perl example using HTTPS protocol.
> I don't care any type.
> Thank you.
>
>
------------------------------
Date: Sun, 18 Mar 2001 23:53:44 -0500
From: jtjohnston <jtjohnston@courrier.usherb.ca>
Subject: use Net::SMTP
Message-Id: <3AB590D8.822A24C2@courrier.usherb.ca>
Whimper, I can't get this to work. it keeps crashing.
Can anyone help me clean the lines up? There must be something real
simple i'm not doing right. It keeps crashing my smtp. It used to work?
An email reply & post would be helpful. My nntp erases posts before I
can get back to them.
--snip--
$email = "delete.jtjohnston\@courrier.usherb.ca";
$recip = "delete.eslcafe\@interlinx.qc.ca";
$url = "../me.htm";
use Net::SMTP;
$smtp = Net::SMTP->new('delete.interlinx.qc.ca', Debug => 1);
$smtp->mail($ENV{USER});
$smtp->to('$email');
$smtp->data();
$smtp->datasend("From: $recip\n");
$smtp->datasend("To: $email\n");
$smtp->datasend("\n");
$smtp->datasend("A simple test message\n");
$smtp->datasend(".");
$smtp->dataend();
$smtp->quit;
print "Location: $url\n\n";
------------------------------
Date: Mon, 19 Mar 2001 04:40:45 GMT
From: Vincent Granville <vincentg@datashaping.com>
Subject: web robot
Message-Id: <3AB58AA4.12A743B7@datashaping.com>
The source code (Perl) is free. What you pay for is advanced technical
support to help you design your own applications. The program comes with
a sample application to download stock quotes. Available at
http://www.datashaping.com/robot.shtml
------------------------------
Date: 19 Mar 2001 04:56:42 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: web robot
Message-Id: <slrn9bb4bp.sul.damian@puma.qimr.edu.au>
Vincent Granville chose Mon, 19 Mar 2001 04:40:45 GMT to say this:
>The source code (Perl) is free. What you pay for is ...
Egads!!!
*plonk*
------------------------------
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 V10 Issue 523
**************************************