[32368] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3635 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Mar 10 00:09:27 2012

Date: Fri, 9 Mar 2012 21:09:07 -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, 9 Mar 2012     Volume: 11 Number: 3635

Today's topics:
        Call for Venue for YAPC::Europe::2013 <blumbel@gmail.com>
    Re: Help with dynamic regex (Seymour J.)
        how to permute multi arrays with different numbers of e <vdz@vzd.vzd>
    Re: how to permute multi arrays with different numbers  <kiuhnm03.4t.yahoo.it>
    Re: how to permute multi arrays with different numbers  <rvtol+usenet@xs4all.nl>
    Re: how to permute multi arrays with different numbers  (Randal L. Schwartz)
    Re: how to permute multi arrays with different numbers  (Alan Curry)
    Re: how to permute multi arrays with different numbers  <ben@morrow.me.uk>
    Re: if ( -e $file_to_check ) <-- error in AIX 6.1 <uri@stemsystems.com>
    Re: if ( -e $file_to_check ) <-- error in AIX 6.1 (Tim McDaniel)
    Re: if ( -e $file_to_check ) <-- error in AIX 6.1 <uri@stemsystems.com>
        Problem with fork on some RHEL servers <droesler@comcast.net>
    Re: references (4567890) <derykus@gmail.com>
    Re: references (4567890) <kiuhnm03.4t.yahoo.it>
    Re: references (4567890) <derykus@gmail.com>
    Re: references (4567890) <ben@morrow.me.uk>
    Re: references (4567890) <derykus@gmail.com>
    Re: references (4567890) <ben@morrow.me.uk>
    Re: references (4567890) <derykus@gmail.com>
    Re: Storable.pm failing with error Byte order is not co <ben@morrow.me.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 9 Mar 2012 01:50:06 -0800 (PST)
From: Anton Berezin <blumbel@gmail.com>
Subject: Call for Venue for YAPC::Europe::2013
Message-Id: <14198b0d-dc03-4666-b484-54c6d0caa8a4@gw9g2000vbb.googlegroups.com>

Although YAPC::Europe::2012 preparations are well underway in
Frankfurt,
it is time for the venue committee of the YAPC::Europe Foundation
(YEF)
to think about the location of the 2013 conference.  YAPC::Europe
wouldn't exist without dedicated teams of volunteers, and we are
always
excited to see the enthusiasm and learn about the new ideas the
community has to offer.

Further information about preparing a complete application can be
found at http://www.yapceurope.org/organizers/index.html .
Proposals submitted to the venue committee will be added to this
public
repository (you may provide private information separately) to benefit
future organizers.

The deadlines which apply to this portion of the procedure are:

* Saturday, 7 April:  Deadline for sending a letter of intent.  This
  letter simply expresses interest in hosting the conference and
provides
  contact information (both email and telephone) for at least two
organizers.
  This is an optional step but it can be to your advantage to alert
the
  venue committee of your proposal.
* Thursday, 5 July:  Deadline for sending proposals to host
YAPC::Europe
  2013.

If you do not receive a confirmation for your letter of intent or
proposal
within a couple of days, please personally contact a member of the
venue
committee.

Please send your questions, letters of intent, and proposals to
venue@yapceurope.org.


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

Date: Fri, 09 Mar 2012 07:40:09 -0500
From: Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Subject: Re: Help with dynamic regex
Message-Id: <4f59fa29$36$fuzhry+tra$mr2ice@news.patriot.net>

In <87aa3rrt8g.fsf@sapphire.mobileactivedefense.com>, on 03/08/2012
   at 03:46 PM, Rainer Weikusat <rweikusat@mssgmbh.com> said:

>So, if somebody wants to use it in his own code, why not?

From the text your quoted, "it's a dirty habit to get into."

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



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

Date: Fri, 9 Mar 2012 23:30:33 +0100
From: "VZD" <vdz@vzd.vzd>
Subject: how to permute multi arrays with different numbers of element?
Message-Id: <jje09l$97t$1@l01news1.ot.hr>

Please help me to solve problem, how to permute multi arrays with different 
numbers of element? I can make it manually, but what If you have more that 
three arrays?

Thanks


# Perl permute multidimensional arrays
#

