[31476] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2728 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 17 18:09:45 2009

Date: Thu, 17 Dec 2009 15:09:12 -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           Thu, 17 Dec 2009     Volume: 11 Number: 2728

Today's topics:
    Re: 2-headed strings and RExes <nospam-abuse@ilyaz.org>
    Re: 2-headed strings and RExes <ben@morrow.me.uk>
    Re: 2-headed strings and RExes <nospam-abuse@ilyaz.org>
    Re: Closing a DBI instance <ben@morrow.me.uk>
    Re: Closing a DBI instance <tim@johnsons-web.com>
    Re: Closing a DBI instance <ben@morrow.me.uk>
    Re: Closing a DBI instance <tim@johnsons-web.com>
    Re: Closing a DBI instance <OJZGSRPBZVCX@spammotel.com>
    Re: cpan errors <smallpond@juno.com>
    Re: cpan errors <ruben@mrbrklyn.com>
        Creating an alias to an existing hash (from a hash refe <jl_post@hotmail.com>
        perl compile failure <ruben@mrbrklyn.com>
    Re: perl compile failure <ruben@mrbrklyn.com>
    Re: perl compile failure <ben@morrow.me.uk>
    Re: perl compile failure <ruben@mrbrklyn.com>
    Re: perl compile failure <ruben@mrbrklyn.com>
    Re: perl compile failure <ben@morrow.me.uk>
    Re: push integers from strings <user@example.net>
        split and lc or \L in one statement <thomas@glanzmann.de>
    Re: split and lc or \L in one statement <jurgenex@hotmail.com>
    Re: split and lc or \L in one statement <hjp-usenet2@hjp.at>
    Re: split and lc or \L in one statement <jurgenex@hotmail.com>
    Re: split and lc or \L in one statement <ben@morrow.me.uk>
    Re: split and lc or \L in one statement <marc.girod@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 17 Dec 2009 16:20:09 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: 2-headed strings and RExes
Message-Id: <slrnhikmhp.6ho.nospam-abuse@powdermilk.math.berkeley.edu>

On 2009-12-16, Ben Morrow <ben@morrow.me.uk> wrote:
> As for fixing the modules: with the number of modules on CPAN, this is
> impossible. People writing XS modules that grovel around in perl's guts
> are expected to keep up with p5p. I believe some effort is made to smoke
> CPAN and fix breakages (certainly there was a big push to get the CPAN
> smokes clean before 5.10) but in the end p5p can't fix everything.

IMO, serialization is not "everything".  But I'm, of course, biased...

Ilya


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

Date: Thu, 17 Dec 2009 18:28:09 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: 2-headed strings and RExes
Message-Id: <pq9qv6-9do1.ln1@osiris.mauzo.dyndns.org>


Quoth Ilya Zakharevich <nospam-abuse@ilyaz.org>:
> On 2009-12-16, Ben Morrow <ben@morrow.me.uk> wrote:
> > As for fixing the modules: with the number of modules on CPAN, this is
> > impossible. People writing XS modules that grovel around in perl's guts
> > are expected to keep up with p5p. I believe some effort is made to smoke
> > CPAN and fix breakages (certainly there was a big push to get the CPAN
> > smokes clean before 5.10) but in the end p5p can't fix everything.
> 
> IMO, serialization is not "everything".  But I'm, of course, biased...

(Regardless of the relative merits) FreezeThaw is not the 'standard'
serialization module. That would be Storable, which is core and thus
*will* have been fixed by p5p. AIUI, though, part of the reasoning
behind the current push to move modules out of core is to reduce the
amount of code the pumpking has to keep up to date.

Ben



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

Date: Thu, 17 Dec 2009 22:06:46 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: 2-headed strings and RExes
Message-Id: <slrnhilarm.77e.nospam-abuse@powdermilk.math.berkeley.edu>

On 2009-12-17, Ben Morrow <ben@morrow.me.uk> wrote:
>> IMO, serialization is not "everything".  But I'm, of course, biased...

> (Regardless of the relative merits) FreezeThaw is not the 'standard'
> serialization module. That would be Storable, which is core and thus
> *will* have been fixed by p5p. AIUI, though, part of the reasoning
> behind the current push to move modules out of core is to reduce the
> amount of code the pumpking has to keep up to date.

Note that there is a kinda contradiction in what you wrote.
"FreezeThaw is not the 'standard'" ONLY because Storable was pushed TO
the core.

Yours,
Ilya


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

Date: Thu, 17 Dec 2009 12:37:23 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Closing a DBI instance
Message-Id: <39lpv6-kqm1.ln1@osiris.mauzo.dyndns.org>


Quoth tim@johnsons-web.com:
> On 2009-12-17, Ben Morrow <ben@morrow.me.uk> wrote:
> > Quoth tim@johnsons-web.com:
> >> 
> >> my $data_Source = "DBI:mysql:".$DATABASE .":".$HOSTNAME;
> >> my $dbh = DBI->connect($data_Source,$USERNAME,$PASSWORD)
> >>     or die "$DBI::errstr\n";
> >> 
> >> To properly disconnect, should I not see something like the following:
> >> $dbh->disconnect 
> >> somewhere in this script?
> >
> > Not necessarily. $dbh is a DBI::dbh object, and has a DESTROY method
> > (like a C++ destructor) that will call ->disconnect when the object goes
> > out of scope. At that point any transactions in prgress will be rolled
> > back, so you *should* see a ->commit in the appropriate place (assuming
> > you are using transactions).
>    
> 	Thanks for that Ben. Can you think of any syntax or system factors
> 	that might prevent the destructor from being triggered?

Do you have reason to believe it isn't being? One thing that can cause
confusion is if the perl interpreter reaches global desstuction (after
you program finishes, just before the interpreter exits). The order in
which any remaining objects are destroyed is not guaranteed at that
point, and (IIRC) DBI handles have a problem with this.

Ben



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

Date: Thu, 17 Dec 2009 11:13:19 -0600
From: Tim Johnson <tim@johnsons-web.com>
Subject: Re: Closing a DBI instance
Message-Id: <slrnhikntb.hbs.tim@bart.johnson.com>

On 2009-12-17, Ben Morrow <ben@morrow.me.uk> wrote:
>
> Quoth tim@johnsons-web.com:
>>    
>> 	Thanks for that Ben. Can you think of any syntax or system factors
>> 	that might prevent the destructor from being triggered?
>
> Do you have reason to believe it isn't being? 
> One thing that can cause
  A large number of perl scripts are being run as by cron jobs some once
	per hour others even more frequently. The mysql server has to be restarted 
	frequently because MAX_CONNECTIONS is surpassed. One thing that I have
	suspected is that connections are not being properly closed. Thus
	the code inventory.

> confusion is if the perl interpreter reaches global desstuction (after
> you program finishes, just before the interpreter exits). The order in
> which any remaining objects are destroyed is not guaranteed at that
> point, and (IIRC) DBI handles have a problem with this.

	Would you be able to give an example?
	thanks again
-- 
Tim 
tim@johnsons-web.com
http://www.akwebsoft.com


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

Date: Thu, 17 Dec 2009 18:42:06 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Closing a DBI instance
Message-Id: <ukaqv6-9do1.ln1@osiris.mauzo.dyndns.org>


Quoth tim@johnsons-web.com:
> On 2009-12-17, Ben Morrow <ben@morrow.me.uk> wrote:
> > Quoth tim@johnsons-web.com:
> >>    
> >> 	Thanks for that Ben. Can you think of any syntax or system factors
> >> 	that might prevent the destructor from being triggered?
> >
> > Do you have reason to believe it isn't being? 
> > One thing that can cause
>   A large number of perl scripts are being run as by cron jobs some once
> 	per hour others even more frequently. The mysql server has to be restarted 
> 	frequently because MAX_CONNECTIONS is surpassed. One thing that I have
> 	suspected is that connections are not being properly closed. Thus
> 	the code inventory.

Sounds reasonable. I don't know how easy it would be, but one thing you
could try is logging the connections as they are made with some
appropriate ID (local port number would do nicely if you are using TCP)
and then go through some time later to see which are not being
disconnected properly.

> > confusion is if the perl interpreter reaches global desstuction (after
> > you program finishes, just before the interpreter exits). The order in
> > which any remaining objects are destroyed is not guaranteed at that
> > point, and (IIRC) DBI handles have a problem with this.
> 
> 	Would you be able to give an example?
> 	thanks again

Well, in this case

    #!/usr/bin/perl

    use DBI;

    our $dbh = DBI->connect("...");

    __END__

$dbh is global, so it won't be DESTROYed until global destruction,
whereas in this case

    #!/usr/bin/perl

    use DBI;

    {
        my $dbh = DBI->connect("...");
    }

    __END__

$dbh is a lexical and is DESTROYed at the end of the scope.

I'm not convinced yet this isn't a red herring. I can't make anything
fail like this; all I can get is 'closing dbh with active statement
handles' warnings, which is expected.

Ben



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

Date: Thu, 17 Dec 2009 15:13:16 -0600
From: Tim Johnson <tim@johnsons-web.com>
Subject: Re: Closing a DBI instance
Message-Id: <slrnhil74t.hbs.tim@bart.johnson.com>

On 2009-12-17, Ben Morrow <ben@morrow.me.uk> wrote:
>
> Quoth tim@johnsons-web.com:
>> 
>> 	Would you be able to give an example?
>> 	thanks again
>
> Well, in this case
>
>     #!/usr/bin/perl
>
>     use DBI;
>
>     our $dbh = DBI->connect("...");
>
>     __END__
>
> $dbh is global, so it won't be DESTROYed until global destruction,
> whereas in this case
>
>     #!/usr/bin/perl
>
>     use DBI;
>
>     {
>         my $dbh = DBI->connect("...");
>     }
>
>     __END__
>
> $dbh is a lexical and is DESTROYed at the end of the scope.
  Thanks for the examples.
 
> I'm not convinced yet this isn't a red herring. 
  Neither am I. At least I have enough to rule out.

> I can't make anything
> fail like this; all I can get is 'closing dbh with active statement
> handles' warnings, which is expected.
  Thanks a lot for your time.
  regards
-- 
Tim 
tim@johnsons-web.com
http://www.akwebsoft.com


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

Date: Thu, 17 Dec 2009 22:24:02 +0100
From: "Jochen Lehmeier" <OJZGSRPBZVCX@spammotel.com>
Subject: Re: Closing a DBI instance
Message-Id: <op.u43pqccfmk9oye@frodo>

On Thu, 17 Dec 2009 22:13:16 +0100, Tim Johnson <tim@johnsons-web.com>  
wrote:

>   Neither am I. At least I have enough to rule out.

I assume that the perl processes started by your cron actually end (i.e.,  
are not listed by "ps" anymore), and you still run out of connections in  
MySQL.

I see two possible sources for your problem:

a) You are creating many connections in a perl script, not just one, and  
thus running out because they are not Garbage Collected quickly enough  
(for whatever reason).

