[24980] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7230 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 10 09:07:05 2004

Date: Sun, 10 Oct 2004 06:05:08 -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           Sun, 10 Oct 2004     Volume: 10 Number: 7230

Today's topics:
        $ua->get vs $ua->request <nntp@rogers.com>
    Re: $ua->get vs $ua->request <nobull@mail.com>
    Re: C (I think) to Perl Conversion <uri@stemsystems.com>
    Re: C (I think) to Perl Conversion <nospam@bigpond.com>
    Re: C (I think) to Perl Conversion <sammie-nospam@greatergreen.com>
    Re: C (I think) to Perl Conversion <kalinaubears@iinet.net.au>
    Re: C (I think) to Perl Conversion <sammie-nospam@greatergreen.com>
    Re: Error.pm and DBI.pm problem (Horst Walter)
    Re: Error.pm and DBI.pm problem (Anno Siegel)
    Re: How do I Capitalize the first letter? <someone@example.com>
        possible mem leak ? <news@sloeber.office.xs4all.be>
    Re: possible mem leak ? <nobull@mail.com>
    Re: possible mem leak ? <news@sloeber.office.xs4all.be>
        What does  $base)->abs do? <nntp@rogers.com>
    Re: What does  $base)->abs do? <nobull@mail.com>
    Re: What does  $base)->abs do? <nntp@rogers.com>
    Re: What does  $base)->abs do? <nobull@mail.com>
    Re: While query <nobull@mail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 10 Oct 2004 02:55:09 -0400
From: "nntp" <nntp@rogers.com>
Subject: $ua->get vs $ua->request
Message-Id: <7badnSkezL5kQfXcRVn-jg@rogers.com>

# Request document and parse it as it arrives
  $res = $ua->request(HTTP::Request->new(GET => $url));

And this


  $ua = LWP::UserAgent->new;
  $response = $ua->get("$url");


Why sometimes it is us-get and sometime it is us->request?





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

Date: Sun, 10 Oct 2004 11:29:40 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: $ua->get vs $ua->request
Message-Id: <ckb2um$gqo$1@slavica.ukpost.com>



nntp wrote:

> # Request document and parse it as it arrives
>   $res = $ua->request(HTTP::Request->new(GET => $url));
> 
> And this
> 
> 
>   $ua = LWP::UserAgent->new;
>   $response = $ua->get("$url");

Often an API provides a shorthand mechanism to combine serveral API 
calls that are frequently used together into one.

Sometimes a programmer will use the shorthand, sometimes not.  Sometimes 
  one programmer will use it and another will not.  Sometimes the 
shorthand is a late addittion to the API an some calling code predates 
its introduction.

To know why in any particular case you'd have to ask the programmers in 
question.

> 
> 
> Why sometimes it is us-get and sometime it is us->request?
> 
> 
> 



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

Date: Sun, 10 Oct 2004 04:27:13 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: C (I think) to Perl Conversion
Message-Id: <x7llefgpwu.fsf@mail.sysarch.com>

>>>>> "BW" == Brad Walton <sammie-nospam@greatergreen.com> writes:

  BW> I'm stuck here... I have a sample script which accomplishes the
  BW> task I need done, but it's done in another programing language (of
  BW> which I have no understanding). I have researched this for hours
  BW> and hours, but no luck.

  BW> ----

  BW> This is a longshot.. but I don't know what else to do.

hire a programmer.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Sun, 10 Oct 2004 16:25:33 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: C (I think) to Perl Conversion
Message-Id: <2ss2utF1p8jj2U1@uni-berlin.de>

Brad Walton wrote:

