[27388] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9063 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Mar 18 09:06:01 2006

Date: Sat, 18 Mar 2006 06:05:04 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 18 Mar 2006     Volume: 10 Number: 9063

Today's topics:
    Re: A Problem With GD <abigail@abigail.nl>
        Code that makes you say hmmm! <someone@example.com>
    Re: Code that makes you say hmmm! <1usa@llenroc.ude.invalid>
    Re: debugging perl program with Tk mainloop <ngoc@yahoo.com>
    Re: deferred module loading ? <tadmc@augustmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 17 Mar 2006 21:52:10 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: A Problem With GD
Message-Id: <slrne1mbsa.46n.abigail@alexandra.abigail.nl>

Mark Manning (markem@airmail.net) wrote on MMMMDLXXXI September MCMXCIII
in <URL:news:121krm9gd07bh97@corp.supernews.com>:
==  Abigail wrote:
== > Mark Manning (markem@airmail.net) wrote on MMMMDLXXVIII September
== > MCMXCIII in <URL:news:121e4203g00m77f@corp.supernews.com>:
== > ??  Abigail wrote:
== > ?? <code snipped for space>
== > ??  
== > ??  I added in a new line which reads "$v = ++$v % 2" and the results are:
== > 
== > But since '$v = ++$v % 2' modifies $v twice in the same statement, the
== > fact it toggles $v is just happistance, and there's no garantee it will
== > work on every platform, or on a next version of Perl.
== > 
== > 
== > 
== > Abigail
==  
==  Well that's strange.  I thought one of the strong points of Perl was that it
==  guaranteed to always do the pre-increment command before doing anything else


It doesn't. And this fact is documented. 


==  Unlike C/C++ where you are not guaranteed to be able to do this.

Pre/post increment/decrement works "as in C". With the same benefits.
And the same flexibility for the implementation.

==  Would you say that "$v = (++$v) % 2" would always work due to the parenthesi

That still modifies $v twice in the same expression.

==  Or just in general the ++$v may not work?

In general '++ $v' works. Just don't modify the same thing twice in 
the same expression.


Abigail
-- 
:$:=~s:$":Just$&another$&:;$:=~s:
:Perl$"Hacker$&:;chop$:;print$:#:


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

Date: Sat, 18 Mar 2006 11:21:32 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Code that makes you say hmmm!
Message-Id: <03SSf.2749$nQ6.1906@clgrps13>

I downloaded a Perl program recently and encountered this line:


    if(exists $_[0]->{"name"} and scalar($_[0]->{"name"}) eq $_[0]->{"name"}){




Comments?  Jokes?


John
-- 
use Perl;
program
fulfillment


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

Date: Sat, 18 Mar 2006 12:15:57 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Code that makes you say hmmm!
Message-Id: <Xns978A4A077CC82asu1cornelledu@127.0.0.1>

"John W. Krahn" <someone@example.com> wrote in
news:03SSf.2749$nQ6.1906@clgrps13: 

> I downloaded a Perl program recently and encountered this line:
> 
> 
>     if(exists $_[0]->{"name"} and scalar($_[0]->{"name"}) eq
>     $_[0]->{"name"}){ 
> 

Sartre must be communicating with the rest of us through the life-form who 
put together those lines.

I am speechless.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: Sat, 18 Mar 2006 09:55:33 +0100
From: ngoc <ngoc@yahoo.com>
Subject: Re: debugging perl program with Tk mainloop
Message-Id: <2v-dnf_I_ZpqV4bZRVnzvA@telenor.com>

Thank you very much. You solve my problem. Now I can debugg without 
using print command in the code -> better quality of software -> my boss 
  will be happy.
> main::(foo:7):  my $mw = MainWindow->new;
>   DB<1> l 1-18
> 1       #!/usr/local/bin/perl
> 2:      use strict;
> 3:      use warnings;
> 4 
> 5:      use Tk;
> 6 
> 7==>    my $mw = MainWindow->new;
> 8:      $mw->Label(-text => 'Hello, world!')->pack;
> 9:      $mw->Button(
> 10                  -text    => 'Quit',
> 11                  -command => \&quit,
> 12                 )->pack;
> 13:     MainLoop;
> 14 
> 15      sub quit {
> 16:       my $variable = 42;
> 17:       exit;
> 18      }
>   DB<2> b 17
>   DB<3> c
> # << Press Quit button on GUI >>
> main::quit(foo:17):       exit;
>   DB<3> p $variable
> 42
>   DB<4> q
> 


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

Date: Fri, 17 Mar 2006 16:54:41 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: deferred module loading ?
Message-Id: <slrne1mfhh.2c7.tadmc@magna.augustmail.com>

bugbear <bugbear@trim_papermule.co.uk_trim> wrote:

> Is there any way to avoid loading a module
> until it is (in fact) needed?


   perldoc AutoLoader

       AutoLoader - load subroutines only on demand


> And, yes, I have searched the documentation 


See also perlsub.pod.


> and the web
> but haven't found information that I can use. I do not
> know wether this reflects a lack of information, or a lack
> of understanding on my part :-|


Merely the lack of the proper search term, I expect.


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


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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