b) Your processes end, but still MySQL thinks the connections are open. I  
do not know if the architecture of MySQL allows this to happen, since I  
use Oracle (and there this is impossible, as the DB cleans up connections  
when the underlying TCP/IP connection goes down, which is guaranteed by  
the OS when the process stops).

Here's a test for you to rule out b): write a little test script which  
only opens one DBI connection and then sleeps for a long time. Start it,  
and then kill it with SIGKILL (kill -9). This will kill it without it  
being able to close the connection in a controlled manner, i.e., the  
DESTROY will certainly not run.  I'd try this first, because it's very  
simple and straightforward.

If you do that a lot of times, and do not run out of MySQL connections,  
then you know that b) cannot be the case. Then it's time to rule out a),  
i.e., take a very good look at your scripts. Maybe one script opens  
mulitple connections and does not free them (because it stores them in a  
hash or whatever).


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

Date: Thu, 17 Dec 2009 11:58:53 -0500
From: Steve C <smallpond@juno.com>
Subject: Re: cpan errors
Message-Id: <hgdo0q$d8m$1@news.eternal-september.org>

Ruben Safir wrote:
> I have a new distro of openSuse and cpan seems to be not working.
> 

Did you update or do a fresh install?

> I'm getting weird errors like this
> 

always or sometimes?