> I'm stuck here... I have a sample script which accomplishes the task I
> need done, but it's done in another programing language (of which I have
> no understanding). I have researched this for hours and hours, but no
> luck.
> 
> The script I need 'deciphered' to Perl:
> 
> ----
> #include <string.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <sys/types.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #include <arpa/inet.h>
> #include <unistd.h>
> #include <sys/ioctl.h>
> #include <netinet/tcp.h>
> 
> int main(int argc, char *argv[] )
> {
>         int sock = socket(  AF_INET, SOCK_STREAM, IPPROTO_TCP );
>         if ( sock == -1 )
>         {
>                 printf( "Socket creation failed" );
>                 exit(-1);
>         }
> 
>         struct sockaddr_in rcon_server;
>         rcon_server.sin_family = AF_INET;
>         rcon_server.sin_addr.s_addr = inet_addr( "127.0.0.1" );
>         rcon_server.sin_port = htons( 27015 );
> 
>         if ( connect( sock, (const struct sockaddr *)&rcon_server,sizeof(
> rcon_server ) )!= 0 )
>         {
>                 printf( "Unable to connect\n");
>                 exit(-1);
>         }
> 
>         unsigned char send_buf[4096];
>         unsigned char *send_ptr = send_buf + sizeof(int);
> 
>         *(int *)send_ptr = 0x0001; // request id 1
>         send_ptr += sizeof(int);
>         *(int *)send_ptr = 0x0003; // command id 3
>         send_ptr += sizeof(int);
> 
>         strcpy( (char *)send_ptr, "password" ); // the rcon password
>         send_ptr += strlen("password") +1; //+1 for null terminator
>         *(int *)send_ptr = 0; // 2nd string is just null
>         send_ptr++;
>         (*(int *)send_buf) = (int)(send_ptr - send_buf - sizeof(int)); //
> now setup the size of this packet (NOTE the subtraction of sizeof(int)!!)
> 
>         printf( "Sending packet (%d bytes)\n", *(int *)(send_buf) );
> 
>         send( sock, send_buf, *(int *)(send_buf) + sizeof(int), 0 ); //
>         send
> the auth request
> 
>         sleep(1); // ugly hack to give the server time to respond
> 
>         long readLen;
>         ioctl( sock, FIONREAD, &readLen );
>         printf("Got %d bytes from server\n", readLen );
> 
>         int len = recv( sock, send_buf, readLen, 0);
>         if ( len < 14 )
>         {
>                 printf("Didn't read enough data (%i)( TODO: block on
> reads)\n", len);
>                 exit(-1);
>         }
> 
>         printf( "packet size: %d, request id:%d, command:%d\n",
> (int)send_buf[0],(int)send_buf[4],(int)send_buf[8]);
> 
>         if ( len > 14 ) // a 2nd packet is in the response
>         {
>                 printf( "packet size: %d, request id:%d, command:%d\n",
> (int)send_buf[14],(int)send_buf[18],(int)send_buf[22]);
>         }
> 
>         close( sock );
> }
> ----
> 
> This is a longshot.. but I don't know what else to do.
> 
> Thanks for any help,
> Brad

Why reinvent the wheel? Compile in C and run.

gtoomey


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

Date: Sat, 9 Oct 2004 23:30:55 -0700
From: "Brad Walton" <sammie-nospam@greatergreen.com>
Subject: Re: C (I think) to Perl Conversion
Message-Id: <I-ednbjzseeDSvXcRVn-tA@comcast.com>

> Why reinvent the wheel? Compile in C and run.
>
> gtoomey

Because the other 75% of the program is written in Perl, which I understand.
And, I need to add code to it to make it work in my script. I also have zero
experience with C unfortunately...

Thanks,
Brad




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

Date: Sun, 10 Oct 2004 16:54:44 +1000
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: Re: C (I think) to Perl Conversion
Message-Id: <4168ddf1$0$1261$5a62ac22@per-qv1-newsreader-01.iinet.net.au>

Brad Walton wrote:
> I'm stuck here... I have a sample script which accomplishes the task I need
> done, but it's done in another programing language (of which I have no
> understanding). I have researched this for hours and hours, but no luck.
> 


