[25496] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7740 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 5 00:10:21 2005

Date: Fri, 4 Feb 2005 21:10:15 -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           Fri, 4 Feb 2005     Volume: 10 Number: 7740

Today's topics:
    Re: ran into previously declared variables with Inline: <kalinaubears@iinet.net.au>
    Re: Regular expression woes <nospam-abuse@ilyaz.org>
    Re: Spelling (was: Foreign characters in filenames, rev <groleau+news@freeshell.org>
        Why aren't 'warnings' on by default? (Chris Richmond - MD6-FDC ~)
    Re: Why aren't 'warnings' on by default? <mjl69mj...@myaccmyacc.net>
    Re: Why aren't 'warnings' on by default? <matternc@comcast.net>
    Re: Why aren't 'warnings' on by default? (Peter Scott)
    Re: Why aren't 'warnings' on by default? <No_4@dsl.pipex.com>
    Re: why the variable become local? <No_4@dsl.pipex.com>
    Re: why the variable become local? <news@chaos-net.de>
    Re: why the variable become local? <1usa@llenroc.ude.invalid>
    Re: why the variable become local? <news@chaos-net.de>
    Re: why the variable become local? <wksmith@optonline.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 05 Feb 2005 03:27:47 +0000
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: Re: ran into previously declared variables with Inline::C
Message-Id: <42044cbc$0$12471$5a62ac22@per-qv1-newsreader-01.iinet.net.au>

sipreglab wrote:
> I am learning the Inline::C module.  I am trying to use an external library
> and I find that there are declarations in the header files for this library
> that are also used in handy.h
> 
> In file included from /export/home/omni/include/architecture.h:14,
>                  from /export/home/omni/include/Ft.h:77,
>                  from useOmniFt_pl_2a86.xs:6:
> /export/home/omni/include/arch_lnx.h:199: redefinition of `U8'
> /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/handy.h:131: `U8'
> previously declared here
> /export/home/omni/include/arch_lnx.h:201: redefinition of `U16'
> /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/handy.h:133: `U16'
> previously declared here
> /export/home/omni/include/arch_lnx.h:207: conflicting types for `U32'
> /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/handy.h:135: previous
> declaration of `U32'
> 
> Now I realize these types (U8, U16, U32) appear in the
> /usr/lib/perl5/5.8.0/ExtUtils/typemap file.
> 
> How can I resolve this?  I would rather not alter any of these files.  I
> was hoping there was a way within Inline configuration, etc. I could do
> this.
> 

Inline doesn't have any way of dealing with this (afaik). You would have 
to deal with this the same way as you do in a C environment - which I 
think means altering at least one of the files.

I don't reegard myself as a C expert but I would probably rewrite 
arch_lnx.h so that it begins with:

#define U8  lnx_U8
#define U16 lnx_U16
#define U32 lnx_U32

Then recompile that "external library" - and then there should be no 
problems when you come to access it with Inline.

Maybe there's another way - the people on the XS mailing list might be 
able to provide a better solution (assuming that what I proposed above 
actually works to begin with :-)

Cheers,
Rob

-- 
To reply by email u have to take out the u in kalinaubears.



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

Date: Sat, 5 Feb 2005 01:40:08 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Regular expression woes
Message-Id: <cu185o$2mmn$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Evertjan.
<exjxw.hannivoort@interxnl.net>], who wrote in article <Xns95F3E7D7DF08Ceejj99@194.109.133.29>:
> r = /^(([^h]...)|(.[^t]..)|(..[^t].)|(...[^p])|(.{0,3}$))/.test(s)

Too much work.

   [^h]
 | h[^t]
 | ht[^t]
 | htt[^p]
 | .{0,3}$

Hope this helps,
Ilya


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

Date: Fri, 04 Feb 2005 22:26:32 -0500
From: Wes Groleau <groleau+news@freeshell.org>
Subject: Re: Spelling (was: Foreign characters in filenames, revisited)
Message-Id: <36ismrF51pe9sU1@individual.net>

Shawn Corey wrote:
>> "Todo El Ano.log"

Assuming that "foreign characters" means characters not
often found in English, the above has none.  So I further
assume it was “Todo El Año.log”

(All Year vs. Entire Anus)


-- 
Wes Groleau

    After the christening of his baby brother in church, Jason sobbed
    all the way home in the back seat of the car.  His father asked him
    three times what was wrong.  Finally, the boy replied, "That preacher
    said he wanted us brought up in a Christian home, and I wanted to
    stay with you guys."


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