my @digits1 = qw(1 2);
my @digits2 = qw(1 2);
my @digits3 = qw(a b c);

foreach my $i (@digits1) {
   foreach my $j (@digits2) {
      foreach my $k (@digits3) {
         print "$i$j$k$l\n";
      }
   }
}






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

Date: Sat, 10 Mar 2012 01:01:13 +0100
From: Kiuhnm <kiuhnm03.4t.yahoo.it>
Subject: Re: how to permute multi arrays with different numbers of element?
Message-Id: <4f5a99c7$0$1382$4fafbaef@reader1.news.tin.it>

On 3/9/2012 23:30, VZD wrote:
> Please help me to solve problem, how to permute multi arrays with different
> numbers of element? I can make it manually, but what If you have more that
> three arrays?

Here's an iterative way:

--->
sub count {
     my $cback = shift;
     my @sizes = @_;
     my @cnts = map { 0 } 0..$#sizes;

     $cback->(@cnts);
     while (1) {
         my $idx = $#cnts;
         $cnts[$idx]++;
         while ($idx > 0) {
             last if $cnts[$idx] < $sizes[$idx];
             $cnts[$idx] = 0;
             $cnts[--$idx]++;
         }
         last if (!$idx && $cnts[0] == $sizes[0]);
         $cback->(@cnts);
     }
}

my @digits1 = qw(1 2);
my @digits2 = qw(1 2);
my @digits3 = qw(a b c);

my @arrays = (\@digits1, \@digits2, \@digits3);
&count(sub { say map { $arrays[$_]->[$_[$_]] } 0..$#arrays },
        map { scalar @{$_} } @arrays);
<---

Kiuhnm


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

Date: Sat, 10 Mar 2012 01:55:04 +0100
From: "Dr.Ruud" <rvtol+usenet@xs4all.nl>
Subject: Re: how to permute multi arrays with different numbers of element?
Message-Id: <4f5aa668$0$6937$e4fe514c@news2.news.xs4all.nl>

On 2012-03-09 23:30, VZD wrote:

> Please help me to solve problem, how to permute multi arrays with different
> numbers of element? I can make it manually, but what If you have more that
> three arrays?

Check out `perldoc -f glob`.


> my @digits1 = qw(1 2);
> my @digits2 = qw(1 2);
> my @digits3 = qw(a b c);

Numbered names raise a red flag.

-- 
Ruud


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

Date: Fri, 09 Mar 2012 17:15:34 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: how to permute multi arrays with different numbers of element?
Message-Id: <867gytb6ix.fsf@red.stonehenge.com>

>>>>> "Ruud" == Ruud  <rvtol+usenet@xs4all.nl> writes:

>> my @digits1 = qw(1 2);
>> my @digits2 = qw(1 2);
>> my @digits3 = qw(a b c);

Ruud> Numbered names raise a red flag.

Some call it "code smell".  I like that.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion


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

Date: Sat, 10 Mar 2012 02:55:36 +0000 (UTC)
From: pacman@kosh.dhis.org (Alan Curry)
Subject: Re: how to permute multi arrays with different numbers of element?
Message-Id: <jjefr7$cl7$1@speranza.aioe.org>

In article <jje09l$97t$1@l01news1.ot.hr>, VZD <vdz@vzd.vzd> wrote:
>Please help me to solve problem, how to permute multi arrays with different 
>numbers of element? I can make it manually, but what If you have more that 
>three arrays?
>
>Thanks
>
>
># Perl permute multidimensional arrays
>#
>
>my @digits1 = qw(1 2);
>my @digits2 = qw(1 2);
>my @digits3 = qw(a b c);
>
>foreach my $i (@digits1) {
>   foreach my $j (@digits2) {
>      foreach my $k (@digits3) {
>         print "$i$j$k$l\n";
>      }
>   }
>}

This operation is called a "Cartesian product". Knowing that, it should be
easy to find several implementations.

-- 
Alan Curry


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

Date: Sat, 10 Mar 2012 03:07:51 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: how to permute multi arrays with different numbers of element?
Message-Id: <75tq29-dfh.ln1@anubis.morrow.me.uk>


Quoth "VZD" <vdz@vzd.vzd>:
> Please help me to solve problem, how to permute multi arrays with different 
> numbers of element? I can make it manually, but what If you have more that 
> three arrays?

Hmm, well, since noone's given the obvious answer yet...

    my @digits = (
        [1, 2, 3],
        [4, 5, 6],
        [7, 8],
    );

    sub permute {
        map {
            my $d = $_;
            @_ ? map "$d$_", permute(@_) : $d;
        } @{ +shift };
    }

    say for permute @digits;

Of course, you'll learn a lot more if you do your own homework.

(I seem to keep finding situations where I want to be able to say

    map my $d { ... } ...

, and I believe the 'my' is enough to stop it being ambiguous. Hmmm.)

Ben



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

Date: Fri, 09 Mar 2012 12:29:23 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: if ( -e $file_to_check ) <-- error in AIX 6.1
Message-Id: <8762edwumk.fsf@stemsystems.com>

>>>>> "r" == rmcgorman  <rmcgorman@gmail.com> writes:

  r> Nevermind.  It turns out we had a file that had a blank filename in
  r> the directory where we are running the perl.  There must be a good
  r> reason to allow it, but having Unix allow a filename that's blank
  r> seems bizarre, and can lead to confusing situation like this one.

i would have checked that first as i trust the perl code to be
reasonably sane. nor would i think an os upgrade would break something
as core as that. as sherlock holmes would say, the answer has to be
elsewhere and the only logical thing is there must be a file named ' '!

as for filenames, all chars are allowed in them in unix flavors but / as
that is the dir delimiter. and as far as i can tell you can't have a
file with no chars in it.

uri


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

Date: Fri, 9 Mar 2012 19:51:16 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: if ( -e $file_to_check ) <-- error in AIX 6.1
Message-Id: <jjdmvk$k5u$1@reader1.panix.com>

In article <8762edwumk.fsf@stemsystems.com>,
Uri Guttman  <uri@stemsystems.com> wrote:
>as for filenames, all chars are allowed in them in unix flavors but /
>as that is the dir delimiter. and as far as i can tell you can't have
>a file with no chars in it.

There can be restrictions based on the filesystem.  In general, you
can't use "/" or the NUL byte (all 0 bits).  Indeed, you can't seem to
create or use a zero-length filename per se in the ext3 filesystem,
though I can't find an authoritative source, and when in a longer
path, it's ignored ("./" == ".", "/home//tmcdaniel" ==
"/home/tmcdaniel").

