[18915] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1083 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 7 11:05:49 2001

Date: Thu, 7 Jun 2001 08:05:08 -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: <991926308-v10-i1083@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 7 Jun 2001     Volume: 10 Number: 1083

Today's topics:
    Re: (csv) Split at a coma, how? <fty@mediapulse.com>
        [Net::SSLeay] warnings/failure under mod_perl <tinamue@zedat.fu-berlin.de>
        Checking for function existence (Grunge Man)
    Re: Date of Halloween (for Date::Calc module)? (Randal L. Schwartz)
    Re: Decoding file mode (expressionlibre)
    Re: Eval, the $ string, backslash escaping, and the adv (Bernard El-Hagin)
    Re: Eval, the $ string, backslash escaping, and the adv (Tad McClellan)
    Re: Executing shell command? (Jon Bell)
    Re: Executing shell command? <jurgenex@hotmail.com>
    Re: Flame,help or killfile ? (Helgi Briem)
    Re: GROUP TAKEOVER IN PROGRESS (Shawn Michael Taub)
    Re: GROUP TAKEOVER IN PROGRESS (Larry Ebbitt)
        INTERFACE: in *.xs does not work (perl bug?) <makler@man.torun.pl>
    Re: pack = lousy performance <NoSpam@SpammerKiller.com>
        Perl  HTTP & SSL <dennis.kowalsk@daytonoh.ncr.com>
    Re: Perl  HTTP & SSL <comdog@panix.com>
    Re: Starting a background job (Tweetie Pooh)
        Strange warning in substitution <der.prinz@gmx.net>
    Re: WebForm Processing With 2 File Attachments - Script <fty@mediapulse.com>
        Why does this work? <gpitman@nb.net>
    Re: Why does this work? (Bernard El-Hagin)
    Re: Why does this work? <gpitman@nb.net>
    Re: Why does this work? <gpitman@nb.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 07 Jun 2001 13:21:57 GMT
From: "Jay Flaherty" <fty@mediapulse.com>
Subject: Re: (csv) Split at a coma, how?
Message-Id: <VdLT6.100597$fb7.11452651@bin1.nnrp.aus1.giganews.com>

"John Joseph Trammell" <trammell@bayazid.hypersloth.invalid> wrote in
message news:slrn9hsot9.21o.trammell@bayazid.hypersloth.net...
> On Wed, 06 Jun 2001 14:57:12 GMT, Steve Martin wrote:
> > I am doing a small script that opens a weekly schedule that an
> > admin assist is producing and saving in .csv.
>
> I'll help you, but first I want you to do that one trick
> where you suck a piano into your lungs.
>
Steve, are you still mad at your mother? Does she still want to borrow money
for some FOOD!?

Jay
R-A-M-B-L-I-N...apostrophe...RAMBLIN'




------------------------------

Date: 7 Jun 2001 13:53:38 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: [Net::SSLeay] warnings/failure under mod_perl
Message-Id: <9fo112$4q5t0$1@fu-berlin.de>

hi,

i've got some problems with the Net::SSLeay-module.
(Version 1.04, 31.3.1999) (same problems with 1.05)
i'm using the post_https-method like this:

my %form = (key => "value", key2 => "value2", ...);
my($page, $response, %reply_headers) = 
     post_https('secure.server.com', 443, '/path', '', make_form( %form ));
print "Result was $response\n";
foreach my $h (sort keys %reply_headers) {
    print "Header $h =\t$reply_headers{$h}\n";
}


with turned on warnings i get:
Argument "secure.server.com" isn't numeric in entersub at
   /www/apps/perl/lib/site_perl/5.005/sun4-solaris/Net/SSLeay.pm line 348.
Argument "secure.server.com" isn't numeric in entersub at
   /www/apps/perl/lib/site_perl/5.005/sun4-solaris/Net/SSLeay.pm line 348.
Argument "/etc/passwd" isn't numeric in entersub at
   /www/apps/perl/lib/site_perl/5.005/sun4-solaris/Net/SSLeay.pm line 348.
Use of uninitialized value at blib/lib/Net/SSLeay.pm
    (autosplit into blib/lib/auto/Net/SSLeay/https_cat.al) line 1313.
Use of uninitialized value at blib/lib/Net/SSLeay.pm (autosplit
     into blib/lib/auto/Net/SSLeay/https_cat.al) line 1314.
