[31738] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3001 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 23 16:09:30 2010

Date: Wed, 23 Jun 2010 13:09:12 -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           Wed, 23 Jun 2010     Volume: 11 Number: 3001

Today's topics:
        Checking Perl 5.8.0 programs. <RedGrittyBrick@spamweary.invalid>
    Re: Checking Perl 5.8.0 programs. <RedGrittyBrick@spamweary.invalid>
        export symbols <jak@isp2dial.com>
    Re: export symbols <tadmc@seesig.invalid>
    Re: export symbols <peter@makholm.net>
    Re: export symbols <jak@isp2dial.com>
        FYI: perlbench 5.8.8-5.12.1 <groundXaero-gmail@no.poop.hehe>
    Re: UNIX datagram sockets <jak@isp2dial.com>
    Re: UNIX datagram sockets <uri@StemSystems.com>
    Re: UNIX datagram sockets <jak@isp2dial.com>
    Re: UNIX datagram sockets <uri@StemSystems.com>
    Re: UNIX datagram sockets <jak@isp2dial.com>
    Re: UNIX datagram sockets <rvtol+usenet@xs4all.nl>
    Re: UNIX datagram sockets <uri@StemSystems.com>
    Re: UNIX datagram sockets <uri@StemSystems.com>
    Re: UNIX datagram sockets <jak@isp2dial.com>
    Re: UNIX datagram sockets <uri@StemSystems.com>
    Re: UNIX datagram sockets <jak@isp2dial.com>
    Re: UNIX datagram sockets <jak@isp2dial.com>
        who stole my returned list? <marc.girod@gmail.com>
    Re: who stole my returned list? <marc.girod@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 23 Jun 2010 14:35:40 +0100
From: RedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Subject: Checking Perl 5.8.0 programs.
Message-Id: <4c220dab$0$2537$da0feed9@news.zen.co.uk>


 > cat y.pl
#!/usr/bin/perl
use strict;
use warnings;
foo();

 >./y.pl
Undefined subroutine &main::foo called at ./y.pl line 4.

 >perl -MO=Lint y.pl
y.pl syntax OK


What's a better way to check whether a program has undefined subroutines?

-- 
RGB


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

Date: Wed, 23 Jun 2010 14:48:27 +0100
From: RedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Subject: Re: Checking Perl 5.8.0 programs.
Message-Id: <4c2210aa$0$2524$da0feed9@news.zen.co.uk>

On 23/06/2010 14:35, RedGrittyBrick wrote:
>
>  > cat y.pl
> #!/usr/bin/perl
> use strict;
> use warnings;
> foo();
>
>  >./y.pl
> Undefined subroutine &main::foo called at ./y.pl line 4.
>
>  >perl -MO=Lint y.pl
> y.pl syntax OK
>
>
> What's a better way to check whether a program has undefined subroutines?
>


 >perl -MO=Lint,all y.pl
Undefined subroutine foo called at y.pl line 4
y.pl syntax OK


