[23040] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5260 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 23 00:06:03 2003

Date: Tue, 22 Jul 2003 21: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)

Perl-Users Digest           Tue, 22 Jul 2003     Volume: 10 Number: 5260

Today's topics:
    Re: Can't read from open2 <bwalton@rochester.rr.com>
    Re: getting name of class and/or parent class that obje (Jay Tilton)
    Re: getting name of class and/or parent class that obje <coo_t2-NO-LIKE-SPAM@yahoo.com>
    Re: getting name of class and/or parent class that obje (Tad McClellan)
    Re: getting name of class and/or parent class that obje <coo_t2-NO-LIKE-SPAM@yahoo.com>
    Re: Larry W... out of work ??  Impossible... or... (stu7)
    Re: Larry W... out of work ??  Impossible... or... (stu7)
    Re: Larry W... out of work ??  Impossible... or... <asu1@c-o-r-n-e-l-l.edu>
    Re: Larry W... out of work ??  Impossible... or... <nospam@nospam.com>
    Re: Larry W... out of work ??  Impossible... or... (stu7)
    Re: Larry W... out of work ??  Impossible... or... (stu7)
    Re: Larry W... out of work ??  Impossible... or... (stu7)
    Re: Larry W... out of work ??  Impossible... or... <aa@ukrecscuba.org.uk>
    Re: pass all cgi parameters to an exe <d@d.com>
    Re: push -- weird problem <usenet@dwall.fastmail.fm>
    Re: recompile Perl, with new function names ? (stu7)
    Re: Soap::Lite and hashes (Tad McClellan)
    Re: Soap::Lite and hashes <aa@ukrecscuba.org.uk>
    Re: Stupid newbie question re website hit counting <spamblock@junkmail.com>
    Re: Using 'my' within nested loops (Tad McClellan)
    Re: Using 'my' within nested loops <spamblock@junkmail.com>
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 23 Jul 2003 00:03:35 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Can't read from open2
Message-Id: <3F1DD0C3.30108@rochester.rr.com>

Pranab Mehta wrote:

 ...
> I'm trying to automate data entry to a windows app using wine from my
> linux machine. I'm not very proficient with my Perl, hence this post.
> Pretty simple scenario, I kick off a process, write to it, and then
> want to read from it. But nothing ever prints in the output. Here's
> the code in question -
> 
> $pid = open2(READHDLR, WRITEHDLR, "wine win_app.exe") or die "can't
> run command: $!";
> WRITEHDLR->autoflush();
> READHDLR->autoflush();
> print "PID = $pid\n";
> 
> print WRITEHDLR $PIN;
> print WRITEHDLR "\x0d\x0a";
> 
> $got=<READHDLR>;
> print "output = $got";
> 
> 
> Now if I were to replace READHDLR with a FILEHANDLE for writing, like
> this:
>     open(OUTFILE, "> outfile");
>     open2(">&OUTFILE", ...);
> I can see _all_ the data from the win_app in the file. Then why can't
> I read this data from READHDLR ?
> 
> Further, I don't know if this is valid, but if I pipe the output of
> READHDLR to a file, like this:
>     open(READHDLR, "| tee outfile");
> the file turns out empty.
 ...


Just a guess ... perhaps your win_app.exe is buffering its output?  If 
so, the output won't appear until a bufferful has been generated.  Can 
your win_app.exe be recompiled with output buffering turned off?  If so, 
try that.  Or try a test program in place of win_app.exe which has 
buffering turned off (like maybe an itsy-bitsy Perl program).

HTH.

> Pranab

-- 
Bob Walton



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

Date: Tue, 22 Jul 2003 22:14:30 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: getting name of class and/or parent class that object belongs to
Message-Id: <3f1db355.506314170@news.erols.com>

ed <coo_t2-NO-LIKE-SPAM@yahoo.com> wrote:

: 
: Hey all.  I'd like to convert some PHP code to Perl, but I'm not sure
: how to do it in Perl.
: The PHP method takes an argument which might be an error object.
: 
: I have to figure the following about the argument:
: 1. If it's an object
: 2. If it's of class "apperror"
: 3. Alternatively if it's a subclass of "apperror"