Result was HTTP/1.1 200 OK
Header CONNECTION =     close
Header CONTENT-LENGTH = 0
Header CONTENT-TYPE =   text/plain
Header DATE =   Thu, 07 Jun 2001 13:19:20 GMT
Header SERVER = Apache/1.3.19 (Unix) Resin/1.2.5 mod_ssl/2.8.3 OpenSSL/0.9.6a

everything's fine, except the warnings. the ssl-server is getting the
correct data.
however, if i run this in a script under mod_perl (i don't know
the version but I can ask if it is needed) i get these warnings in the
error.log, plus the following line:
 [notice] child pid 26153 exit signal Segmentation Fault (11)

and there is no response and no data sent to the ssl-server.
has anybody had similar problems?
i don't see any further possibilities to debug, because there is
just this child-exit notice and nothing else.

thanks for any hints,
tina

-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \ _,_\ __/\ __/_| /__/ perception
please don't email unless offtopic or followup is set. thanx


------------------------------

Date: Thu, 7 Jun 2001 14:35:08 +0000 (UTC)
From: grunge12345@hotmail.com (Grunge Man)
Subject: Checking for function existence
Message-Id: <LAW2-F48GWtiBhBpQs100000f3f@hotmail.com>


I would like to be able to check if a function exists
for a particular dynamically named package.

Something like the following would be good:
    $package = "SomePackage";
    if (defined $package'SomeFn()) {
        $package'SomeFn();
    }

but doesn't work. In fact I cannot even call:
    $package'SomeFn();

as Perl syntax doesn't seem to allow it.

Hence I have also tried:
    eval($package . "'SomeFn() if defined " . $package . "'SomeFn()");

but although the
    eval($package . "'SomeFunction()");

bit works, the defined bit still eludes me.

Does anyone know how to do this?

Thanks in advance
G

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.



-- 
Posted from [195.21.255.6] by way of law2-f48.hotmail.com [216.32.181.48] 
via Mailgate.ORG Server - http://www.Mailgate.ORG


------------------------------

Date: 07 Jun 2001 07:34:23 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Date of Halloween (for Date::Calc module)?
Message-Id: <m1n17k4avk.fsf@halfdome.holdit.com>

>>>>> "Steffen" == Steffen Beyer <sb@engelschall.com> writes:

Steffen> I suppose that this day (being no official holiday in the
Steffen> U.S.) doesn't follow the rule that if it falls on a weekend,
Steffen> it is substituted by the following Monday (like most of the
Steffen> offical U.S. american holidays)?  Is that correct?

Right.  Holidays only move around in the US when some Labor Union has
decided that it's a day off, and then paid the appropriate money to a
congresscritter to get them to make it a moving holiday instead of a
stationary holiday to ensure that "day off" is an actual benefit
instead of being absorbed into a weekend.

Unions.  Sheesh.  Still hanging around long past their actual use.

-- 
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: 7 Jun 2001 06:54:05 -0700
From: expression_libre@yahoo.com (expressionlibre)
Subject: Re: Decoding file mode
Message-Id: <83c74064.0106070554.1b2bab1a@posting.google.com>

"Samuel Kilchenmann" <skilchen@swissonline.ch> wrote 
in message news:<9flegf$4kgro$1@ID-13368.news.dfncis.de>...


> Some time back in 1999 i tried to reimplement the mode_string routine
> from GNU's ls in Perl. I've added your testcases and it looks like it
> produces the expected results:
> perl mode_string.pl produces the following output:
> mode: 33204, mode_string: -rw-rw-r--
> mode: 41471, mode_string: lrwxrwxrwx
> mode: 16868, mode_string: drwxr--r--