Also, are you behind a firewall that could be blocking transfers?


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

Date: Thu, 17 Dec 2009 18:48:04 +0000 (UTC)
From: Ruben Safir <ruben@mrbrklyn.com>
Subject: Re: cpan errors
Message-Id: <hgdud4$2hj$2@reader1.panix.com>

On Thu, 17 Dec 2009 11:58:53 -0500, Steve C wrote:

> Ruben Safir wrote:
>> I have a new distro of openSuse and cpan seems to be not working.
>> 
>> 
> Did you update or do a fresh install?
> 
>> I'm getting weird errors like this
>> 
>> 
> always or sometimes?
> 
> Also, are you behind a firewall that could be blocking transfers?

There is no firewall and it is always doing this.  It renders cpan 
useless, which is a big problem for me.  I did a fresh install and then 
untarred my development environment from perl 5.8,  I've tried to 
reinstall CPAN by hand but no change.  I'm tried a source install of per, 
but it is failing to compile on ODBM line. (see other posting)


This has been the worse upgrade i ever did on opensuse 11.2 from opensuse 
9.2

Next time I'm ditching suse.  I've had it.

Ruben



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

Date: Thu, 17 Dec 2009 14:52:16 -0800 (PST)
From: "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: Creating an alias to an existing hash (from a hash reference)
Message-Id: <0bf23c49-ecc3-4e2d-ad03-f90b1f2e57cf@q18g2000yqj.googlegroups.com>

Hi,

   Recently I was reviewing someone's Perl code and I saw that his
code used a few global variables that were set and accessed by several
functions.  Since I am not a fan of global variables, I edited the
code to get rid of all but one of them.

   (For the record, his code used "strict" and "warnings".)

   The remaining global variable was a hash.  I proceded to edit the
code so that the functions took a hash reference as an input
argument.  So previously, the code looked something like:

   my %hash;

   {
      f1();
      f2();
      f3();
      f4();
   }

   sub f1 { ... }
   sub f2 { ... }
   sub f3 { ... }
   sub f4 { ... }