You can satisfy all three requirements at once.

    if( UNIVERSAL::isa($foo, 'apperror') ) {
        print '$foo is an apperror object';
    }

: The only part of the code below I know how to convert is the:
: get_class($e)=='apperror'
: 
: In Perl I'd do:
: (ref $e)=='apperror'  
: 
: Right?

Nope.

The '==' operator compares in numerical context.
The 'eq' operator compares in string context.

You could do

    if( ref($e) eq 'apperror' ) {
        ....
    }

But that would check only whether $e is blessed into the apperror
class, not whether $e inherits from the apperror class.



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

Date: Tue, 22 Jul 2003 22:24:18 GMT
From: ed <coo_t2-NO-LIKE-SPAM@yahoo.com>
Subject: Re: getting name of class and/or parent class that object belongs to
Message-Id: <o6erhv4pdv4s2inkloc117q5pp2vobgtgr@4ax.com>

On Tue, 22 Jul 2003 22:14:30 GMT, tiltonj@erols.com (Jay Tilton)
wrote:

>
>You can satisfy all three requirements at once.
>
>    if( UNIVERSAL::isa($foo, 'apperror') ) {
>        print '$foo is an apperror object';
>    }
>

Thanks.
I figured there was an easy way to do it.
Now I'm off to http://www.perldoc.com/perl5.8.0/lib/UNIVERSAL.html 
to find out _why_ it works :)

--ed



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

Date: Tue, 22 Jul 2003 19:12:22 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: getting name of class and/or parent class that object belongs to
Message-Id: <slrnbhrkn6.2od.tadmc@magna.augustmail.com>

ed <coo_t2-NO-LIKE-SPAM@yahoo.com> wrote:

> Now I'm off to http://www.perldoc.com/perl5.8.0/lib/UNIVERSAL.html 


Errr, why go way over there for it when it is already on
your very own hard disk?



Type:

   perldoc UNIVERSAL

at a command line.


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


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

Date: Wed, 23 Jul 2003 03:46:09 GMT
From: ed <coo_t2-NO-LIKE-SPAM@yahoo.com>
Subject: Re: getting name of class and/or parent class that object belongs to
Message-Id: <k01shvkbophrgboogteinn9eq863fom4ho@4ax.com>

On Tue, 22 Jul 2003 19:12:22 -0500, tadmc@augustmail.com (Tad
McClellan) wrote:

>ed <coo_t2-NO-LIKE-SPAM@yahoo.com> wrote:
>
>> Now I'm off to http://www.perldoc.com/perl5.8.0/lib/UNIVERSAL.html 
>
>
>Errr, why go way over there for it when it is already on
>your very own hard disk?
>
>
>
>Type:
>
>   perldoc UNIVERSAL
>
>at a command line.


I'm using activestate perl on windows and for some reason perldoc
doesn't work from the command line.  However the distro does come with
a windows version of the docs.
I'm gonna have to reinstall or upgrade and see if I can get perldoc
working from the command line.

--ed


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

Date: 22 Jul 2003 17:47:58 -0700
From: stuseven@hotmail.com (stu7)
Subject: Re: Larry W... out of work ??  Impossible... or...
Message-Id: <d7dd90b0.0307221647.78416433@posting.google.com>

merlyn@stonehenge.com (Randal L. Schwartz) wrote in message news:<40ddfa96a9a18724999cbc0c222a6056@free.teranews.com>... 
> This is your first factual mistake, and it only goes downhill from
> here.  Perl has been around since long before IP packets were flowing
> near your sorry hiney.
*** ...hiney... this is serious.  Randal - if you even are the
*** real Randal - my post was intended to be both complimentary, 
*** and as accurate as possible... perhaps you were wrongly 
*** offended by my reference to yourself ?   I suppose anyone
*** who read the post would see it was an attempt to defend
*** Perl... maybe you only read the whiney replies ?

