[Nottingham] Perl - NetPacket modules

Duncan John Fyfe djf at star.le.ac.uk
Thu Dec 28 18:53:38 GMT 2006


On Thu, 2006-12-28 at 12:31 +0000, Graeme Fowler wrote:
> On Thu, 2006-12-28 at 11:46 +0000, Michael Erskine (at home!) wrote:
> > OK, how are you calling the encode method? From the docs on cpan 

>     $retpack = NetPacket::IP->encode($ip)

The docs say NetPacket::IP->encode() [a class method]
while the source says $obj->encode() [an object method]. 

sub encode { 

    my $self = shift;
    .
    .
    .
    $self->{len} = ($self->{hlen} * 4) + length($self->{data});
    .
    .
    .
}

ie. $self must be a hashref or blessed hashref not a string.

My first guess would be the required object is your decoded packet.
Try $ip->encode();

Have fun,
Duncan
-- 
Duncan John Fyfe <djf at star.le.ac.uk>




More information about the Nottingham mailing list