(This is a simplification.)

   I changed those lines to something like:

   sub f1 { ... }
   sub f2 { ... }
   sub f3 { ... }
   sub f4 { ... }

   {
      my %hash;

      f1(\%hash);
      f2(\%hash);
      f3(\%hash);
      f4(\%hash);
   }

   In the function definitions themselves, I added code to read in the
input arguments, like this:

sub f
{
   my ($hashRef) = @_;
   .
   .
   .
}

   However, all the functions still referred to %hash (which at this
point was no longer visible to the functions).  So I figured I had to
change all instances of "$hash{...}" to "$hashRef->{...}".

   But then I thought:  Could there be another way that doesn't
involve changing all those instances in each function?  I'd like to do
something similar to what C++ allows with references:

   int cat = 5;
   int & dog = cat;
   // Now every change made to dog will be
   // reflected in cat, and vice-versa.

   The idea of creating a new variable named %hash came to mind:

sub f
{
   my ($hashRef) = @_;
   my %hash = %$hashRef;
   .
   .
   .
}

but that would create a completely new copy of the original %hash
(using extra memory), and any changes made to the copy would have to
be copied back to the original be returning from the function, like
this:

   %$hashRef = %hash;

   I thought of using typeglobs, like this:

   local *hash = $hashRef;

which would allow %hash to be used as if it were a real hash, all the
while reading and writing from the hash that $hashRef points to.

   However, since his code had "use strict;" in effect, "perl -c"
responded with:

Variable "%hash" is not imported at ...

So I declared %hash the line before with "my", like this:

   my %hash;
   local *hash = $hashRef;

   That didn't work; although it compiled just fine, %hash was empty.
So then I changed it to be declared with "our" instead of "my", like
this:

   our %hash;
   local *hash = $hashRef;

and that worked.  From then on in that function, every instance of
%hash pointed back to the passed-in %hash (that was passed in as a
reference).

   However, I'm a little concerned with the usage of "our".  That has
the effect of creating a package variable named %hash (separate from
the lexical), which can be accessed from anywhere in the package.  Is
this a good idea to do?

   In other words, if I need to create an alias for a variable, is it
a good idea to do something like this:

   our %dog;
   local *dog = \%ENV;
   # Now %dog and %ENV are the same:
   # any changes made to %dog will
   # affect %ENV, and vice-versa.

or is there a better way to do this?

   ...or should I just bite the bullet and change all the instances of
%hash in the functions to hash references?

   Any thoughts, advice, and ideas are welcome.

   -- Jean-Luc

P.S.  Incidentally, the generated Perl code that find2perl creates
uses this typeglob approach to create aliases named $name, $dir, and
$prune.


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

Date: Thu, 17 Dec 2009 18:44:12 +0000 (UTC)
From: Ruben Safir <ruben@mrbrklyn.com>
Subject: perl compile failure
Message-Id: <hgdu5s$2hj$1@reader1.panix.com>

It seems that the perl 5.10.1 won't compile on my system with is a new 
opensuse 11.2


Its dieing on this line

make[1]: Entering directory `/home/ruben/Downloads/perl-5.10.1/ext/
ODBM_File'
Skip ../../lib/ODBM_File.pm (unchanged)
 ../../miniperl "-I../../lib" "-I../../lib" ../../lib/ExtUtils/xsubpp -
noprototypes -typemap ../../lib/ExtUtils/typemap -typemap typemap  
ODBM_File.xs > ODBM_File.xsc && mv ODBM_File.xsc ODBM_File.c
gcc -c   -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-
protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
-O2   -DVERSION=\"1.07\" -DXS_VERSION=\"1.07\" -fPIC "-I../.."   
ODBM_File.c
ODBM_File.xs: In function ‘XS_ODBM_File_DESTROY’:
ODBM_File.xs:124: error: too few arguments to function ‘dbmclose’
make[1]: *** [ODBM_File.o] Error 1
make[1]: Leaving directory `/home/ruben/Downloads/perl-5.10.1/ext/
ODBM_File'
Unsuccessful make(ext/ODBM_File): code=512 at make_ext.pl line 360.
make: *** [lib/auto/ODBM_File/ODBM_File.so] Error 2


in the ODBM module.  Any clues on a fix?

Ruben


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

Date: Thu, 17 Dec 2009 20:44:35 +0000 (UTC)
From: Ruben Safir <ruben@mrbrklyn.com>
Subject: Re: perl compile failure
Message-Id: <hge57j$933$2@reader1.panix.com>

On Thu, 17 Dec 2009 18:44:12 +0000, Ruben Safir wrote:

> It seems that the perl 5.10.1 won't compile on my system with is a new
> opensuse 11.2
> 
> 
> Its dieing on this line
> 
> make[1]: Entering directory `/home/ruben/Downloads/perl-5.10.1/ext/
> ODBM_File'
> Skip ../../lib/ODBM_File.pm (unchanged) ../../miniperl "-I../../lib"
> "-I../../lib" ../../lib/ExtUtils/xsubpp - noprototypes -typemap
> ../../lib/ExtUtils/typemap -typemap typemap ODBM_File.xs > ODBM_File.xsc
> && mv ODBM_File.xsc ODBM_File.c gcc -c   -D_REENTRANT -D_GNU_SOURCE
> -fno-strict-aliasing -pipe -fstack- protector -I/usr/local/include
> -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2   -DVERSION=\"1.07\"
> -DXS_VERSION=\"1.07\" -fPIC "-I../.." ODBM_File.c
> ODBM_File.xs: In function ‘XS_ODBM_File_DESTROY’: ODBM_File.xs:124:
> error: too few arguments to function ‘dbmclose’ make[1]: ***
> [ODBM_File.o] Error 1
> make[1]: Leaving directory `/home/ruben/Downloads/perl-5.10.1/ext/
> ODBM_File'
> Unsuccessful make(ext/ODBM_File): code=512 at make_ext.pl line 360.
> make: *** [lib/auto/ODBM_File/ODBM_File.so] Error 2
> 
> 
> in the ODBM module.  Any clues on a fix?
> 
> Ruben

FWIW
http://www.gossamer-threads.com/lists/perl/porters/234587


No I need to figure out where I should put the instruction

add -Dnoextensions=ODBM_File

does that mean 

 ./Configure -dDnoextensions=ODBM_File

??

Ruben


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

Date: Thu, 17 Dec 2009 20:43:51 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: perl compile failure
Message-Id: <7phqv6-7vo1.ln1@osiris.mauzo.dyndns.org>


Quoth Ruben Safir <ruben@mrbrklyn.com>:
> It seems that the perl 5.10.1 won't compile on my system with is a new 
> opensuse 11.2
> 
> Its dieing on this line
> 
> make[1]: Entering directory `/home/ruben/Downloads/perl-5.10.1/ext/
> ODBM_File'
> Skip ../../lib/ODBM_File.pm (unchanged)
> ../../miniperl "-I../../lib" "-I../../lib" ../../lib/ExtUtils/xsubpp -
> noprototypes -typemap ../../lib/ExtUtils/typemap -typemap typemap  
> ODBM_File.xs > ODBM_File.xsc && mv ODBM_File.xsc ODBM_File.c
> gcc -c   -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-
> protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
> -O2   -DVERSION=\"1.07\" -DXS_VERSION=\"1.07\" -fPIC "-I../.."   
> ODBM_File.c
> ODBM_File.xs: In function ‘XS_ODBM_File_DESTROY’:
> ODBM_File.xs:124: error: too few arguments to function ‘dbmclose’
> make[1]: *** [ODBM_File.o] Error 1
> make[1]: Leaving directory `/home/ruben/Downloads/perl-5.10.1/ext/
> ODBM_File'
> Unsuccessful make(ext/ODBM_File): code=512 at make_ext.pl line 360.
> make: *** [lib/auto/ODBM_File/ODBM_File.so] Error 2
> 
> 
> in the ODBM module.  Any clues on a fix?

Well, if you don't need ODBM then just re-Configure perl and omit ODBM
from the list of extensions to build. Make sure you start in a clean
directory, or remove Policy.sh before starting. 

Otherwise: where are you getting your <dbm.h> from? dbmclose should be
int dbmclose(void); if you have some GDBM passthrough with a different
prototype that isn't going to work.

You could also take this question to perl5-porters@perl.org, which is
the list for discussing perl development (as opposed to Perl
development).

Ben



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

Date: Thu, 17 Dec 2009 21:33:15 +0000 (UTC)
From: Ruben Safir <ruben@mrbrklyn.com>
Subject: Re: perl compile failure
Message-Id: <hge82r$933$3@reader1.panix.com>

On Thu, 17 Dec 2009 20:43:51 +0000, Ben Morrow wrote:

> Quoth Ruben Safir <ruben@mrbrklyn.com>:
>> It seems that the perl 5.10.1 won't compile on my system with is a new
>> opensuse 11.2
>> 
>> Its dieing on this line
>> 
>> make[1]: Entering directory `/home/ruben/Downloads/perl-5.10.1/ext/
>> ODBM_File'
>> Skip ../../lib/ODBM_File.pm (unchanged) ../../miniperl "-I../../lib"
>> "-I../../lib" ../../lib/ExtUtils/xsubpp - noprototypes -typemap
>> ../../lib/ExtUtils/typemap -typemap typemap ODBM_File.xs >
>> ODBM_File.xsc && mv ODBM_File.xsc ODBM_File.c gcc -c   -D_REENTRANT
>> -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack- protector
>> -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2  
>> -DVERSION=\"1.07\" -DXS_VERSION=\"1.07\" -fPIC "-I../.." ODBM_File.c
>> ODBM_File.xs: In function ‘XS_ODBM_File_DESTROY’: ODBM_File.xs:124:
>> error: too few arguments to function ‘dbmclose’ make[1]: ***
>> [ODBM_File.o] Error 1
>> make[1]: Leaving directory `/home/ruben/Downloads/perl-5.10.1/ext/
>> ODBM_File'
>> Unsuccessful make(ext/ODBM_File): code=512 at make_ext.pl line 360.
>> make: *** [lib/auto/ODBM_File/ODBM_File.so] Error 2
>> 
>> 
>> in the ODBM module.  Any clues on a fix?
> 
> Well, if you don't need ODBM then just re-Configure perl and omit ODBM
> from the list of extensions to build. Make sure you start in a clean
> directory, or remove Policy.sh before starting.
> 
> Otherwise: where are you getting your <dbm.h> from? dbmclose should be
> int dbmclose(void); if you have some GDBM passthrough with a different
> prototype that isn't going to work.
> 
> You could also take this question to perl5-porters@perl.org, which is
> the list for discussing perl development (as opposed to Perl
> development).
> 
> Ben

Thanks Ben

I don't know where the dbm is coming or going to.

ruben@www2:~> gdb -v
GNU gdb (GDB) SUSE (6.8.91.20090930-2.4)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/
gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i586-suse-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.




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

Date: Thu, 17 Dec 2009 21:39:12 +0000 (UTC)
From: Ruben Safir <ruben@mrbrklyn.com>
Subject: Re: perl compile failure
Message-Id: <hge8e0$933$4@reader1.panix.com>

On Thu, 17 Dec 2009 21:33:15 +0000, Ruben Safir wrote:

> On Thu, 17 Dec 2009 20:43:51 +0000, Ben Morrow wrote:
> 
>> Quoth Ruben Safir <ruben@mrbrklyn.com>:
>>> It seems that the perl 5.10.1 won't compile on my system with is a new
>>> opensuse 11.2
>>> 
>>> Its dieing on this line
>>> 
>>> make[1]: Entering directory `/home/ruben/Downloads/perl-5.10.1/ext/
>>> ODBM_File'
>>> Skip ../../lib/ODBM_File.pm (unchanged) ../../miniperl "-I../../lib"
>>> "-I../../lib" ../../lib/ExtUtils/xsubpp - noprototypes -typemap
>>> ../../lib/ExtUtils/typemap -typemap typemap ODBM_File.xs >
>>> ODBM_File.xsc && mv ODBM_File.xsc ODBM_File.c gcc -c   -D_REENTRANT
>>> -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack- protector
>>> -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2
>>> -DVERSION=\"1.07\" -DXS_VERSION=\"1.07\" -fPIC "-I../.." ODBM_File.c
>>> ODBM_File.xs: In function ‘XS_ODBM_File_DESTROY’: ODBM_File.xs:124:
>>> error: too few arguments to function ‘dbmclose’ make[1]: ***
>>> [ODBM_File.o] Error 1
>>> make[1]: Leaving directory `/home/ruben/Downloads/perl-5.10.1/ext/
>>> ODBM_File'
>>> Unsuccessful make(ext/ODBM_File): code=512 at make_ext.pl line 360.
>>> make: *** [lib/auto/ODBM_File/ODBM_File.so] Error 2
>>> 
>>> 
>>> in the ODBM module.  Any clues on a fix?
>> 
>> Well, if you don't need ODBM then just re-Configure perl and omit ODBM
>> from the list of extensions to build. Make sure you start in a clean
>> directory, or remove Policy.sh before starting.
>> 
>> Otherwise: where are you getting your <dbm.h> from? dbmclose should be
>> int dbmclose(void); if you have some GDBM passthrough with a different
>> prototype that isn't going to work.
>> 
>> You could also take this question to perl5-porters@perl.org, which is
>> the list for discussing perl development (as opposed to Perl
>> development).
>> 
>> Ben
> 
> Thanks Ben
> 
> I don't know where the dbm is coming or going to.
> 

Actually, I'm wondering if this might be why CPAN is failing.  Does it 
use a Berkleys Database to keep track of modules?

Ruben

> ruben@www2:~> gdb -v
> GNU gdb (GDB) SUSE (6.8.91.20090930-2.4) Copyright (C) 2009 Free
> Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/ gpl.html>
> This is free software: you are free to change and redistribute it. There
> is NO WARRANTY, to the extent permitted by law.  Type "show copying" and
> "show warranty" for details.
> This GDB was configured as "i586-suse-linux". For bug reporting
> instructions, please see: <http://www.gnu.org/software/gdb/bugs/>.



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