-- 
Tim McDaniel, tmcd@panix.com


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

Date: Fri, 09 Mar 2012 15:12:55 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: if ( -e $file_to_check ) <-- error in AIX 6.1
Message-Id: <871up1wn20.fsf@stemsystems.com>

>>>>> "TM" == Tim McDaniel <tmcd@panix.com> writes:

  TM> In article <8762edwumk.fsf@stemsystems.com>,
  TM> Uri Guttman  <uri@stemsystems.com> wrote:
  >> as for filenames, all chars are allowed in them in unix flavors but /
  >> as that is the dir delimiter. and as far as i can tell you can't have
  >> a file with no chars in it.

  TM> There can be restrictions based on the filesystem.  In general, you
  TM> can't use "/" or the NUL byte (all 0 bits).  Indeed, you can't seem to
  TM> create or use a zero-length filename per se in the ext3 filesystem,
  TM> though I can't find an authoritative source, and when in a longer
  TM> path, it's ignored ("./" == ".", "/home//tmcdaniel" ==
  TM> "/home/tmcdaniel").

that was my whole point to the OP. and i forgot about 0. it can't be in
a filename because it delimits the string in system calls. if the call
used a length param it could allow 0 in filenames. '' as a name makes
little sense to allow as you say it will reduce to the path anyhow.

uri


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

Date: Fri, 09 Mar 2012 10:28:42 -0700
From: Dennis <droesler@comcast.net>
Subject: Problem with fork on some RHEL servers
Message-Id: <jjdek5$oum$1@speranza.aioe.org>

Hi,

This is really not a Perl issue or Perl module issue per se, but doing 
this in Perl and not sure where to turn.  But the issue below works just 
fine on one RHEL server but crashes on another RHEL server.