I should read documentation with more care :-(

-- 
RGB


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

Date: Wed, 23 Jun 2010 12:28:29 +0000
From: John Kelly <jak@isp2dial.com>
Subject: export symbols
Message-Id: <dfu326ps71vk9esdcdrir1c4r338dgt2q1@4ax.com>


> use YourModule; 
> This imports all the symbols from YourModule's @EXPORT
> into the namespace of the use statement.

> use YourModule (); 
> This causes perl to load your module but does not import any symbols.

Specifying () every time seems safe, but a hassle.  Without reading the
source, can I get a list of default export symbols for a module?




-- 
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php
 


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

Date: Wed, 23 Jun 2010 07:57:53 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: export symbols
Message-Id: <slrni240ta.cqr.tadmc@tadbox.sbcglobal.net>

John Kelly <jak@isp2dial.com> wrote:
>
>> use YourModule; 
>> This imports all the symbols from YourModule's @EXPORT
>> into the namespace of the use statement.
>
>> use YourModule (); 
>> This causes perl to load your module but does not import any symbols.
>
> Specifying () every time seems safe, but a hassle.  


In _my_ cost/benefit analysis, typing 2 characters in return
for safety wins...


> Without reading the
> source, can I get a list of default export symbols for a module?


Errr, yes, by printing out the contents of the array mentioned
in the docs you quoted:

    perl -MCarp -le 'print for @Carp::EXPORT'


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.


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

Date: Wed, 23 Jun 2010 15:43:56 +0200
From: Peter Makholm <peter@makholm.net>
Subject: Re: export symbols
Message-Id: <871vbxsw2r.fsf@vps1.hacking.dk>

John Kelly <jak@isp2dial.com> writes:

>> use YourModule (); 
>> This causes perl to load your module but does not import any symbols.
>
> Specifying () every time seems safe, but a hassle.  Without reading the
> source, can I get a list of default export symbols for a module?

Some modules (ab)uses the import() methods for other things than
polluting your symbol table. These modules might work differently.

This is partly documented in 'perldoc -f use':

     If you do not want to call the package's "import" method (for
     instance, to stop your namespace from being altered),
     explicitly supply the empty list:

         use Module ();

     That is exactly equivalent to

         BEGIN { require Module }

     If the VERSION argument is present between Module and LIST,
     then the "use" will call the VERSION method in class Module
     with the given version as an argument.  The default VERSION
     method, inherited from the UNIVERSAL class, croaks if the given
     version is larger than the value of the variable $Module::VERSION.

     Again, there is a distinction between omitting LIST ("import"
     called with no arguments) and an explicit empty LIST "()"
     ("import" not called).  Note that there is no comma after
     VERSION!

//Makholm 


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

Date: Wed, 23 Jun 2010 14:02:23 +0000
From: John Kelly <jak@isp2dial.com>
Subject: Re: export symbols
Message-Id: <ij4426p64o4u1cegati1ehak98puds90qe@4ax.com>

On Wed, 23 Jun 2010 07:57:53 -0500, Tad McClellan <tadmc@seesig.invalid>
wrote:

>>> use YourModule (); 
>>> This causes perl to load your module but does not import any symbols.

>> Specifying () every time seems safe, but a hassle.  

>In _my_ cost/benefit analysis, typing 2 characters in return
>for safety wins...

I meant it's a hassle to package qualify every symbol I want to use.  I
like writing terse code with short names.  So if a package doesn't step
on my names, I may want its symbols in main.

It would be nice if there was a warning when package symbols step on
symbols already in main.


> perl -MCarp -le 'print for @Carp::EXPORT'

I'll try that.  Thanks for the tip.



-- 
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php
 


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

Date: Wed, 23 Jun 2010 20:53:46 +0530
From: Xaero <groundXaero-gmail@no.poop.hehe>
Subject: FYI: perlbench 5.8.8-5.12.1
Message-Id: <20100623205346.6bf5025d.groundXaero-gmail@no.poop.hehe>

Hi everyone,

Thought it would be good to compare perl performace over the years and on request BinGOs and run and hosted the results of the benchmark test here:

http://cpanidx.org/perlbench/

P.S: Higer numbers are better. 200 is twice as fast as 100.

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---


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

Date: Wed, 23 Jun 2010 11:16:30 +0000
From: John Kelly <jak@isp2dial.com>
Subject: Re: UNIX datagram sockets
Message-Id: <f0r326h802t89sto6lmqjpnbrkcnpochgd@4ax.com>

On Wed, 23 Jun 2010 01:50:46 -0400, "Uri Guttman" <uri@StemSystems.com>
wrote:

>  JK> Do you expect all posts to ask for help?  Why?
>
>because they usually do. nothing you posted was signifigant as it was
>basic udp code that you can get from modules, books, documentation,
>etc. it wasn't particularly interesting

I didn't realize you are the only person who ever reads this ng.  How
rude of me to invade your territory!  :-D


-- 
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php
 


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

Date: Wed, 23 Jun 2010 13:04:03 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: UNIX datagram sockets
Message-Id: <87ocf13cl8.fsf@quad.sysarch.com>