> The rest of the post is just the usual FUD from someone who has been
> burned.  Pay no heed.
*** Who got burned ? 
*** Im no more put off by the latest batch of non-replies here 
*** than any other time, and just try to ignore them... that was
*** in fact a major topic of my post - the destabilizing effect 
*** of the massive amount of irreverent or malicious replies which 
*** fill the Usenet groups... didn't you care to comment on this ?  
*** Is it an embarrassing issue to take sides on ?  No problem.  
*** Im sorry.
    
> Nice try.  Move along.  Nothing to see here.
*** Im pretty sure it was the wrongly offended thing now :)
*** Im still not sure what a FUD is.  Perhaps another time.
> print "Just another Perl hacker,";


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

Date: 22 Jul 2003 18:13:24 -0700
From: stuseven@hotmail.com (stu7)
Subject: Re: Larry W... out of work ??  Impossible... or...
Message-Id: <d7dd90b0.0307221713.76ff86dc@posting.google.com>

*** ah... it's eric again... and same complaint as before.
*** The problem eric is, for one, I DID NOT ADDRESS MY POST
*** TO YOU... dont take it so personally ?  And... you 
*** evidently had nothing to say... not before... not now...
*** so far as the topic of my posts... so what is it we are
*** saying here ?  Oh right... you're not going to reply, now
*** that you know Im a  
***
*** At the outside, it is possible I was too eager to jump
*** on your non-reply in particular, and you may in fact
*** have intended no more than to point out a problem you
*** were having reading my post... but Email is more suited
*** for personalized problems like that, rather than adding
*** content to the newsgroup.   
*** FYI - there is no problem with my quoting style whatsoever... 
*** it works fine on Google_ it is in fact a style I was taught 
*** to use in an Email/NewsReader class... I do apologize if 
*** it causes problems on your system, but I suspect this is
*** a laptop you're using... so most web pages wont work for 
*** you... again, it isn't especially relevant to me, as a poster
*** with a question, to address issues like this, although I am
*** sympathetic... really.

*** Or... if you dont like the facts of this matter, try to 
*** follow this example :)  Suppose you were on vacation,
*** and stopped to ask directions... and the person you
*** asked said something like - "Hey... whats with the
*** flowers on the shirt ?  Definitely bad... and your
*** wife is kinda fat and dumpy too... we dont like that
*** around here... and, yea, I know how to get to where you
*** asked about, but Im not going to tell you !".
*** Sure, thats a little exaggereated... but really, it is
*** almost as irrelevant as your style critique of my perl
*** question.
*** We dont really have a problem, now do we eric ?  No.
*** Please stop pretending :)
***
*** Did I expect a serious answer from you ?  No... I
*** was hiding in the other room, hoping you didnt see it :)

"Eric J. Roode" <REMOVEsdnCAPS@comcast.net> wrote in a message...
> You expect a serious answer, when you flamed the hell out of me for trying 
> to be helpful?   Ha.


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

Date: 23 Jul 2003 01:31:51 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: Larry W... out of work ??  Impossible... or...
Message-Id: <Xns93C0DB078F4D0asu1cornelledu@132.236.56.8>

stuseven@hotmail.com (stu7) wrote in
news:d7dd90b0.0307221713.76ff86dc@posting.google.com: 

> *** ah... it's eric again... and same complaint as before.
> *** The problem eric is, for one, I DID NOT ADDRESS MY POST
> *** TO YOU... dont take it so personally ?  

You posted on a public forum. Everyone can then reply to what he/she sees 
as relevant.

> *** And... you 
> *** evidently had nothing to say... not before... not now...
> *** so far as the topic of my posts... so what is it we are
> *** saying here ? 

There is no topic to your post. You have a chip on your shoulder, and 
your claim that you were around when Perl 1.0 was announced (in 1987) 
seems dubious.

> *** At the outside, it is possible I was too eager to jump
> *** on your non-reply in particular, and you may in fact
> *** have intended no more than to point out a problem you
> *** were having reading my post... but Email is more suited
> *** for personalized problems like that, rather than adding
> *** content to the newsgroup.   

It is not personal problem of Eric. He was kind enough to point out to 
you that your use of sequences of characters commonly used when quoting 
someone else makes it hard for readers to figure out difference between 
original content and quotations in your post. Put simply, your posting 
style is misleading in that regard. 