Date: Sat, 5 Feb 2005 01:19:33 +0000 (UTC)
From: crichmon@filc8046.fm.intel.com (Chris Richmond - MD6-FDC ~)
Subject: Why aren't 'warnings' on by default?
Message-Id: <cu16v5$odb$1@news01.intel.com>

Seems to me that nobody will support help requests until warnings
are turned on, let alone maybe strict.  Why isn't it turned on
by default?  Its a good idea 99.99% of the time.  Then the
 .01% when it isn't, make the user shut it off.

Chris

-- 
 Chris Richmond         | I don't speak for Intel & vise versa    


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

Date: 5 Feb 2005 01:39:58 GMT
From: mjl69 <mjl69mj...@myaccmyacc.net>
Subject: Re: Why aren't 'warnings' on by default?
Message-Id: <36imfeF50eecpU1@individual.net>


> Seems to me that nobody will support help requests until warnings
> are turned on, let alone maybe strict.  Why isn't it turned on
> by default?  Its a good idea 99.99% of the time.  Then the
> .01% when it isn't, make the user shut it off.

When your program works and it is ready for real world use, you can turn it off.
When posting here, it's like you're in school.

mjl

> 
> Chris
> 
> -- 
>  Chris Richmond         | I don't speak for Intel & vise versa  


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

Date: Fri, 04 Feb 2005 21:03:37 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: Why aren't 'warnings' on by default?
Message-Id: <dPSdnXR-QuXntJnfRVn-iQ@comcast.com>

mjl69 wrote:

> 
>> Seems to me that nobody will support help requests until warnings
>> are turned on, let alone maybe strict.  Why isn't it turned on
>> by default?  Its a good idea 99.99% of the time.  Then the
>> .01% when it isn't, make the user shut it off.
> 
> When your program works and it is ready for real world use, you can turn
> it off. When posting here, it's like you're in school.
> 
I don't think you understand his question.  He's not complaining about
having to use warnings, he's wondering about why it isn't *on* by
default if it's that universally useful.

Basically, mjl, it's the cause of probably 90% of the evils in
software design: backwards compatibility.  -w (the precursor of
use warnings) as we know it today and the restrictions it puts 
on your code are relatively recent (of course, in this case 
"relatively recent" still means over ten years ago...).  Since
there's a lot of old perl code out there written before this,
if you made use warnings the default, that code which had been
running perfectly fine would suddenly start emitting warnings.
This would make a lot of people unhappy...

-- 
             Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"


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

Date: Sat, 05 Feb 2005 04:26:56 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: Why aren't 'warnings' on by default?
Message-Id: <kWXMd.273566$6l.64144@pd7tw2no>

In article <cu16v5$odb$1@news01.intel.com>,
 crichmon@filc8046.fm.intel.com (Chris Richmond - MD6-FDC ~) writes:
>Seems to me that nobody will support help requests until warnings
>are turned on, let alone maybe strict.  Why isn't it turned on
>by default?  Its a good idea 99.99% of the time.  Then the
>.01% when it isn't, make the user shut it off.

Many people, myself included, agree with you.  Even
the perl man page is on your side:

	BUGS
               The -w switch is not mandatory.

It is not going to happen in Perl 5 for backwards
compatibility reasons.  The question sparked heated debate
during development of Perl 6.  It is a sore point of
contention for some.

-- 
Peter Scott
http://www.perldebugged.com/
*** NEW *** http://www.perlmedic.com/


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

Date: Sat, 05 Feb 2005 04:45:39 +0000
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: Why aren't 'warnings' on by default?
Message-Id: <If6dnVLEktTo0pnfRVnyhg@pipex.net>

Peter Scott wrote:
> 
> Many people, myself included, agree with you.  Even
> the perl man page is on your side:
> 
> 	BUGS
>                The -w switch is not mandatory.

    However, if you have to remember to switch it on it might switch on 
other parts of your brain, and that will help with your coding.

-- 
              Just because I've written it doesn't mean that
                   either you or I have to believe it.


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

Date: Sat, 05 Feb 2005 01:23:49 +0000
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: why the variable become local?
Message-Id: <O-SdnWQtVYS7vZnfRVnyrQ@pipex.net>

Martin Kissner wrote:
> 
> Just for my own understanding:
> Shouldn't that be:
> 
> print_usage() and exit unless @ARGV;

    Not if your print_usage() function exits, which it usually should, 