Using Proc::Daemon and Log::Handler in a Perl script and Perl module, 
when the module tries to write to its log file the forked process crashes.

The server this works on is Linux 2.6.18-274.el5, which is a VM.
The server it doesn't is Linux 2.6.18-194.el5, which is physical 
hardware. But this also works on
Linux 2.6.30.10-105.2.23.fc11.i686.PAE, which is physical hardware.

The complete setup is as follows and I think I've stripped it down to 
the bare minimum that works on one server but not the other.  Also, if I 
don't use Proc::Daemon and code a fork process the results are the same.

I just can't figure out what is different between the two servers, or 
what I should be looking for.

Thanks

Dennis

###########   .testDaemon.pl  #############
#!/usr/bin/perl

use strict;
use warnings;

use Proc::Daemon;
use Data::Dumper;
use Log::Handler;

use lib '/opt/sdo/lib/handlers';
use Stuff::MonitorStuffFiles;

my $stuffMonitor = Stuff::MonitorStuffFiles->new();

my $mainLog = Log::Handler->new(
    config  => '/opt/sdo/lib/handlers/Stuff/loggers/logger.conf',
    section => 'monitorStuffFiles'
);

$mainLog->error( Dumper($stuffMonitor) );

Proc::Daemon::Init( {
    child_STDOUT => '/tmp/daemon.out',
    child_STDERR => '/tmp/daemon.out'
} );

my $log = Log::Handler->new(
    config  => '/opt/sdo/lib/handlers/Stuff/loggers/logger.conf',
    section => 'monitorStuffFiles'
);

$log->info("Starting monitoring...");

while (1) {
    my @fileList = glob("/opt/sdo/nas/Test/*xml");
    for my $file (@fileList) {
       $log->info("File: $file");
       $stuffMonitor->processFile($file);
    }
    sleep 5;
}

###########  Stuff:MonitorStuffFiles.pm  ###########
package Stuff::MonitorStuffFiles;

use strict;
use warnings;

use Data::Dumper;
use Log::Handler;

my $log = Log::Handler->new(
    config  => '/opt/sdo/lib/handlers/Stuff/loggers/logger.conf',
    section => 'monitorStuffFiles'
);

sub new {
    my $class = shift;
    my $self  = {};

    bless $self, $class;
    return $self;
}

sub processFile {
    my ( $self, $file ) = @_;

    $log->info("Got file: $file");  # <==commenting out this line
				   #    then the daemon runs OK.
    return;

}

1;

#########  logger conf file ############
<monitorStuffFiles>
    <file>
       mode           =  append
       permissions    =  0666
       maxlevel       =  debug
       minlevel       =  emergency
       utf8           =  1
       timeformat     =  %Y%m%d.%H%M%S
       message_layout =  %T [%L] > %p:%l - %m
       filename       =  /opt/sdo/lib/handlers/Stuff/stuff.log
    </file>
</monitorStuffFiles>

What is in /tmp/daemon.out ------

Log::Handler::Output: unable to print to logfile: Bad file descriptor at 
/usr/lib/perl5/site_perl/5.8.8/Log/Handler/Levels.pm line 212


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

Date: Thu, 8 Mar 2012 23:26:33 -0800 (PST)
From: "C.DeRykus" <derykus@gmail.com>
Subject: Re: references (4567890)
Message-Id: <7cb83580-6250-431d-914a-8ff98333a1ad@b18g2000vbz.googlegroups.com>

On Mar 1, 12:48=A0pm, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth Kiuhnm <kiuhnm03.4t.yahoo.it>:
>
> > Is there any good reason (why) we can't write
> > =A0 =A0ref->[0][1] instead of $ref->[0][1]
>
> That parses as
>
> =A0 =A0 ref($_)->[0][1]
>
> and if you don't use a reserved word it parses as one of
>
> =A0 =A0 "foo"->[0][1]
> or =A0foo()->[0][1]
>
> depending on whether there is a 'sub foo' in scope. The former is a
> symref (it's equivalent to ${"foo"}[0][1]) and will cause an error under
> strict "refs".
>
> > and, above all,
> > =A0 =A0@ref->[0][1] instead of @{$ref->[0][1]}
> > ?
>
> I did up a patch for perl at one point that made
>
> =A0 =A0 $ref->[0][1][]
>
> (with an empty set of brackets on the end) equivalent to
>
> =A0 =A0 @{$ref->[0][1]}
>
> and the equivalent for %{}, but it was rejected on the grounds that it
> wasn't useful enough to be worth introducing new syntax for. (Personally
> I'd rather an explicit syntax like that than 5.14's auto-deref for
> specific ops like push, but there we go.)
>
> Ben