Looks to me that Inline::C should be able to handle this very simply. 
What follows is little other than a copy'n'paste of that C script. 
(Beware of line wraps.) I'll leave it to the reader to spot the 
differences. You may need to uncomment the 3 Inline Config lines and 
specify the same libs that are specified at the C script linking stage. 
(If you're able to build the C app from source without having to specify 
any libs then you probably don't have to worry about it.)

use warnings;

#use Inline (C => Config =>
#    'LIBS' => [], #eg ['-lm -lmylib']
#     );

use Inline C => <<'EOC';
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <netinet/tcp.h>

void do_it()
{
         int sock = socket(  AF_INET, SOCK_STREAM, IPPROTO_TCP );
         if ( sock == -1 )
         {
                 croak("Socket creation failed");

         }

         struct sockaddr_in rcon_server;
         rcon_server.sin_family = AF_INET;
         rcon_server.sin_addr.s_addr = inet_addr( "127.0.0.1" );
         rcon_server.sin_port = htons( 27015 );

         if ( connect( sock, (const struct sockaddr *)&rcon_server,sizeof(
rcon_server ) )!= 0 )
         {
                 croak( "Unable to connect");
         }

         unsigned char send_buf[4096];
         unsigned char *send_ptr = send_buf + sizeof(int);

         *(int *)send_ptr = 0x0001; // request id 1
         send_ptr += sizeof(int);
         *(int *)send_ptr = 0x0003; // command id 3
         send_ptr += sizeof(int);

         strcpy( (char *)send_ptr, "password" ); // the rcon password
         send_ptr += strlen("password") +1; //+1 for null terminator
         *(int *)send_ptr = 0; // 2nd string is just null
         send_ptr++;
         (*(int *)send_buf) = (int)(send_ptr - send_buf - sizeof(int)); //
now setup the size of this packet (NOTE the subtraction of sizeof(int)!!)

         printf( "Sending packet (%d bytes)\n", *(int *)(send_buf) );

         send( sock, send_buf, *(int *)(send_buf) + sizeof(int), 0 ); // 
send
the auth request

         sleep(1); // ugly hack to give the server time to respond

         long readLen;
         ioctl( sock, FIONREAD, &readLen );
         printf("Got %d bytes from server\n", readLen );

         int len = recv( sock, send_buf, readLen, 0);
         if ( len < 14 )
         {
                 croak("Didn't read enough data (%i)( TODO: block on
reads)\n", len);
         }

         printf( "packet size: %d, request id:%d, command:%d\n",
(int)send_buf[0],(int)send_buf[4],(int)send_buf[8]);

         if ( len > 14 ) // a 2nd packet is in the response
         {
                 printf( "packet size: %d, request id:%d, command:%d\n",
(int)send_buf[14],(int)send_buf[18],(int)send_buf[22]);
         }

         close( sock );
}

EOC

do_it();

__END__

Hope it's that simple. I can't see why it shouldn't be.

Things get a little more complex if you start passing values between 
perl and the Inline::C function - for help with that aspect first check 
out 'perldoc Inline::C-Cookbook'.

The code supplied above has not been tested.

Cheers,
Rob

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



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

Date: Sun, 10 Oct 2004 00:12:23 -0700
From: "Brad Walton" <sammie-nospam@greatergreen.com>
Subject: Re: C (I think) to Perl Conversion
Message-Id: <T5SdnRCzF4BLffXcRVn-qQ@comcast.com>

[snip]
> Things get a little more complex if you start passing values between
> perl and the Inline::C function - for help with that aspect first check
> out 'perldoc Inline::C-Cookbook'.
>
> The code supplied above has not been tested.
>
> Cheers,
> Rob

Thanks Rob, I'll give it a go. Appreciate the assitance.

Brad




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

Date: 10 Oct 2004 02:31:31 -0700
From: unkwb@web.de (Horst Walter)
Subject: Re: Error.pm and DBI.pm problem
Message-Id: <53867fbe.0410100131.4b30c314@posting.google.com>

sub oracleLogoff ($) {
 my ($dbh) = @_;
 if (!defined $dbh) {
  return;
 }
 
 # avoid any trouble during close
 try {
  $dbh->disconnect;
 } catch Error with { 
    # ignore the error
 };
}


Error
Error: Can't call method "with" without a package or object reference
at autodb.pm line 181. ("catch Error with") line







peter@PSDT.com (Peter Scott) wrote in message news:<x8b9d.17813$a41.15681@pd7tw2no>...
> In article <53867fbe.0410060715.7948a734@posting.google.com>,
>  unkwb@web.de (Horst Walter) writes:
> >Yes, this is what I have guessed. But I tried many things and was not
> >able to do it.
> >
> >I used
> >use Error qw(:try);
> >
> >as in all the examples for error.pm. I have tried several tings as 
> >use Error qw(:try with);
> >
> >but none of them worked.
> >It would be great if somebody had an example on this.
> 
> Post the shortest *complete program* you can construct that
> demonstrates the problem please.  I have never had problems
> with Error.pm and DBI and cannot reproduce your problem.


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

Date: 10 Oct 2004 12:43:57 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Error.pm and DBI.pm problem
Message-Id: <ckbaqd$34v$1@mamenchi.zrz.TU-Berlin.DE>

Horst Walter <unkwb@web.de> wrote in comp.lang.perl.misc:

Don't top-post.  I have moved your reply where it belongs, after what
you are replying to,

> peter@PSDT.com (Peter Scott) wrote in message
> news:<x8b9d.17813$a41.15681@pd7tw2no>...
> > In article <53867fbe.0410060715.7948a734@posting.google.com>,
> >  unkwb@web.de (Horst Walter) writes:

> > >Yes, this is what I have guessed. But I tried many things and was not
> > >able to do it.
> > >
> > >I used
> > >use Error qw(:try);
> > >
> > >as in all the examples for error.pm. I have tried several tings as 
> > >use Error qw(:try with);
> > >
> > >but none of them worked.
> > >It would be great if somebody had an example on this.
> > 
> > Post the shortest *complete program* you can construct that
> > demonstrates the problem please.  I have never had problems
> > with Error.pm and DBI and cannot reproduce your problem.

> sub oracleLogoff ($) {
>  my ($dbh) = @_;
>  if (!defined $dbh) {
>   return;
>  }
>  
>  # avoid any trouble during close
>  try {
>   $dbh->disconnect;
>  } catch Error with { 
>     # ignore the error
>  };
> }
> 
> 
> Error
> Error: Can't call method "with" without a package or object reference
> at autodb.pm line 181. ("catch Error with") line

That is *not* a complete program.  A complete program is one that can
be copied and pasted into a file and run.  In particular, yours doesn't
show how you load the Errors module.

Have you read the documentation of Errors.pm?  Especially what it says
about an export tag named ":try"?

Anno


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

Date: Sun, 10 Oct 2004 05:03:12 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: How do I Capitalize the first letter?
Message-Id: <ko3ad.8409$663.4720@edtnps84>

l v wrote:
> nntp wrote:
>>
>> s/\s(\w)//g;
>> how to inclue the fist letter in too?
>>
>> I want to make
>> abc xyz to Abc Xyz
> 
> Not sure on exactly what you are asking for.  Below will capitalize the 
> first letter of every word in $a.
> 
> join ' ', ( map {ucfirst $_ } split /\W/, $a );

You are changing all the \W characters to ' ' which may not be what the OP 
wants.  You could fix that by:

join '', map ucfirst, split /(\W+)/, $a;


John
-- 
use Perl;
program
fulfillment


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

Date: Sun, 10 Oct 2004 11:46:51 +0200
From: "arne" <news@sloeber.office.xs4all.be>
Subject: possible mem leak ?
Message-Id: <41690509$0$150$e4fe514c@dreader11.news.xs4all.nl>

Hi

below is my rather short script that just takes STDIN and logs it to syslog

if I attach this program to apache as my access-log (I know why i do it like 
this), after a few days, the process mem-size is 132Meg and above, which is 
too big for such a small program.

have i done something wrong? Should I use references somewhere?

*cut*
#!/usr/bin/perl

use strict;

#this is a funny construction, could have said <1 or > 2
if (@ARGV != 1 && @ARGV != 2) {
        print "usage: $0 <servicename> <prefix>\n";
        exit(1);
}

my $prefix="";
if (@ARGV==2) {
        $prefix = $ARGV[1].": ";
}

use Unix::Syslog qw(:macros :subs);

openlog($ARGV[0], LOG_PID, LOG_LOCAL2);
while (<STDIN>) {
        syslog(LOG_INFO, $prefix.$_);
}
closelog();
*cut*




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

Date: Sun, 10 Oct 2004 11:06:03 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: possible mem leak ?
Message-Id: <ckb1ic$b2b$1@slavica.ukpost.com>



arne wrote:

> if I attach this program to apache as my access-log (I know why i do it like 
> this), after a few days, the process mem-size is 132Meg and above, which is 
> too big for such a small program.
> 
> have i done something wrong? Should I use references somewhere?

I doubt that anything you have done can be blamed.

> use Unix::Syslog qw(:macros :subs);
> 
> openlog($ARGV[0], LOG_PID, LOG_LOCAL2);
> while (<STDIN>) {
>         syslog(LOG_INFO, $prefix.$_);
> }
> closelog();

What version of Perl are you using? Older versions tend to leak more.

Another possibility is that the leak is in Unix::Syslog.

Note you are not calling syslog correctly - is should be

          syslog(LOG_INFO, "%s%s", $prefix, $_);

I doubt, however, this could explain your leak.



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

Date: Sun, 10 Oct 2004 12:33:18 +0200
From: "arne" <news@sloeber.office.xs4all.be>
Subject: Re: possible mem leak ?
Message-Id: <41690fec$0$30780$e4fe514c@dreader16.news.xs4all.nl>

>> if I attach this program to apache as my access-log (I know why i do it 
>> like this), after a few days, the process mem-size is 132Meg and above, 
>> which is too big for such a small program.
>>
>> have i done something wrong? Should I use references somewhere?
>
> I doubt that anything you have done can be blamed.
>
>> use Unix::Syslog qw(:macros :subs);
>>
>> openlog($ARGV[0], LOG_PID, LOG_LOCAL2);
>> while (<STDIN>) {
>>         syslog(LOG_INFO, $prefix.$_);
>> }
>> closelog();
>
> What version of Perl are you using? Older versions tend to leak more.
it is 5.6.0, maybe it's time to upgrade that version :)

> Another possibility is that the leak is in Unix::Syslog.
>
> Note you are not calling syslog correctly - is should be
>
>          syslog(LOG_INFO, "%s%s", $prefix, $_);
>
> I doubt, however, this could explain your leak.
thx for the notice, will fix it soon (right is right :))