> *** FYI - there is no problem with my quoting style whatsoever... 
> *** it works fine on Google_ it is in fact a style I was taught 
> *** to use in an Email/NewsReader class... 

Please mention where this class is given so people know to avoid it.

> I do apologize if 
> *** it causes problems on your system, but I suspect this is
> *** a laptop you're using... so most web pages wont work for 
> *** you... again, it isn't especially relevant to me, as a poster
> *** with a question, to address issues like this, although I am
> *** sympathetic... really.

What is this supposed to mean? I have been using portables and laptops 
almost exclusively since 1993, and I have no idea what you mean by "most 
pages won't work" for laptop users (putting aside the fact that this 
discussion is taking place in a UseNet group).

In any case, as a poster with a question, it is your responsibility to 
adhere to the conventions of the forum you are posting to if you want 
people to take the time and effort to respond to your questions.

> *** around here... and, yea, I know how to get to where you
> *** asked about, but Im not going to tell you !".

Rude people deserve that.

Sinan.

-- 
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov


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

Date: Wed, 23 Jul 2003 01:38:28 GMT
From: "Gregory Toomey" <nospam@nospam.com>
Subject: Re: Larry W... out of work ??  Impossible... or...
Message-Id: <oGlTa.9108$OM3.4602@news-server.bigpond.net.au>

"stu7" <stuseven@hotmail.com> wrote in message
news:d7dd90b0.0307221647.78416433@posting.google.com...
> *** ...hiney... this is serious.  Randal - if you even are the
> *** real Randal

Randal Schwartz is a regular in this group, and you seem to have made a
spectacular debut putting your foot in your mouth.

See http://www.catb.org/~esr/faqs/smart-questions.html

gtoomey




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

Date: 22 Jul 2003 18:55:52 -0700
From: stuseven@hotmail.com (stu7)
Subject: Re: Larry W... out of work ??  Impossible... or...
Message-Id: <d7dd90b0.0307221537.ed255d6@posting.google.com>

*** I can accept that.  Likely, it was the newest release 
*** being announced_ maybe even the actual version 1.0 .
*** I only recalled first hearing about Perl on that
*** occassion, and trying it then.
 
Bernie Cosell <bernie@fantasyfarm.com> wrote in message news:<hfdphvkvktie6ia75jaoqlioac7ktggf42@library.airnews.net>...
> stuseven@hotmail.com (stu7) wrote:
> 
> }      I first saw Perl the day it was released... I was IRCing
> }  and somebody came around announcing this new thing, Perl, so
> }  I checked it out... I forget what it offered at that time.
> 
> Wait a second -- IRC didn't appear until 1988 and Perl came out in 1987..
> 
>   /Bernie\


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

Date: 22 Jul 2003 18:56:04 -0700
From: stuseven@hotmail.com (stu7)
Subject: Re: Larry W... out of work ??  Impossible... or...
Message-Id: <d7dd90b0.0307221538.6f81772a@posting.google.com>

*** I can accept that.  Likely, it was the newest release 
*** being announced_ maybe even the actual version 1.0 .
*** I only recalled first hearing about Perl on that
*** occassion, and trying it then.
 
Bernie Cosell <bernie@fantasyfarm.com> wrote in message news:<hfdphvkvktie6ia75jaoqlioac7ktggf42@library.airnews.net>...
> stuseven@hotmail.com (stu7) wrote:
> 
> }      I first saw Perl the day it was released... I was IRCing
> }  and somebody came around announcing this new thing, Perl, so
> }  I checked it out... I forget what it offered at that time.
> 
> Wait a second -- IRC didn't appear until 1988 and Perl came out in 1987..
> 
>   /Bernie\


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

Date: 22 Jul 2003 19:08:41 -0700
From: stuseven@hotmail.com (stu7)
Subject: Re: Larry W... out of work ??  Impossible... or...
Message-Id: <d7dd90b0.0307221604.6fd3c73c@posting.google.com>

> Keith Keller wrote:
> > You must be out of work, as well, to have wasted all that time
> > writing so much tripe.  Good luck finding a new job.
*** it wasnt wasted time... I made my point... what was yours ?