Fine, this works quite well on my Solaris Perl (latest version).
Problem : this is not portable on IBM-AIX Perl (latest version!),
because POSIX module seems not to be the same !!

 ;o(


------------------------------

Date: Thu, 7 Jun 2001 13:10:25 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Eval, the $ string, backslash escaping, and the adventures thereof
Message-Id: <slrn9huujj.8e2.bernard.el-hagin@gdndev25.lido-tech>

On 7 Jun 2001 05:59:13 -0700, dave <usted@cyberspace.org> wrote:
>$translate_dollar_sign = "\$$key =~ s/\$/(dollar-sign)/g";
>eval "$translate_dollar_sign";
>if ($@) {bail ("Error stripping \$$key $@");} 
>
>This code replaces the end of line with "(dollar-sign)" when I want it
>to replace the character '$'.  Backslashing doesn't help, it is still
>a $ EOL to the regexp.  I thought that maybe the eval was affecting
>it, but the eval doesn't have any variables to interpret.  Any ideas?

Try:

$translate_dollar_sign = "\$$key =~ s/\\\$/(dollar-sign)/g";

Cheers,
Bernard
--
perl -l54e's yyw q q tvmrx "h\ywx ersxliv zivp legoiv"qiy;y #a-zA-Z#d-gu-z#
chefghijklmnopqrstuvwxyzcJab-def-uPwxyzc;s j j s u u s t t s r r s
ppevalpereeteueje'


------------------------------

Date: Thu, 7 Jun 2001 08:27:13 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Eval, the $ string, backslash escaping, and the adventures thereof
Message-Id: <slrn9husp1.9dm.tadmc@tadmc26.august.net>

dave <usted@cyberspace.org> wrote:
>$translate_dollar_sign = "\$$key =~ s/\$/(dollar-sign)/g";
>eval "$translate_dollar_sign";
>if ($@) {bail ("Error stripping \$$key $@");} 
>
>This code replaces the end of line with "(dollar-sign)" 


It does?

I don't see how it does that. Looks like a syntax error when I try it...


>when I want it
>to replace the character '$'.  Backslashing doesn't help


Yes it does, but the regex engine is not seeing a backslash in
front of the dollar sign.


>I thought that maybe the eval was affecting
>it, 


I think it is the double quotes affecting it  :-)


>Any ideas?


   print "$translate_dollar_sign\n";  # see what perl sees



You appear to be using Symbolic References.

DON'T!

   http://www.plover.com/~mjd/perl/varvarname.html
   http://www.plover.com/~mjd/perl/varvarname2.html
   http://www.plover.com/~mjd/perl/varvarname3.html


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Thu, 7 Jun 2001 13:18:50 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: Executing shell command?
Message-Id: <GEKABE.Kr9@presby.edu>

In article <3B1F6DB2.FEC3C248@statoil.com>,
Heine Kolltveit  <heinko@statoil.com> wrote:
>The admin hasn't installed perldoc. 

In that case you can read the documentation on the Web at 
<http://www.perl.com/pub/v/documentation>.

-- 
Jon Bell <jtbell@presby.edu>                        Presbyterian College
Dept. of Physics and Computer Science        Clinton, South Carolina USA


------------------------------

Date: Thu, 7 Jun 2001 07:53:59 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Executing shell command?
Message-Id: <3b1f9575@news.microsoft.com>

"Heine Kolltveit" <heinko@statoil.com> wrote in message
news:3B1F6DB2.FEC3C248@statoil.com...
> The admin hasn't installed perldoc.

Please ask the admin to reinstall Perl because the current installation is
broken.

jue




------------------------------

Date: Thu, 07 Jun 2001 13:04:30 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: Flame,help or killfile ?
Message-Id: <3b1f7ac8.706750153@news.isholf.is>

On Thu, 7 Jun 2001 02:28:26 +0200, buggs
<buggs-clpm@splashground.de> wrote:

>I actually found very interesting the difference between
>how Larry percieved this newsgroup some years ago
>and the defacto.

Larry left because he could no longer endure
the off-topic ranting and the enormous noise
to signal ratio of the group.  Or so I have been
led to believe.

Comp.lang.perl.misc has proved to be a wonderful
resource for me in the two years since I started
using Perl.  But of course, I have used usenet for
more than 10 years, so I knew enough to read the
FAQ and lurk awhile to learn the netiquette of
the group before posting to it.

Regards,
Helgi Briem



------------------------------

Date: 7 Jun 2001 06:28:18 -0700
From: shawntaub@yahoo.ca (Shawn Michael Taub)
Subject: Re: GROUP TAKEOVER IN PROGRESS
Message-Id: <d8fa40ef.0106070528.63eab5e0@posting.google.com>

alt.drugs.pot,comp.lang.javascript,comp.lang.perl.misc,comp.lang.python,comp.os.linux.misc

These were the places he sent it to.  Umm, yeah.  All these
programming languages and alt.drugs.pot is an interesting choice if
you are taking over the entire Usenet.

Actually, you kinda remind me of a cross between Gerry Falwell and
some American army official.
First off, nothing belongs to you.  All your base are belong to us,
foo.


****** This was posted with the express permission of *******
*************************************************************
**  HIS HIGHNESS SHAWN TAUB LORD AND MASTER OF NOTHINGNESS **
*************************************************************
********** We are simple servants of nobody's will **********


------------------------------

