| 1 | package Net::Tshark::Packet; | ||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 1 | our $VERSION = '0.04'; | |||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | use XML::Simple; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use base 'Net::Tshark::Field'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | sub new | ||||||||||
| 11 | 0 | ▶ | { | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 12 | 0 | my ($class, $string) = @_; | |||||||||
| 13 | 0 | ▶ | return if !defined $string; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | |||||||||||
| 15 | # Parse the string as PDML (Packet Description Markup Language) | ||||||||||
| 16 | 0 | my $parsed_xml = XMLin($string, ForceArray => 1, KeyAttr => 0); | |||||||||
| 17 | |||||||||||
| 18 | # Tie a new hash to this package so we can access parts of the parsed | ||||||||||
| 19 | # PDML using hash notation (e.g. $packet->{ip}). Note that the TIEHASH | ||||||||||
| 20 | # subroutine does the actual construction of the object. | ||||||||||
| 21 | 0 | my $self = $class->SUPER::new($parsed_xml); | |||||||||
| 22 | 0 | return bless $self, $class; | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | sub received_time | ||||||||||
| 26 | 0 | ▶ | { | ||||||||
|
Subroutine
received_time: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 27 | 0 | my ($self) = @_; | |||||||||
| 28 | 0 | return $self->{frame}->{time_relative}; | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | # Avoid having to check for the defined-ness of fields by simply | ||||||||||
| 32 | # passing in an array of field names and returning undef if any | ||||||||||
| 33 | # are not defined | ||||||||||
| 34 | sub get | ||||||||||
| 35 | 0 | ▶ | { | ||||||||
|
Subroutine
get: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 36 | 0 | my ($self, @field_names) = @_; | |||||||||
| 37 | |||||||||||
| 38 | 0 | my $value = $self; | |||||||||
| 39 | 0 | foreach my $field_name (@field_names) | |||||||||
| 40 | { | ||||||||||
| 41 | 0 | $value = $value->{$field_name}; | |||||||||
| 42 | 0 | ▶ | last if !defined $value; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 0 | return $value; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 1 | 1; | |||||||||
| 49 | |||||||||||
| 50 | __END__ | ||||||||||