The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

NAME

Net::Tshark::Field - Represents a field in a packet returned by Net::Tshark.

SYNOPSIS

# Start the capture process, looking for HTTP packets
my $tshark = Net::Tshark->new;
$tshark->start(interface => 2, display_filter => 'http');
# Do some stuff that would trigger HTTP packets for 30 s
...
# Get any packets captured
my @packets = $tshark->get_packets;
# Extract packet information by accessing each packet like a nested hash
foreach my $packet (@packets) {
if ($packet->{http}->{request})
{
my $host = $packet->{http}->{host};
my $method = $packet->{http}->{'http.request.method'};
print "\t - HTTP $method request to $host\n";
}
else
{
my $code = $packet->{http}->{'http.response.code'};
print "\t - HTTP response: $code\n";
}
}

DESCRIPTION

Represents a field within a packet returned by Net::Tshark->get_packet.

METHODS

$packet->fields

Returns an array of the child fields of this field.

$packet->show
$packet->showname
$packet->name
$packet->size
$packet->value
$packet->hash

Returns a hash containing the contents of this field.

SEE ALSO

Net::Tshark - Interface for the tshark network capture utility

The PDML Specification - http://www.nbee.org/doku.php?id=netpdl:pdml_specification

AUTHOR

Zachary Blair, <zblair@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2012 by Zachary Blair

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.