Date: 7 Jun 2001 13:39:32 GMT
From: BigLar@LEONARDO.localhost (Larry Ebbitt)
Subject: Re: GROUP TAKEOVER IN PROGRESS
Message-Id: <slrn9huibr.7l5.BigLar@leonardo.localdomain>

On 7 Jun 2001 04:52:28 GMT, David LeBlanc <whisper@oz.nospamnet> wrote:
> Don' you just hate it when they don't get their lithium?

ROFL!

-- 
Larry Ebbitt - Linux + OS/2 - Atlanta


------------------------------

Date: 7 Jun 2001 13:17:10 GMT
From: Piotr Klaban <makler@man.torun.pl>
Subject: INTERFACE: in *.xs does not work (perl bug?)
Message-Id: <9fnusm$e2d$1@flis.man.torun.pl>

Hi,

I tried to use INTERFACE: keyword in my xs file,
(described in perlxs manual), and it does not work.
Even the manual example:

<test.xs>
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

extern int multiply(int a, int b) {};
extern int divide(int a, int b) {};
extern int add(int a, int b) {};
extern int subtract(int a, int b) {};

MODULE = test           PACKAGE = test

int
interface_s_ss(arg1, arg2)
    int        arg1
    int        arg2
  INTERFACE:
    multiply divide
    add subtract
</test.xs>

complains during compilation:

gcc -c -I/usr/local/include -I/usr/lib/glib/include -fno-st ict-aliasing
-I/usr/local/include -O -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -fPIC
-I/usr/local/opt/perl5.6/lib/5.6.0/sun4-solaris-64int/CORE test.c
test.c: In function `XS_test_interface_s_ss':
test.c:32: parse error before `cv'
test.c:32: parse error before `)'
Exit 1

The test.c part around 32 line:

     20 #line 21 "test.c"
     21 XS(XS_test_interface_s_ss)
     22 {
     23     dXSARGS;
     24     dXSFUNCTION(int);
     25     if (items != 2)
     26         Perl_croak(aTHX_ "Usage: test::interface_s_ss(arg1, arg2)");
     27     {
     28         int     arg1 = (int)SvIV(ST(0));
     29         int     arg2 = (int)SvIV(ST(1));
     30         int     RETVAL;
     31         dXSTARG;
     32         XSFUNCTION = XSINTERFACE_FUNC(int,cv,XSANY.any_dptr);
     33 
     34         RETVAL = XSFUNCTION(arg1, arg2);
     35         XSprePUSH; PUSHi((IV)RETVAL);
     36     }
     37     XSRETURN(1);
     38 }

And cv is neither local nor global variable in XS_test_interface_s_ss
function. It is local variable in test_boot procedure.
I thing it is a bug in perl XS interface design.
I did not find any INTERFACE: keyword in popular perl modules.

perl -v output:

This is perl, v5.6.0 built for sun4-solaris-64int
[...]

-- 
Piotr Klaban


------------------------------

Date: Thu, 07 Jun 2001 09:27:20 -0400
From: Spammer Killer <NoSpam@SpammerKiller.com>
Subject: Re: pack = lousy performance
Message-Id: <3B1F8138.F84BD65B@SpammerKiller.com>

Thanks, I think...

I'm not sure what this intends to show.

BTW, lest anyone be confused, the two places where Abe has "pack 'L' =>", the "=>"
is just a substitute for a comma. An unusual style, perhaps designed to befuddle?

Abe Timmerman wrote:

> Try the next little program (mark the warning):
>
> #!/usr/bin/perl -w
> use strict;
>
> my %hash = ( key1 => 1, key2 => 2, key3 => 3 );
>
> my $i = %hash;
>
> print "scalar \%hash = $i\n";
>
> my $p = pack 'L' => $i;
>
> print "packed: $p\n";
>
> printf "Unpacked: %u\n", unpack 'L' => $p;
> __END__
>
> --
> Good luck, Abe
> Amsterdam Perl Mongers http://amsterdam.pm.org
> perl -e '$_=sub{split//,pop;print pop while@_};&$_("rekcah lreP rehtona tsuJ")'



------------------------------

Date: Thu, 7 Jun 2001 10:02:20 -0400
From: "Dennis Kowalski" <dennis.kowalsk@daytonoh.ncr.com>
Subject: Perl  HTTP & SSL
Message-Id: <3b1f896e$1@rpc1284.daytonoh.ncr.com>


I have a script that uses the LWP and HTTP modules to access a web server
and drive in transactions for stress testing.

I have tested it on my development server and it works fine.
I get a login page and send in the id and password and then get other
screens.

My problem is that the actual test has to run against a production server
using SSL.

I need HTTPS capability.

Is there anyway in Perl to handle pages from and to a secure site that is
using SSL?

Thanks





------------------------------

Date: Thu, 07 Jun 2001 10:39:22 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Perl  HTTP & SSL
Message-Id: <comdog-944934.10392207062001@news.panix.com>

In article <3b1f896e$1@rpc1284.daytonoh.ncr.com>, "Dennis Kowalski" 
<dennis.kowalsk@daytonoh.ncr.com> wrote:

> I need HTTPS capability.

http://search.cpan.org

-- 
brian d foy <comdog@panix.com>
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html



------------------------------

Date: Thu, 07 Jun 2001 14:20:22 GMT
From: tp601553@cia.gov (Tweetie Pooh)
Subject: Re: Starting a background job
Message-Id: <Xns90B99C0A8F482TweetiePooh@62.253.162.108>

"Michel" <michel.wouterse@intec-delft.com> honoured comp.lang.perl.misc on
Thu 07 Jun 2001 10:19:38a with news:9fng1j$3q8$1@news.unitel.co.kr: 

> Hi Group,
> 
> I got a script taking input from a form and returning a thank you html to
> the clients browser. Working just fine and like it's supposed to.
> However, now I want to store the gathered information in a database,
> which is also piece of cake on itself.
> Problem is, I do not want my clients to wait for the database-update to
> finish, neither do I want to lock the script....
> What I would like to accomplish is this:
> 
> Client sends the form
> My script opens a BACKGROUND script to write the data in the database,
> while the main script returns the thank you page. The returning of the
> latter would be first priority (making things surfer-friendlier)
> 
> What I do NOT want, is the "parent" script to wait for the "child"
> process to finish. (obviously)
> What I wouldn't want either is the child process to remain in memory
> after it completes. (deuh)
> 
> Is there some modules I need to look at? Please point me in the right
> direction, someone?
> 
> Thank you very very much,
> 
> Michel
> 
> 
> 

How are people connecting to your system ie LAN or modem and what database 
are you using?

The time taken to send a page to a remote, modem user is probably much 
greater than time taken to put data into storage.  Unless you are doing a lot 
of work with the input don't bother.  The user probably won't notice.

Also what if process fails.  You've told the user "thanks" and passed data to 
some process for handleing.  The user now leaves your site and the data bit 
fails.  Now what!!

If you insist why not use a pipe.  You receive script drops the data to a 
pipe, then sends out the thank you.  The pipe is read by a second process.

I wrap my background processes in a subshell.
#!/sbin/sh
(while true
do
    	perlscript
    	sleep 600
done ) &

This restarts my background script should it fall over.


------------------------------

Date: Thu, 7 Jun 2001 15:17:53 +0200
From: "Stefan Weiss" <der.prinz@gmx.net>
Subject: Strange warning in substitution
Message-Id: <3b1f7ebc@e-post.inode.at>

Hi,

I was trying to eliminate blank lines from a file I had slurped into
$_, but sometimes I got the warning "Use of uninitialized value in
substitution (s///) at xxx.pl line yy". I checked, and $_ was never
undefined. The script below is a reduced test case, cut down to the
absolute minimum necessary to reproduce the effect (I think).

If you delete a single line below __DATA__, no warning is issued.
There are no characters in DATA except "a" and "\n" (you can check if
you remove the comment from the 7th line), but in case something got
lost or added in the posting, i uploaded the original file to
http://www.foo.at/tmp/blanks.pl .

Can somebody confirm this? I tested it under Linux with 5.6.0 and now
also WinNT (5.6.0). Is something wrong with the regex I am using
(s/^[ \t]*\n//gm)?


cheers,
stefan



#!/usr/bin/perl -w
use strict;
$SIG{__WARN__} = sub { die $_[0] };

undef $/;
$_ = <DATA>;
# $_ = join '', map {(ord($_)==97 || ord($_)==10)? '' : ord($_)."|"} split '', $_;
print "-----\n$_";
$_ =~ s/^[ \t]*\n//gm;
print "-----\n$_-----\n";

__DATA__

a


a
a
a
a

a
a
a
a
a
a
a

a
a
a
a
a
a
a

a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a

a
a
a
a
a
a
a
a
a
a

a
a
a

a
a
a
a

a
a





------------------------------

Date: Thu, 07 Jun 2001 13:13:17 GMT
From: "Jay Flaherty" <fty@mediapulse.com>
Subject: Re: WebForm Processing With 2 File Attachments - Script
Message-Id: <N5LT6.143122$NK4.9090060@news2.aus1.giganews.com>

"CitruSoft" <citrusoft@lycos.com> wrote in message
news:9fmrr0$6ar$3@proxy2.nursat.net...
> What is Mail-A-File ?
[snip]
> Andrew
> WebDeweloper
> CitruSoft - Software for the Internet

What is a WebDeweloper? Is it a Web Developer that spams NG's?




------------------------------

Date: Thu, 07 Jun 2001 09:11:47 -0400
From: Gary Pitman <gpitman@nb.net>
Subject: Why does this work?
Message-Id: <3B1F7D95.B7C2D7F4@nb.net>

The $error variable is part of @error in my understanding and I should
not be able to directly reference this value, Right? .....wrong, it works

can anyone help me understand why?


subroutine that checks for duplicate usernames from database...
<snip>

    while ($sth->fetchrow_arrayref)
    {
      $cvalid = 0;
      $uvalid = 0;
      $error[$error++] = "Username <b>$uover</b> is already in use.";
    }          ^^^^

</snip>

part of web page that reports errors...
<snip>

        for ($k = 0;$k < $error; $k++)
        {                  ^^^^
                print ("<li>$error[$k]</li>");
        }

</snip>


------------------------------

Date: Thu, 7 Jun 2001 13:21:49 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Why does this work?
Message-Id: <slrn9huv8p.8e2.bernard.el-hagin@gdndev25.lido-tech>

On Thu, 07 Jun 2001 09:11:47 -0400, Gary Pitman <gpitman@nb.net> wrote:
>The $error variable is part of @error in my understanding and I should
>not be able to directly reference this value, Right? .....wrong, it works
>
>can anyone help me understand why?

[snipped examples]

I'm not sure what you're asking but I think you're confused by the fact that
$error is something completely different than @error. The first is a scalar
named error while the second is an array which happens to be named error,
too.

Cheers,
Bernard
--
perl -l54e's yyw q q tvmrx "h\ywx ersxliv zivp legoiv"qiy;y #a-zA-Z#d-gu-z#
chefghijklmnopqrstuvwxyzcJab-def-uPwxyzc;s j j s u u s t t s r r s
ppevalpereeteueje'


------------------------------

Date: Thu, 07 Jun 2001 10:09:06 -0400
From: Gary Pitman <gpitman@nb.net>
Subject: Re: Why does this work?
Message-Id: <3B1F8B03.4AE6CC31@nb.net>



Bernard El-Hagin wrote:
> 
> On Thu, 07 Jun 2001 09:11:47 -0400, Gary Pitman <gpitman@nb.net> wrote:
> >The $error variable is part of @error in my understanding and I should
> >not be able to directly reference this value, Right? .....wrong, it works
> >
> >can anyone help me understand why?
> 
> [snipped examples]
> 
> I'm not sure what you're asking but I think you're confused by the fact that
> $error is something completely different than @error. The first is a scalar
> named error while the second is an array which happens to be named error,
> too.
> 
Yes they would be 2 seperate namespaces ordinarily, but

If $error is being used only to step through the elements of @error
while building @error and is not declared anywhere else in the script
how can it hold its own namespace?


------------------------------

Date: Thu, 07 Jun 2001 10:16:30 -0400
From: Gary Pitman <gpitman@nb.net>
Subject: Re: Why does this work?
Message-Id: <3B1F8CBF.25DE5BEE@nb.net>



Gary Pitman wrote:
> 
> Bernard El-Hagin wrote:
> >
> > On Thu, 07 Jun 2001 09:11:47 -0400, Gary Pitman <gpitman@nb.net> wrote:
> > >The $error variable is part of @error in my understanding and I should
> > >not be able to directly reference this value, Right? .....wrong, it works
> > >
> > >can anyone help me understand why?
> >
> > [snipped examples]
> >
> > I'm not sure what you're asking but I think you're confused by the fact that
> > $error is something completely different than @error. The first is a scalar
> > named error while the second is an array which happens to be named error,
> > too.
> >
> Yes they would be 2 seperate namespaces ordinarily, but
> 
> If $error is being used only to step through the elements of @error
> while building @error and is not declared anywhere else in the script
> how can it hold its own namespace?


nevermind, i think it is coming clear, i think i have been working with
hashes too much lately and got confused with referencing.

thanks anyway,


------------------------------

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 1083
***************************************


home help back first fref pref prev next nref lref last post