>>>>> "JK" == John Kelly <jak@isp2dial.com> writes:

  JK> On Wed, 23 Jun 2010 01:50:46 -0400, "Uri Guttman" <uri@StemSystems.com>
  JK> wrote:

  JK> Do you expect all posts to ask for help?  Why?
  >> 
  >> because they usually do. nothing you posted was signifigant as it was
  >> basic udp code that you can get from modules, books, documentation,
  >> etc. it wasn't particularly interesting

  JK> I didn't realize you are the only person who ever reads this ng.  How
  JK> rude of me to invade your territory!  :-D

not rude at all. but an odd posting in any case. seriously, what was
your point? education? illumination?

uri 

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Wed, 23 Jun 2010 18:08:33 +0000
From: John Kelly <jak@isp2dial.com>
Subject: Re: UNIX datagram sockets
Message-Id: <j1i426ldnsv8qs71e14nligbpoe7hi8j11@4ax.com>

On Wed, 23 Jun 2010 13:04:03 -0400, "Uri Guttman" <uri@StemSystems.com>
wrote:

> because they usually do. nothing you posted was signifigant as it was
> basic udp code that you can get from modules, books, documentation,
> etc. it wasn't particularly interesting

>not rude at all. but an odd posting in any case. seriously, what was
>your point? education? illumination?

It's easy to find INET socket example code, but harder to find UNIX
socket example code.  Some of the few I found didn't work at all, and
Stein's example didn't explain the relationship between the Local and
Peer arguments when using SOCK_DGRAM.

Also, his example used sockaddr_un to get the server address, which is
not necessary if you're only talking to a single server.  It's clearer
to simply specify Peer on the call to IO::Socket::UNIX.

But without prior experience on that particular problem, I didn't know
that.  I had to learn by reading, trial and error, and I spent much more
time on it than I wanted to.

Not everyone has time to become a sockets or Perl expert, and finding an
easy recipe saves time.  So I posted mine.

Once upon a time, Usenet users were friendly and generous.  Maybe those
days are gone now, but I remember when ...


-- 
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php
 


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

Date: Wed, 23 Jun 2010 14:15:14 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: UNIX datagram sockets
Message-Id: <87wrtpzkct.fsf@quad.sysarch.com>

>>>>> "JK" == John Kelly <jak@isp2dial.com> writes:

  >> not rude at all. but an odd posting in any case. seriously, what was
  >> your point? education? illumination?

  JK> It's easy to find INET socket example code, but harder to find UNIX
  JK> socket example code.  Some of the few I found didn't work at all, and
  JK> Stein's example didn't explain the relationship between the Local and
  JK> Peer arguments when using SOCK_DGRAM.

you can also use sendto and not need a peer argument. 

  JK> But without prior experience on that particular problem, I didn't know
  JK> that.  I had to learn by reading, trial and error, and I spent much more
  JK> time on it than I wanted to.

  JK> Not everyone has time to become a sockets or Perl expert, and finding an
  JK> easy recipe saves time.  So I posted mine.

then you should say that. it wasn't clear what the purpose of your post
was. 

  JK> Once upon a time, Usenet users were friendly and generous.  Maybe those
  JK> days are gone now, but I remember when ...

and you are helping how with your comments? i just asked a question
which took you 3 replies to answer, why did you post this. instead you
flamed me until you actually answered it. i never attacked you, just
asked you why you posted it. simple. 

uri 

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Wed, 23 Jun 2010 18:31:26 +0000
From: John Kelly <jak@isp2dial.com>
Subject: Re: UNIX datagram sockets
Message-Id: <s9k426tfbjska5ajk4nvkhft47d7cq7snn@4ax.com>

On Wed, 23 Jun 2010 14:15:14 -0400, "Uri Guttman" <uri@StemSystems.com>
wrote:

>  JK> Once upon a time, Usenet users were friendly and generous.  Maybe those
>  JK> days are gone now, but I remember when ...
>
>and you are helping how with your comments? i just asked a question
>which took you 3 replies to answer, why did you post this. instead you
>flamed me until you actually answered it. i never attacked you,

Yes you did, you said my recipe was not interesting, implying my post
was worthless to anyone who might read it.

Some ngs are dominated by territorial control freaks who get upset when
someone unknown comes along and posts without bowing and scraping before
the self appointed elite.

But the way I see it, that's their problem, not mine.