Seems odd to me though that both these draw
warnings:

perl -E '@ref=3D(["a".."b"]);say @ref->[0][1], @{$ref[0]}->[1]'
Using an array as a reference is deprecated...
Using an array as a reference is deprecated...
bb

since the latter appears as unambiguous
as something like this:

perl -E 'say ["a".."b"]->[1]'
b

--
Charles DeRykus


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

Date: Fri, 09 Mar 2012 11:55:57 +0100
From: Kiuhnm <kiuhnm03.4t.yahoo.it>
Subject: Re: references (4567890)
Message-Id: <4f59e1bb$0$1390$4fafbaef@reader1.news.tin.it>

On 3/9/2012 8:26, C.DeRykus wrote:
> On Mar 1, 12:48 pm, Ben Morrow<b...@morrow.me.uk>  wrote:
>> Quoth Kiuhnm<kiuhnm03.4t.yahoo.it>:
>>
>>> Is there any good reason (why) we can't write
>>>     ref->[0][1] instead of $ref->[0][1]
>>
>> That parses as
>>
>>      ref($_)->[0][1]
>>
>> and if you don't use a reserved word it parses as one of
>>
>>      "foo"->[0][1]
>> or  foo()->[0][1]
>>
>> depending on whether there is a 'sub foo' in scope. The former is a
>> symref (it's equivalent to ${"foo"}[0][1]) and will cause an error under
>> strict "refs".
>>
>>> and, above all,
>>>     @ref->[0][1] instead of @{$ref->[0][1]}
>>> ?
>>
>> I did up a patch for perl at one point that made
>>
>>      $ref->[0][1][]
>>
>> (with an empty set of brackets on the end) equivalent to
>>
>>      @{$ref->[0][1]}
>>
>> and the equivalent for %{}, but it was rejected on the grounds that it
>> wasn't useful enough to be worth introducing new syntax for. (Personally
>> I'd rather an explicit syntax like that than 5.14's auto-deref for
>> specific ops like push, but there we go.)
>>
>> Ben
>
> Seems odd to me though that both these draw
> warnings:
>
> perl -E '@ref=(["a".."b"]);say @ref->[0][1], @{$ref[0]}->[1]'
> Using an array as a reference is deprecated...
> Using an array as a reference is deprecated...
> bb

@{$ref[0]} is not a ref, but an array. This works:
@{$ref[0]}[1]

> since the latter appears as unambiguous
> as something like this:
>
> perl -E 'say ["a".."b"]->[1]'

This is more like
$ref[0]->[1].

Kiuhnm


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

Date: Fri, 9 Mar 2012 08:55:33 -0800 (PST)
From: "C.DeRykus" <derykus@gmail.com>
Subject: Re: references (4567890)
Message-Id: <6f42d5f5-0358-4151-8246-75a427d3f6df@v2g2000vbx.googlegroups.com>

On Mar 9, 2:55=A0am, Kiuhnm <kiuhnm03.4t.yahoo.it> wrote:
> On 3/9/2012 8:26, C.DeRykus wrote:
> ...
>
> > Seems odd to me though that both these draw
> > warnings:
>
> > perl -E '@ref=3D(["a".."b"]);say @ref->[0][1], @{$ref[0]}->[1]'
> > Using an array as a reference is deprecated...
> > Using an array as a reference is deprecated...
> > bb
>
> @{$ref[0]} is not a ref, but an array. This works:
> @{$ref[0]}[1]

Yes, that's right of course. It would seem
as if you were making it more explicit that
$ref[0] is the ref that's needs to be pulled
out to satisfy ->. I'm sure that's easier imagined than done :) It'd
be really "odd" if it were  clever enough to do all that.