> > (or perhaps you're upset at your perceived mistreatment by some
> > other folks in the newsgroup?...)
*** No Keith, Im not upset - rather, I tried to point out that
*** the preponderance of insult replies (such as your own), and
*** other "replies" on these groups, which likewise address 
*** neither the questions nor issues addressed in the poster's 
*** inquiries, have been responsible for Usenet's declining 
*** reputation as a useable resource for serious programmers.  
*** In particular, I was using this example to show how PERL - 
*** which has largely been known and distributed via the same 
*** Internet medium - has suffered enormously from it's
*** association with these "newgroups" and other services.

> > - --keith
> 
> yikes boy, his post meandered a bit, but he made some sense. i think 
> you're the type of poster he was referring to :)

*** Haha... meandered... I like that !  Well, no, it wasn't 
*** critically edited... it was admittedly my emotional response 
*** to this recent (to me) news of Larry W's job plight.


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

Date: 23 Jul 2003 02:13:37 GMT
From: Alasdair Allan <aa@ukrecscuba.org.uk>
Subject: Re: Larry W... out of work ??  Impossible... or...
Message-Id: <bfkr0h$g05fr$1@ID-188041.news.uni-berlin.de>

stu7 wrote:

> *** FYI - there is no problem with my quoting style whatsoever... 
> *** it works fine on Google_ 

Google is not usenet, usenet is not the web, it has nothing to do
with the web except that it uses the same wires and there are some
web interfaces into usent (and some usenet interfaces into the
web for some odd and screwball values of "interfaces").

> *** it is in fact a style I was taught to use in an Email/NewsReader 
> *** class...

If you took a class in how to use email and usenet, may I respectfully
suggest you haven't been around the net long enough to hold an opinion
on what constitutes good style? 

Stylistically usenet settled down sometime in the early 80's, well before 
the great renaming in '86. There weren't  any classes on how to use net 
related things back then, we all just had to pick it up as we went along,
in alot of cases, we has to write the tools to do the stuff as went along.

Your quoting convention is wierd, trust me. No don't bother, see 
http://www.netmeister.org/news/learn2quote.html and take their word
for it... specifically section 3.1

 3.1 Which character should I use to mark the quoted text?

  Use the "Greater-Than" character (">"). This character is recognized as 
  a quotationmark by almost every newsreader and is mentioned in the 
  netiquette as such for technical reasons (Son-Of-RFC 1036 and 
  successors). 

> *** I do apologize if  it causes problems on your system, but I suspect 
> *** this is a laptop you're using... so most web pages wont work for 
> *** you... again, it isn't especially relevant to me, as a poster
> *** with a question, to address issues like this, although I am
> *** sympathetic... really.

The sheer lack of knowledge that this paragraph hints at is mind 
boggling... totally disregarding that this is usenet, not the web,
why on Earth shouldn't web pages work on a laptop? What does the
harware have to do with anything?

Al.


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

Date: Wed, 23 Jul 2003 03:15:57 GMT
From: "D" <d@d.com>
Subject: Re: pass all cgi parameters to an exe
Message-Id: <M5nTa.121786$Ph3.15852@sccrnsc04>

"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnbhr8v2.1lg.tadmc@magna.augustmail.com...
> D <d@d.com> wrote:
> > i want to pass all cgi parameters to an exe (cgi app) and run the
executable
> > and capture all of its output.
>
>
> I think you are saying that you want to run a program (webapp.exe)
> that was designed to run in the CGI environment from the command
> line instead?
>
> Why must you do that?
>
> Why not access the designed-for-CGI program in the environment
> it expects?
>
>
> > i want to
> > impersonate what IIS would have passed if i did something like
> > http://site/scripts/webapp.exe
>
>
> If you want to _impersonate_ what the web server does, then you'll
> need to setup the input to webapp.exe whereever it expects it.
>
> That is, you'll need to setup an env var or stdin depending on
> whether it is a GET or POST request.
>
>
> A much better solution would be to have the *real web server*
> do it's thing. You can invoke webapp.exe via a web server if
> you make the request using one of the LWP modules.
>
>
> See the Perl FAQ:
>
>    How do I fetch an HTML file?
>
>    How do I automate an HTML form submission?
>
>
> -- 
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas

the thing is this executable is proprietary and i cannot get the source
code, and it does some things that need to be logged. essentially if i can
intercept the output of this exe, i can then parse the output and log what
happened, lets pretend that it gives a page that cancels someones bank
account. so the exe communicates with a mainframe and cancels a persons
account then spits out an html page that says it confirmed the cancel and so
on, i need to log that. the button that submits POSTS all the forms to this
exe can be changed so that it calls my perlscript instead (there is a
rudimentary html file the exe uses as a template). when you mentioned stdin,
 that sounded like the answer. but i wouldnt have a clue how to do that, i
figure it must be simple, you take everything that was passed to the
perlscript from the webserver, and then pass it to the exe, get the result
and log it, then pass that same result with no modifications back out to the
browser. i think




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

Date: Tue, 22 Jul 2003 23:20:36 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: push -- weird problem
Message-Id: <Xns93C0C4C60BB6Ddkwwashere@216.168.3.30>

butt-fuzz <butt-fuzz@ass.wipe.com> wrote:

> sorry, I'm not a real programmer.
> lots of stuff I don't understand even if I read the docs a hundred
> times.
> (only wrote code for less than one year)

Then learn. :-)  I'm not primarily a programmer either, have little formal 
training in it (obviously to some, I suppose), but I've learned a 
considerable amount by reading posts here in comp.lang.perl.misc, reading 
various recommended books (see learn.perl.org), and writing my own 
programs and having to revise them when my first (or second or third...)
attempt turned out to be less-than-good.  Just remember that Perl is not 
the only language worth writing programs in, and other languages may do 
things differently.  That doesn't mean they're better or worse -- although 
it can, for a particular problem domain -- just different.  I need to 
learn more languages and more theory and get more practice, but that's all 
part of the fun, right?

Oh, and I for one will take you more seriously if you use a name other 
than "butt-fuzz".

-- 
David Wall


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

Date: 22 Jul 2003 18:40:42 -0700
From: stuseven@hotmail.com (stu7)
Subject: Re: recompile Perl, with new function names ?
Message-Id: <d7dd90b0.0307221740.2865dd3e@posting.google.com>

*** I agree... this kind of new function is much easier...
*** thanks for the suggestion.

news@roaima.freeserve.co.uk wrote in message news:<io9vu-cf4.ln1@moldev.cmagroup.co.uk>...
> stu7 <stuseven@hotmail.com> wrote:
> >    Is there a way to recomplile Perl with new names
> >  for functions ? (...or better, probably, including the
> >  regular names with the replacement names... so original
> >  functions are still there to make old scripts work :) 
> 
> Why recompile? Take a look at the prototyping examples from "perldoc
> perlsub".
> 
> Chris


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

Date: Tue, 22 Jul 2003 17:41:37 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Soap::Lite and hashes
Message-Id: <slrnbhrfd1.2gi.tadmc@magna.augustmail.com>

Alasdair Allan <aa@ukrecscuba.org.uk> wrote:
> Tad McClellan wrote:
>> Sascha Moellering wrote:

>> > %hash = {`1` => {id => `sdf`, user => `asd`}, 
>> >          `2` => {id => `wer`, user => `aqw`}}
              ^ ^           ^   ^          ^   ^
              ^ ^           ^   ^          ^   ^

>   my %hash = ( '1' => { 'id' => 'sdf', 'user' => 'asd' },
>                '2' => { 'id' => 'wer', 'user' => 'aqw' } );


You changed 14 characters there, that's a lot of errors.


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


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

Date: 22 Jul 2003 23:12:51 GMT
From: Alasdair Allan <aa@ukrecscuba.org.uk>
Subject: Re: Soap::Lite and hashes
Message-Id: <bfkgdj$ftjok$1@ID-188041.news.uni-berlin.de>