-- 
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php
 


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

Date: Wed, 23 Jun 2010 20:34:18 +0200
From: "Dr.Ruud" <rvtol+usenet@xs4all.nl>
Subject: Re: UNIX datagram sockets
Message-Id: <4c2253aa$0$22943$e4fe514c@news.xs4all.nl>

John Kelly wrote:

> Please ignore bad practices in this code

And that made me stop reading. Next!

-- 
Ruud


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

Date: Wed, 23 Jun 2010 14:38:50 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: UNIX datagram sockets
Message-Id: <87aaqlzj9h.fsf@quad.sysarch.com>

>>>>> "JK" == John Kelly <jak@isp2dial.com> writes:

  JK> On Wed, 23 Jun 2010 14:15:14 -0400, "Uri Guttman" <uri@StemSystems.com>
  JK> wrote:

  JK> Once upon a time, Usenet users were friendly and generous.  Maybe those
  JK> days are gone now, but I remember when ...
  >> 
  >> and you are helping how with your comments? i just asked a question
  >> which took you 3 replies to answer, why did you post this. instead you
  >> flamed me until you actually answered it. i never attacked you,

  JK> Yes you did, you said my recipe was not interesting, implying my post
  JK> was worthless to anyone who might read it.

it wasn't interesting to me as it had NO CONTEXT. just code with no
reason for posting. if you said, i had issues with writing this and here
is why i did this, it might have been interesting. but you just posted
some simple socket code with no explanation of why it might be
interesting.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Wed, 23 Jun 2010 14:39:15 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: UNIX datagram sockets
Message-Id: <876319zj8s.fsf@quad.sysarch.com>

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

  R> John Kelly wrote:
  >> Please ignore bad practices in this code

  R> And that made me stop reading. Next!

another reason it wasn't interesting to me.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Wed, 23 Jun 2010 18:44:42 +0000
From: John Kelly <jak@isp2dial.com>
Subject: Re: UNIX datagram sockets
Message-Id: <0bl4261dojlcvie9m2qchj748h3r6c7d3m@4ax.com>

On Wed, 23 Jun 2010 14:38:50 -0400, "Uri Guttman" <uri@StemSystems.com>
wrote:

>  >> flamed me until you actually answered it. i never attacked you,
>
>  JK> Yes you did, you said my recipe was not interesting, implying my post
>  JK> was worthless to anyone who might read it.
>
>it wasn't interesting to me as it had NO CONTEXT

Then you could have just ignored it.  But you decided to pick a fight
instead.  Happy now?


-- 
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php
 


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

Date: Wed, 23 Jun 2010 14:56:07 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: UNIX datagram sockets
Message-Id: <87k4ppy3w8.fsf@quad.sysarch.com>

>>>>> "JK" == John Kelly <jak@isp2dial.com> writes:

  JK> On Wed, 23 Jun 2010 14:38:50 -0400, "Uri Guttman" <uri@StemSystems.com>
  JK> wrote:

  >> >> flamed me until you actually answered it. i never attacked you,
  >> 
  JK> Yes you did, you said my recipe was not interesting, implying my post
  JK> was worthless to anyone who might read it.
  >> 
  >> it wasn't interesting to me as it had NO CONTEXT

  JK> Then you could have just ignored it.  But you decided to pick a fight
  JK> instead.  Happy now?

me thinks you picked the fight. i just asked a question. you are the
prickly skinned one here. i still haven't attacked you and you are
attacking me. look in the mirror if you can. show me one line where i
said anything about you. i just wanted to know why you posted it. but
you don't seem to get that yet. over and out.

uri 

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Wed, 23 Jun 2010 19:09:14 +0000
From: John Kelly <jak@isp2dial.com>
Subject: Re: UNIX datagram sockets
Message-Id: <6fm426pqfrcpndjr7c23ahlgpsn4ckfme8@4ax.com>

On Wed, 23 Jun 2010 14:56:07 -0400, "Uri Guttman" <uri@StemSystems.com>
wrote:

>me thinks you picked the fight. i just asked a question. you are the
>prickly skinned one here. i still haven't attacked you and you are
>attacking me. look in the mirror if you can. show me one line where i
>said anything about you. i just wanted to know why you posted it. but
>you don't seem to get that yet. over and out.

