I have a script which opens an interface for packet capture and listens on that interface.
Packet capture is done by Net::Pcap::loop function, which listens on the interface until it catches a packet.

I've tried defining my own subroutine which is called upon receiving SIGINT.
But the problem is that the script refuses to start that subroutine while waiting for a packet.

Is there a way to make my script accept SIGINT while waiting for a packet? That would normally happen with the default SIGINT handler. But when I try defining my own, this problem occurs.

Maybe using Net::Pcap::dispatch would help? But I don't know the actual difference between loop and dispatch.

Any help is most welcome!