Subject: | Net::Frame::Simple::dump() Does Not Emit Payload |
Date: | Sun, 2 Oct 2016 13:37:55 -0700 |
To: | bug-Net-Frame-Simple [...] rt.cpan.org |
From: | Bob Newgard <bobn.code [...] gmail.com> |
Not sure if this is a bug or a feature request.
I'm using Net::Frame for hardware development, both in communicating
with hardware and generating simulation test vectors. HW communication
works great, but for vectors I need access to the raw packet and dump()
fails to return a payload.
With Perl5 I can work around this using $oSimple->raw.
In this case, I'm importing Net::Frame::Simple into Perl6, and Perl6 can
only access Perl5 object methods, not attributes.
Here's what I did to get dump() to work for me (copied from the attachment):
@@ -362,11 +362,21 @@ sub print {
sub dump {
my $self = shift;
my $raw = '';
- $raw .= $_->raw for @{$self->[$__layers]};
+ my $last;
+
+ for my $l (@{$self->[$__layers]}) {
+ $raw .= $l->raw;
+ $last = $l;
+ }
+
+ if ($last && defined($last->payload)) {
+ $raw .= $last->payload;
+ }
+
$raw .= $self->[$__padding] if $self->[$__padding];
CORE::unpack('H*', $raw);
}
Distribution name and version: Net-Frame-Simple version 1.06
Perl version: 5.22.2
Operating System vendor and version: Debian "stretch", Linux host
4.6.0-1-amd64 #1 SMP Debian 4.6.4-1 (2016-07-18) x86_64 GNU/Linux
Regards,
Bob
Message body is not shown because sender requested not to inline it.