arne




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

Date: Sun, 10 Oct 2004 04:29:05 -0400
From: "nntp" <nntp@rogers.com>
Subject: What does  $base)->abs do?
Message-Id: <oZCdnX-mC_lzb_XcRVn-iA@rogers.com>

I checked the document, but its statement means nothing. I also did the
test, no difference at all.

  my $base = $response->base;
  @output = map { $_ = url($_, $base)->abs; } @output;

  my $base = $response->base;
  @output = map { $_ = $base  } @output;

Both act the same.




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

Date: Sun, 10 Oct 2004 11:23:02 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: What does  $base)->abs do?
Message-Id: <ckb2i8$gqc$1@slavica.ukpost.com>

nntp wrote:

 > Subject: What does  $base)->abs do?

Nothing - it is not a meaining full code fragment.

    EXPR->abs

Evaluates an expression and then attempts a method call 'abs' on the 
result.  If the result of


> I checked the document, but its statement means nothing.

The document?  Which document?  The document that is the documentation 
from the class of the object that the expression is retunring?

> I also did the test, no difference at all.
> 
>   my $base = $response->base;
>   @output = map { $_ = url($_, $base)->abs; } @output;
> 
>   my $base = $response->base;
>   @output = map { $_ = $base  } @output;
> 
> Both act the same.