Tad McClellan wrote:
> Alasdair Allan wrote:
> > Tad McClellan wrote:
> > > Sascha Moellering wrote:
> > > > %hash = {`1` => {id => `sdf`, user => `asd`}, 
> > > >          `2` => {id => `wer`, user => `aqw`}}
>                ^ ^           ^   ^          ^   ^
>                ^ ^           ^   ^          ^   ^
> >   my %hash = ( '1' => { 'id' => 'sdf', 'user' => 'asd' },
> >                '2' => { 'id' => 'wer', 'user' => 'aqw' } );
>
> You changed 14 characters there, that's a lot of errors.

Oh, I hadn't noticed he'd used the other type of quotes, my fingers just 
automagically typed the rigth ones when I wrote the example... ;)

Al.


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

Date: Tue, 22 Jul 2003 16:42:34 -0700
From: "David Oswald" <spamblock@junkmail.com>
Subject: Re: Stupid newbie question re website hit counting
Message-Id: <vhrp50qe685ce3@corp.supernews.com>


"Michael McLaughlin" <mpmcl@mitre.org> wrote in message
news:bfja38$hpb$1@newslocal.mitre.org...
> Once a month, I run a (mostly perl) script that reads my all my
> webserver log files and tallies hits to several webpages.  However, I
> have always wondered about the accuracy of these counts.
>
> Specifically, if a reader has been to a page before, has this page in
> his browser cache and surfs to that URL, does the log still register
> that hit with the usual status code (200)?  Does it register it at all?
>
> Thanks in advance for any tips.


While your post is off topic, your subject line is spot on:  It truely is a
stupid question, EVEN for a newbie -- to ask regarding website hit counting
on a Perl Usenet group.  The subject line would be inaccurate, had the post
been directed to the appropriate Usenet group, for in the appropriate group,
it is not a stupid thing to ask.

I won't even go into why I hate the term newbie.

Whatever happened to the good old days when "newbies" took a little time to
understand Usenet before learning how to run webservers?  I'll say it again,
because a *stupid* "newbie" might not understand what a smart "newbie" would
have picked up on:  You're asking a webserver question, not a Perl question.





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

Date: Tue, 22 Jul 2003 18:01:23 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Using 'my' within nested loops
Message-Id: <slrnbhrgi3.2gi.tadmc@magna.augustmail.com>

David Oswald <spamblock@junkmail.com> wrote:
> "Brian McCauley" <nobull@mail.com> wrote in message
> news:u9adb6x0y5.fsf@wcl-l.bham.ac.uk...
>> "David Oswald" <spamblock@junkmail.com> writes:


> So would it be accurate to say that the
> majority of the syntaxes that default to $_, are actually (behind the
> scenes) calling something to the effect of my $_, 
                                             ^^^^^

No.

my() and local/our() each refer to one of Perl's two systems of
variables. my() for lexical variables and local/our() for
package (dynamic) variables.

Most of Perl's built-in variables are package variables, 
you _cannot_ my() them.

So, it is a   local($_)   that foreach gives you.


> and limiting its scope, or


Package variables are global variables.

What you are limiting is not the visibility of the variable, but
the visibility of the _value_ of the variable.

You are still open to classic action-at-a-distance bugs, which
is what happened to you.  :-)   (or should that be :-(


> is this nuance only applicable to foreach loops?


Which nuance?

Q: The automatic-localling of $_ by foreach?

   A: map and grep do it too.
   
Q: the difference between my() and our() variables and values?

   A1: as in the Perl FAQ

      What's the difference between dynamic and lexical (static)
      scoping?  Between local() and my()?

   A2: and "Coping with Scoping"

             http://perl.plover.com/FAQs/Namespaces.html


   A3: Executive summary:

       Always prefer my() variables over our() variables,
       except when you can't.


(you can get good-old, sane scoping by using a lexical variable
 for foreach's loop control variable:    foreach my $str (...)
)

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


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

Date: Tue, 22 Jul 2003 18:32:52 -0700
From: "David Oswald" <spamblock@junkmail.com>
Subject: Re: Using 'my' within nested loops
Message-Id: <vhrpgul1omdne9@corp.supernews.com>


"Tad McClellan" <tadmc@augustmail.com> wrote in message
<response snipped>

Thanks again Tad.  I appreciate the clarification.

Dave




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

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



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

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


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