I explained why I posted it, but you didn't like that explanation, and
you continued arguing.  If you want to act like a troll, then so be it.


-- 
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php
 


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

Date: Wed, 23 Jun 2010 19:28:55 +0000
From: John Kelly <jak@isp2dial.com>
Subject: Re: UNIX datagram sockets
Message-Id: <gun4269elce0ebm9b7jml8hkq42e1e15cv@4ax.com>

On Wed, 23 Jun 2010 20:34:18 +0200, "Dr.Ruud" <rvtol+usenet@xs4all.nl>
wrote:

>John Kelly wrote:
>
>> Please ignore bad practices in this code
>
>And that made me stop reading. Next!

They say that with Perl, there's more than one way to do it.  But I say
that with Perl, there's more than one way to shoot yourself in the foot.


-- 
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php
 


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

Date: Wed, 23 Jun 2010 05:58:51 -0700 (PDT)
From: Marc Girod <marc.girod@gmail.com>
Subject: who stole my returned list?
Message-Id: <19dd5237-1843-4403-9203-47379258abee@d8g2000yqf.googlegroups.com>

Hello,

Debugging session:

main::(blib/script/synctree:319):	exit $rc unless $sync->get_addhash
|| $sync->get_modhash
main::(blib/script/synctree:320):			                   || $sync-
>get_sublist || $sync->_lsco;
  DB<2> x $sync->_lsco
0  '/view/emagiro_t7/vobs/atcctest/foo/d'
  DB<3> f SyncTree.pm
 ...
  DB<4> b 224
  DB<5> c
ClearCase::SyncTree::_lsco(/vobs/atcctest/ClearCase-SyncTree/blib/lib/
ClearCase/SyncTree.pm:224):
224:	    return sort keys %co;
  DB<5> x %co
0  '/view/emagiro_t7/vobs/atcctest/foo/d'
1  1
  DB<6> r
scalar context return from ClearCase::SyncTree::_lsco: undef
ClearCase::Argv::DESTROY(/home/emagiro/perl/lib/ClearCase/Argv.pm:
852):
852:	    my $self = shift;

I am under the debugger, there is a list value being returned, I press
'r', and the next line is:

scalar context return ...: undef !!!?

In between there was one object being destroyed:

sub DESTROY {
    my $self = shift;
    my $ret = $?;
    $self->ipc(0) if $self->ipc;
    $? |= $ret;
}

 ...but how could it affect the return value of the function?

I failed to reproduce the problem in a narrow snippet:

#!/vobs/cello/cade_struct/bin/perl -w

use strict;

{
  package DBG;
  sub new {
    my $class = shift;
    my $self = {};
    bless $self, $class;
    return $self;
  }
  sub crap {
    return qw(1 2 3);
  }
  sub DESTROY {
    my $self = shift;
    my $ret = $?;
    system('/bin/date');
    $? |= $ret;
  }

  1;
}
sub fun {
  my $thing = DBG->new;
  return $thing->crap;
}
print "Fun ", join(' ', fun), "\n";
exit 0 unless fun;
print "End\n";


This does print 'End'...
I am sure I took my brains when I left home this morning...
Marc


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

Date: Wed, 23 Jun 2010 06:19:50 -0700 (PDT)
From: Marc Girod <marc.girod@gmail.com>
Subject: Re: who stole my returned list?
Message-Id: <fa8da695-b39d-47ed-b756-4d1a952089a8@5g2000yqz.googlegroups.com>

On Jun 23, 1:58=A0pm, Marc Girod <marc.gi...@gmail.com> wrote:

> I failed to reproduce the problem in a narrow snippet:

I narrowed one step more, calling the original DESTROY:

use strict;
use ClearCase::Argv;

sub fun {
  my $thing =3D ClearCase::Argv->new;
  return qw(1 2 3);
}
print "Fun ", join(' ', fun), "\n";
exit 0 unless fun;
print "End\n";

But, this doesn't make it fail.
Now, what could I *add* to this if I wanted to reproduce the previous
behaviour?

Thanks,
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 3001
***************************************


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