In that case, without knowing anything about the url() function (because 
  I don't know what module you are getting) I can make two totally 
random stabs in the dark simply by guessing at the functinality.

   1) Maybe you've got the arguments of url() transposed.

   2) Maybe all the elements in @output were initially empty strings.

Oh and:

   @foo = map { $_ = somefunction($_) } @foo;

is affected and confusing.  Say instead:

   $_ = somefunction($_) for @foo;

or

   @foo = map { scalar somefunction($_) } @foo;

Of course scalar() can be omitted id somefunction() is a scalar function 
(my terminolgy for a function that returns in a LIST context a single 
element with the value of the function in a scalar context).



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

Date: Sun, 10 Oct 2004 06:42:14 -0400
From: "nntp" <nntp@rogers.com>
Subject: Re: What does  $base)->abs do?
Message-Id: <xY-dnRIaN9S5j_TcRVn-iQ@rogers.com>

>  > Subject: What does  $base)->abs do?
>
> Nothing - it is not a meaining full code fragment.
>
>     EXPR->abs
>
> Evaluates an expression and then attempts a method call 'abs' on the
> result.  If the result of
>
>
> > I checked the document, but its statement means nothing.
>
> The document?  Which document?  The document that is the documentation
> from the class of the object that the expression is retunring?
>
> > I also did the test, no difference at all.
> >
> >   my $base = $response->base;
> >   @output = map { $_ = url($_, $base)->abs; } @output;
> >
> >   my $base = $response->base;
> >   @output = map { $_ = $base  } @output;
> >
> > Both act the same.
>
> In that case, without knowing anything about the url() function (because
>   I don't know what module you are getting) I can make two totally
> random stabs in the dark simply by guessing at the functinality.
>
>    1) Maybe you've got the arguments of url() transposed.
>
>    2) Maybe all the elements in @output were initially empty strings.
>
> Oh and:
>
>    @foo = map { $_ = somefunction($_) } @foo;
>
> is affected and confusing.  Say instead:
>
>    $_ = somefunction($_) for @foo;
>
> or
>
>    @foo = map { scalar somefunction($_) } @foo;
>
> Of course scalar() can be omitted id somefunction() is a scalar function
> (my terminolgy for a function that returns in a LIST context a single
> element with the value of the function in a scalar context).
>