>
> > since the latter appears as unambiguous
> > as something like this:
>
> > perl -E 'say ["a".."b"]->[1]'
>
> This is more like
> $ref[0]->[1].
>

Yeah, and probably much easier for the
parser.


--
Charles DeRykus


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

Date: Fri, 9 Mar 2012 18:27:03 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: references (4567890)
Message-Id: <nkup29-or8.ln1@anubis.morrow.me.uk>


Quoth "C.DeRykus" <derykus@gmail.com>:
> On Mar 9, 2:55 am, Kiuhnm <kiuhnm03.4t.yahoo.it> wrote:
> > On 3/9/2012 8:26, C.DeRykus wrote:
> >
> > > Seems odd to me though that both these draw
> > > warnings:
> >
> > > perl -E '@ref=(["a".."b"]);say @ref->[0][1], @{$ref[0]}->[1]'
> > > Using an array as a reference is deprecated...
> > > Using an array as a reference is deprecated...
> > > bb
> >
> > @{$ref[0]} is not a ref, but an array. This works:
> > @{$ref[0]}[1]
> 
> Yes, that's right of course. It would seem
> as if you were making it more explicit that
> $ref[0] is the ref that's needs to be pulled
> out to satisfy ->. I'm sure that's easier imagined than done :) It'd
> be really "odd" if it were  clever enough to do all that.

It *is* clever enough, since you get the 'right' answer. It's just also
clever enough to issue a warning, since this isn't syntax which makes
sense.

Ben



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

Date: Fri, 9 Mar 2012 11:29:39 -0800 (PST)
From: "C.DeRykus" <derykus@gmail.com>
Subject: Re: references (4567890)
Message-Id: <c2b2ad96-61ea-4a8c-ae89-80670df81baa@s7g2000vby.googlegroups.com>

On Mar 9, 10:27=A0am, Ben Morrow <b...@morrow.me.uk> wrote:

>
>
> > On Mar 9, 2:55=A0am, Kiuhnm <kiuhnm03.4t.yahoo.it> wrote:
> > > On 3/9/2012 8:26, C.DeRykus wrote:
>
> > > > Seems odd to me though that both these draw
> > > > warnings:
>
> > > > perl -E '@ref=3D(["a".."b"]);say @ref->[0][1], @{$ref[0]}->[1]'
> > > > Using an array as a reference is deprecated...
> > > > Using an array as a reference is deprecated...
> > > > bb
>
> > > @{$ref[0]} is not a ref, but an array. This works:
> > > @{$ref[0]}[1]
>
> > Yes, that's right of course. It would seem
> > as if you were making it more explicit that
> > $ref[0] is the ref that's needs to be pulled
> > out to satisfy ->. I'm sure that's easier imagined than done :) It'd
> > be really "odd" if it were =A0clever enough to do all that.
>
> It *is* clever enough, since you get the 'right' answer. It's just also
> clever enough to issue a warning, since this isn't syntax which makes
> sense.
>

Yes, I forgot it was actually doing it...
somewhat grudgingly. But, I've forgotten why
it doesn't make 'sense' - not that it really
matters. Arguably, it does seems a bit counter to DWIM and restrictive
though since it can
find the embedded reference it needs/wants.

--
Charles DeRykus




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

Date: Fri, 9 Mar 2012 20:53:21 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: references (4567890)
Message-Id: <177q29-3ha.ln1@anubis.morrow.me.uk>


Quoth "C.DeRykus" <derykus@gmail.com>:
> On Mar 9, 10:27 am, Ben Morrow <b...@morrow.me.uk> wrote:
> > > On Mar 9, 2:55 am, Kiuhnm <kiuhnm03.4t.yahoo.it> wrote:
> > > > On 3/9/2012 8:26, C.DeRykus wrote:
> >
> > > > > Seems odd to me though that both these draw
> > > > > warnings:
> >
> > > > > perl -E '@ref=(["a".."b"]);say @ref->[0][1], @{$ref[0]}->[1]'
> > > > > Using an array as a reference is deprecated...
> > > > > Using an array as a reference is deprecated...
> > > > > bb
> >
> > > > @{$ref[0]} is not a ref, but an array. This works:
> > > > @{$ref[0]}[1]
> >
> > > Yes, that's right of course. It would seem
> > > as if you were making it more explicit that
> > > $ref[0] is the ref that's needs to be pulled
> > > out to satisfy ->. I'm sure that's easier imagined than done :) It'd
> > > be really "odd" if it were  clever enough to do all that.
> >
> > It *is* clever enough, since you get the 'right' answer. It's just also
> > clever enough to issue a warning, since this isn't syntax which makes
> > sense.
> 
> Yes, I forgot it was actually doing it...
> somewhat grudgingly. But, I've forgotten why
> it doesn't make 'sense' - not that it really
> matters. Arguably, it does seems a bit counter to DWIM and restrictive
> though since it can
> find the embedded reference it needs/wants.