given that it is unlikely you wish to do anything else having shown the usage.

-- 
              Just because I've written it doesn't mean that
                   either you or I have to believe it.


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

Date: Sat, 5 Feb 2005 03:58:22 +0100
From: Martin Kissner <news@chaos-net.de>
Subject: Re: why the variable become local?
Message-Id: <slrnd08die.ckn.news@maki.homeunix.net>

Big and Blue wrote :
> Martin Kissner wrote:
 
>> print_usage() and exit unless @ARGV;

>     Not if your print_usage() function exits, which it usually should, 
> given that it is unlikely you wish to do anything else having shown the usage.

That's probablly true.
You could do without the function as well. 

	@ARGV or die "usage: do it the right way!";

This way a reader of the code would have the usage information in the
upper part of the script.

Regards
Martin

-- 
perl -e 'print 7.74.117.115.116.11.32.13.97.110.111.116.104.101.114.11
 .32.13.112.101.114.108.11.32.13.104.97.99.107.101.114.10.7'


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

Date: Sat, 05 Feb 2005 03:01:19 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: why the variable become local?
Message-Id: <Xns95F3E00F0F4A9asu1cornelledu@127.0.0.1>

Martin Kissner <news@chaos-net.de> wrote in
news:slrnd08die.ckn.news@maki.homeunix.net: 

> Big and Blue wrote :
>> Martin Kissner wrote:
>  
>>> print_usage() and exit unless @ARGV;
> 
>>     Not if your print_usage() function exits, which it usually
>>     should, 
>> given that it is unlikely you wish to do anything else having shown
>> the usage. 
> 
> That's probablly true.
> You could do without the function as well. 
> 
>      @ARGV or die "usage: do it the right way!";

It seems like you did not read all of my message:

"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in 
news:Xns95F390AEDCDCDasu1cornelledu@132.236.56.8:

> You can replace this whole craziness with:
> 
> #!/usr/local/bin/perl
> 
> use strict;
> use warnings;
> 
> use constant USAGE =><<USAGE
> Usage: download_zip_file -h <ftp server> -u <user name> -p <password>
> USAGE
>     ;
> 
> 
> die USAGE unless @ARGV;
> 
> my %args = @ARGV;
> 
> die USAGE unless(
>     defined $args{-h}
> 


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

Date: Sat, 5 Feb 2005 04:37:29 +0100
From: Martin Kissner <news@chaos-net.de>
Subject: Re: why the variable become local?
Message-Id: <slrnd08frp.ckn.news@maki.homeunix.net>

A. Sinan Unur wrote :
> Martin Kissner <news@chaos-net.de> wrote in
> news:slrnd08die.ckn.news@maki.homeunix.net: 
>> You could do without the function as well. 
>> 
>>      @ARGV or die "usage: do it the right way!";
>
> It seems like you did not read all of my message:

You are right.
I was not so much interested in the download part of the script since I
use curl and .netrc for stuff like this.
Sorry.

> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in 
> news:Xns95F390AEDCDCDasu1cornelledu@132.236.56.8:
>
>> You can replace this whole craziness with:
>> 
 [...]

-- 
perl -e 'print 7.74.117.115.116.11.32.13.97.110.111.116.104.101.114.11
 .32.13.112.101.114.108.11.32.13.104.97.99.107.101.114.10.7'


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

Date: Fri, 4 Feb 2005 23:08:22 -0500
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: why the variable become local?
Message-Id: <wFXMd.8065$Lp5.180@fe12.lga>


<ai2003lian@yahoo.com> wrote in message
news:1107540859.281482.203830@l41g2000cwc.googlegroups.com...
--snip
>
        }elsif($next_arg == "-u"){
>                 $login=$ARGV[++$idx]; #user name
>                 if (!$login){
>                         printUsage();
>                         exit;
>                 }
>                 print "$login \n";
>
-- snip --
>
> when I try to print $login after the while loop, $login is empty! Why
> is that? Please help!



The symptom has nothing to do with the scope of the variable.
The variable $login  is overwritten due to the use of the "==" operator
rather than  the "eq" operator in the fragment above.  You would have
found this and several other serious errors by using "use warnings".


In this program, the warnings related to prototypes are the only ones
that can be ignored.  I recommend against trying to use prototypes
without
a compelling reason.

Bill







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

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


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