Which operation system should it work on? I could imagine that the approach to solving this is quite different depending on OS. (Even though I have to admit that currently I have no good idea how to solve that, except maybe patching a kernel level USB driver).
If the USB devices are mounted by udev or a similar tool, you might try to install some hooks that set up an inotify listener, which then records all reads from the USB device.
That way you wouldn't have to make sense of the USB traffic yourself, but you could use the more high-level file system and inotify interface.
I think the easiest solution is to use Net::Pcap to capture all USB traffic. At least from what I understand, Wireshark can nowadays sniff USB traffic, and I presume that this feature comes from the libpcap library which is encapsulated for Perl by Net::Pcap.