You are writing

    @ref->[0]

instead of

    $ref[0]   or      (\@ref)->[0]

The correct way to write your two cases above would be

    say $ref[0][1], ${$ref[0]}[1];

Ben



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

Date: Fri, 9 Mar 2012 21:00:53 -0800 (PST)
From: "C.DeRykus" <derykus@gmail.com>
Subject: Re: references (4567890)
Message-Id: <264abf53-95c3-486f-86b7-618b55b01f98@y10g2000vbn.googlegroups.com>

On Mar 9, 12:53=A0pm, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth "C.DeRykus" <dery...@gmail.com>:
>
>
>
>
>
>
>
>
>
> > On Mar 9, 10:27=A0am, Ben Morrow <b...@morrow.me.uk> wrote:
> > > > On Mar 9, 2:55=A0am, Kiuhnm <kiuhnm03.4t.yahoo.it> wrote:
> > > > > On 3/9/2012 8:26, C.DeRykus wrote:
>
> > > > > > Seems odd to me though that both these draw
> > > > > > warnings:
>
> > > > > > perl -E '@ref=3D(["a".."b"]);say @ref->[0][1], @{$ref[0]}->[1]'
> > > > > > Using an array as a reference is deprecated...
> > > > > > Using an array as a reference is deprecated...
> > > > > > bb
>
> > > > > @{$ref[0]} is not a ref, but an array. This works:
> > > > > @{$ref[0]}[1]
>
> > > > Yes, that's right of course. It would seem
> > > > as if you were making it more explicit that
> > > > $ref[0] is the ref that's needs to be pulled
> > > > out to satisfy ->. I'm sure that's easier imagined than done :) It'=
d
> > > > be really "odd" if it were =A0clever enough to do all that.
>
> > > It *is* clever enough, since you get the 'right' answer. It's just al=
so
> > > clever enough to issue a warning, since this isn't syntax which makes
> > > sense.
>
> > Yes, I forgot it was actually doing it...
> > somewhat grudgingly. But, I've forgotten why
> > it doesn't make 'sense' - not that it really
> > matters. Arguably, it does seems a bit counter to DWIM and restrictive
> > though since it can
> > find the embedded reference it needs/wants.
>
> You are writing
>
> =A0 =A0 @ref->[0]
>
> instead of
>
> =A0 =A0 $ref[0] =A0 or =A0 =A0 =A0(\@ref)->[0]
>
> The correct way to write your two cases above would be
>
> =A0 =A0 say $ref[0][1], ${$ref[0]}[1];
>

Thanks Ben. I'm aware of the correct call.
I was just curious about the deprecation
itself... since this departure from the
intended usage of the arrow operator didn't seem that hideous.

--
Charles DeRykus


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

Date: Thu, 8 Mar 2012 22:41:24 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Storable.pm failing with error Byte order is not compatible at blib/lib/Storable.pm
Message-Id: <k5pn29-uch2.ln1@anubis.morrow.me.uk>


Quoth Rainer Weikusat <rweikusat@mssgmbh.com>:
>
> It may also be possible to just change the header of the file if the
> Storable 'network byte order' serialization isn't really different
> from a native big-endian one.

It is different. For one thing, nstore stores floats as strings, while
store stores them as native floats (using whatever representation the
current machine uses, which isn't necessarily fixed for a given byte
order). (In practice I believe all machines perl runs on nowadays use
IEEE floats, though this will depend on whether your perl is built with
-Duselongdouble.)

Ben



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

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


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