Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Perl object state survives destruction...

Expand Messages
  • Jenda Krynicky
    From: Oral Akkan ... Ye.s Both are fine. Let me reformat it for you: lives_ok( sub { $array = qpid::proton::Array- new(0,
    Message 1 of 6 , Apr 19, 2013
    • 0 Attachment
      From: Oral Akkan <oral_akkan@...>
      > I don't know really but is that ok with two semi colons?
      >
      >
      > lives_ok(sub {$array = qpid::proton::Array->new(0, qpid::proton::INT);},
      >          "Can create an array");
      >
      > # cannot push onto a nil array reference
      > dies_ok(sub {push(undef, "foo");}, "Cannot push onto a null array");

      Ye.s Both are fine. Let me reformat it for you:

      lives_ok(
      sub {
      $array = qpid::proton::Array->new(0, qpid::proton::INT);
      },
      "Can create an array"
      );

      The first semicolon is insite the curly braces of the anonymous
      subroutine passed to lives_ok() as the first parameter. It's
      equivalent to:

      {
      my $subroutine = sub {
      $array = qpid::proton::Array->new(0, qpid::proton::INT);
      };
      lives_ok(
      $subroutine,
      "Can create an array"
      );
      }

      Jenda

      ===== Jenda@... === http://Jenda.Krynicky.cz =====
      When it comes to wine, women and song, wizards are allowed
      to get drunk and croon as much as they like.
      -- Terry Pratchett in Sourcery
    • Darryl L. Pierce
      ... Should this go in each module, or only in the top-level module that users include in their code; i.e., qpid_proton.pm? ... Ah, thank you! And sorry for not
      Message 2 of 6 , May 3, 2013
      • 0 Attachment
        On Fri, Apr 19, 2013 at 02:02:53AM +0200, Jenda Krynicky wrote:
        > use strict; # !!!

        Should this go in each module, or only in the top-level module that
        users include in their code; i.e., qpid_proton.pm?

        >
        > The problem is this line:
        >
        >
        > $self->{_elements} = @elements;
        >
        > It's missing a backslash. This way the $self->{_elements} is assigned
        > the number of elemens in @elements. Which means 0.
        > Later on instead of working with an array specific to the instance of
        > your class, you are working with array named @0 !!!
        >
        > If you used strict you would be warned!

        Ah, thank you! And sorry for not responding sooner: I was pulled off of
        this for a while to work on some packaging tasks. Things are back to
        working properly now. :D

        --
        Darryl L. Pierce <mcpierce@...>
        http://mcpierce.multiply.com/
        "What do you care what people think, Mr. Feynman?"


        [Non-text portions of this message have been removed]
      Your message has been successfully submitted and would be delivered to recipients shortly.