develooper Front page | perl.perl5.porters | Postings from February 2003

[perl #21289] [Fwd: IPC::Msg bug report]

Thread Next
From:
Edmund Bacon
Date:
February 18, 2003 13:27
Subject:
[perl #21289] [Fwd: IPC::Msg bug report]
Message ID:
rt-21289-52384.13.2700974026643@bugs6.perl.org
# New Ticket Created by  Edmund Bacon 
# Please include the string:  [perl #21289]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=21289 >


Jarkko,

I sent this bug report to Graham, as he appears in the Copyright line 
IPC::Msg.pm.  CPAN lists IPC::Msg under your name, so perhaps you are 
now the maintainer?


-------- Original Message --------
Subject: IPC::Msg bug report
Date: Thu, 13 Feb 2003 10:16:00 -0700
From: Edmund Bacon <ebacon@onesystem.com>
To: Graham Barr <gbarr@pobox.com>

Graham:

The following program fails:

=======================================
use IPC::SysV qw(IPC_PRIVATE S_IRWXU);
use IPC::Msg;

my $msg = new IPC::Msg(IPC_PRIVATE, S_IRWXU);
$msg->set(qbytes => 1024);
print "qbytes = ", $msg->stat->qbytes, "\n";

$msg->remove;

======================================


The error message is:

Can't call method "pack" on an undefined value at
/usr/lib/perl5/5.6.0/i386-linux/IPC/Msg.pm line 78


I think the problem is shown below: re-declaring $ds 'my'
inside the else loop shadows the $ds in the enclosing context.  My
guess is that nobody has tried to do this for many years.  I only
stumbled on it because I was curious how big I could make qbytes.

from Msg.pm
========================================
sub set {
      my $self = shift;
      my $ds;

      if(@_ == 1) {
          $ds = shift;
      }
      else {
          croak 'Bad arg count' if @_ % 2;
          my %arg = @_;
          my $ds = $self->stat  ### <--- Should not be 'my'?
                  or return undef;
          my($key,$val);
          $ds->$key($val)
              while(($key,$val) = each %arg);
      }

      msgctl($$self,IPC_SET,$ds->pack);
}

============================================

-- 
Edmund


-- 
Edmund


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About