I copied the code from linkextor, it uses
  use URI::URL;




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

Date: Sun, 10 Oct 2004 12:49:41 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: What does  $base)->abs do?
Message-Id: <ckb7kn$hm2$1@slavica.ukpost.com>

nntp wrote:

[ Attribution to nobull@mail.com not included by nntp ]

>>>  @output = map { $_ = url($_, $base)->abs; } @output;
>>>
>>>  @output = map { $_ = $base  } @output;
>>>
>>>Both act the same.

>>   2) Maybe all the elements in @output were initially empty strings.

> I copied the code from linkextor, it uses
>   use URI::URL;

Well, then that seems to support option 2.



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

Date: Sun, 10 Oct 2004 12:29:00 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: While query
Message-Id: <ckb6e1$hke$1@slavica.ukpost.com>

Ben Morrow wrote:

> Hmmm.... at the risk of sounding arrogant :), yes, I would say so. Perl
> always compiles the comma operator into the same ops: those which build
> a list. As a list-in-scalar-context evaluates to its last entry, the
> two operators described in perlop will always produce the same results
> as the one perl actually uses, making this perhaps an irrelevant
> distinction;

OK I'd like to address this without digging into at the internals of how 
the Perl compiler is implemented and looking only at the observable 
behaviour of Perl programs that would behave differently under the two 
cases.

require AtExit;

sub foo {
     my $msg = shift;
     print "+$msg";
     AtExit->new(sub{ print "-$msg"});
}

my $q = (foo(1),foo(2),foo(3),foo(4));
print "|";

The "two different comma operators" model predicts '+1-1+2-2+3-3+4|-4'.

The "last element of list" model predicts '+1+2+3+4-1-2-3|-4' or 
'+1+2+3+4-3-2-1|-4'	

On Perl 5.8.4 I get '+1-1+2-2+3-3+4|-4'.



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

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


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