Date: Thu, 17 Dec 2009 21:45:12 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: perl compile failure
Message-Id: <8clqv6-nap1.ln1@osiris.mauzo.dyndns.org>


Quoth Ruben Safir <ruben@mrbrklyn.com>:
> On Thu, 17 Dec 2009 18:44:12 +0000, Ruben Safir wrote:
> 
> > It seems that the perl 5.10.1 won't compile on my system with is a new
> > opensuse 11.2
> > 
> > 
> > Its dieing on this line
> > 
> > make[1]: Entering directory `/home/ruben/Downloads/perl-5.10.1/ext/
> > ODBM_File'
> > Skip ../../lib/ODBM_File.pm (unchanged) ../../miniperl "-I../../lib"
> > "-I../../lib" ../../lib/ExtUtils/xsubpp - noprototypes -typemap
> > ../../lib/ExtUtils/typemap -typemap typemap ODBM_File.xs > ODBM_File.xsc
> > && mv ODBM_File.xsc ODBM_File.c gcc -c   -D_REENTRANT -D_GNU_SOURCE
> > -fno-strict-aliasing -pipe -fstack- protector -I/usr/local/include
> > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2   -DVERSION=\"1.07\"
> > -DXS_VERSION=\"1.07\" -fPIC "-I../.." ODBM_File.c
> > ODBM_File.xs: In function ‘XS_ODBM_File_DESTROY’: ODBM_File.xs:124:
> > error: too few arguments to function ‘dbmclose’ make[1]: ***
> > [ODBM_File.o] Error 1
> > make[1]: Leaving directory `/home/ruben/Downloads/perl-5.10.1/ext/
> > ODBM_File'
> > Unsuccessful make(ext/ODBM_File): code=512 at make_ext.pl line 360.
> > make: *** [lib/auto/ODBM_File/ODBM_File.so] Error 2
> 
> FWIW
> http://www.gossamer-threads.com/lists/perl/porters/234587
> 
> 
> No I need to figure out where I should put the instruction
> 
> add -Dnoextensions=ODBM_File
> 
> does that mean 
> 
> ./Configure -dDnoextensions=ODBM_File

    ./Configure -Dnoextensions=ODBM_File -des

is probably what you want (assuming you just used '-d' before).
Generally you always want '-des', unless you want an interactive
Configure.

Ben



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

Date: Thu, 17 Dec 2009 17:26:09 -0500
From: monkeys paw <user@example.net>
Subject: Re: push integers from strings
Message-Id: <0sWdnezSCc9mMrfWnZ2dnUVZ_hBi4p2d@insightbb.com>

Uri Guttman wrote:
>>>>>> "mp" == monkeys paw <user@example.net> writes:
> 
>   mp> i found several ways that work, and as uri
>   mp> points out, perl interprets numbers and strings for you,
>   mp> even if an array element has quotes, as long
>   mp> as it is numerical it will be interpreted correctly.
> 
> array elements don't have quotes. dumper showed quotes as you had left
> those values as strings. please learn to explain things correctly.
> 
>   mp> @a = (
>   mp> 35,
>   mp> '35',
>   mp> );
> 
>   mp> Either element is a valid int.
> 
> only after you use them as numbers.
> 
> and one more time, use a module for this. you still haven't said
> anything about the module that does this for you. why not?

My hand rolled code worked well enough, i didn't bother installing
Int::Span, though it certainly is aimed at the heart of the problem.
Also, other than just interpreting the numbers, i had to fill an array
with extra data based on the number, so Int::Span would only be a 
smaller percentage of the overall data problem. Thanks.
> 
> uri
> 


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

Date: 17 Dec 2009 11:57:56 GMT
From: Thomas Glanzmann <thomas@glanzmann.de>
Subject: split and lc or \L in one statement
Message-Id: <slrnhik764.vrk.thomas@glanzmann.de>

Hello,
is it possible to write split and lc() or \L in one statement?

so makeing out of these three lines, one?

my ($snummer, $maschinenname, $prozess) = (split(/;_,?/))[0,1,14];
$snummer = lc($snummer);
$maschinenname = lc($maschinenname);

        Thomas


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

Date: Thu, 17 Dec 2009 04:22:27 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: split and lc or \L in one statement
Message-Id: <pa8ki51mhlg7tuctcji859vjh7j99n2i39@4ax.com>

Thomas Glanzmann <thomas@glanzmann.de> wrote:
>Hello,
>is it possible to write split and lc() or \L in one statement?
>
>so makeing out of these three lines, one?
>
>my ($snummer, $maschinenname, $prozess) = (split(/;_,?/))[0,1,14];
>$snummer = lc($snummer);
>$maschinenname = lc($maschinenname);

I'd expect a simple

my ($snummer, $maschinenname, $prozess) = 			  
    (split(/;_,?/, lc))[0,1,14];

should work just fine because your RE doesn't discriminate on upper or
lower case.

jue


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

Date: Thu, 17 Dec 2009 19:16:00 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: split and lc or \L in one statement
Message-Id: <slrnhiktb0.l8j.hjp-usenet2@hrunkner.hjp.at>

On 2009-12-17 12:22, Jürgen Exner <jurgenex@hotmail.com> wrote:
> Thomas Glanzmann <thomas@glanzmann.de> wrote:
>>is it possible to write split and lc() or \L in one statement?
>>
>>so makeing out of these three lines, one?
>>
>>my ($snummer, $maschinenname, $prozess) = (split(/;_,?/))[0,1,14];
>>$snummer = lc($snummer);
>>$maschinenname = lc($maschinenname);
>
> I'd expect a simple
>
> my ($snummer, $maschinenname, $prozess) = 			  
>     (split(/;_,?/, lc))[0,1,14];

That converts $prozess to lower case, which the original code doesn't.

I don't see a simple way to convert only $snummer, $maschinenname to
lowercase.

	hp


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

Date: Thu, 17 Dec 2009 11:20:30 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: split and lc or \L in one statement
Message-Id: <gv0li5lr6o72ihcc1csfp6o9etr0uf2k53@4ax.com>

"Peter J. Holzer" <hjp-usenet2@hjp.at> wrote:
>On 2009-12-17 12:22, Jürgen Exner <jurgenex@hotmail.com> wrote:
>> Thomas Glanzmann <thomas@glanzmann.de> wrote:
>>>is it possible to write split and lc() or \L in one statement?
>>>
>>>so makeing out of these three lines, one?
>>>
>>>my ($snummer, $maschinenname, $prozess) = (split(/;_,?/))[0,1,14];
>>>$snummer = lc($snummer);
>>>$maschinenname = lc($maschinenname);
>>
>> I'd expect a simple
>>
>> my ($snummer, $maschinenname, $prozess) = 			  
>>     (split(/;_,?/, lc))[0,1,14];
>
>That converts $prozess to lower case, which the original code doesn't.
>I don't see a simple way to convert only $snummer, $maschinenname to
>lowercase.

You are right, my mistake. And because lc doesnt' accept a list as
argument I don't see any easy way, either. I guess you could try
something with map, but I seriously doubt it's worth the effort.

jue


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

Date: Thu, 17 Dec 2009 20:45:39 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: split and lc or \L in one statement
Message-Id: <jshqv6-7vo1.ln1@osiris.mauzo.dyndns.org>


Quoth Jürgen Exner <jurgenex@hotmail.com>:
> "Peter J. Holzer" <hjp-usenet2@hjp.at> wrote:
> >On 2009-12-17 12:22, Jürgen Exner <jurgenex@hotmail.com> wrote:
> >> Thomas Glanzmann <thomas@glanzmann.de> wrote:
> >>>is it possible to write split and lc() or \L in one statement?
> >>>
> >>>so makeing out of these three lines, one?
> >>>
> >>>my ($snummer, $maschinenname, $prozess) = (split(/;_,?/))[0,1,14];
> >>>$snummer = lc($snummer);
> >>>$maschinenname = lc($maschinenname);
> >>
> >> I'd expect a simple
> >>
> >> my ($snummer, $maschinenname, $prozess) = 			  
> >>     (split(/;_,?/, lc))[0,1,14];
> >
> >That converts $prozess to lower case, which the original code doesn't.
> >I don't see a simple way to convert only $snummer, $maschinenname to
> >lowercase.
> 
> You are right, my mistake. And because lc doesnt' accept a list as
> argument I don't see any easy way, either. I guess you could try
> something with map, but I seriously doubt it's worth the effort.

    my ($snummer, $maschinenname, $prozess) = split...;
    $_ = lc for $snummer, $maschinenname;

is a least simpler than the original. For my taste I would want local
temporaries like that to have shorter names, as well.

Ben



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

Date: Thu, 17 Dec 2009 13:01:41 -0800 (PST)
From: Marc Girod <marc.girod@gmail.com>
Subject: Re: split and lc or \L in one statement
Message-Id: <fa59fcc8-6168-4712-b085-e5098a2861d0@g7g2000yqa.googlegroups.com>

On Dec 17, 11:57=A0am, Thomas Glanzmann <tho...@glanzmann.de> wrote:

> my ($snummer, $maschinenname, $prozess) =3D (split(/;_,?/))[0,1,14];
> $snummer =3D lc($snummer);
> $maschinenname =3D lc($maschinenname);

my ($snummer, $maschinenname, $prozess) =3D
 grep{$_ =3D $c++<2 ? lc : $_}(split(/;_,?/))[0,1,14];

Marc


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

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:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 V11 Issue 2728
***************************************


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