#!/usr/bin/perl # Sort a transcript of sprocket http traffic, putting each response directly # after the associated request. # Copyright 2002-2007 Patrick Killelea under the GPL. # You may freely copy and redistribute this file. # Version: Tue Mar 11 10:29:14 PDT 2008 # Please write p@patrick.net with improvements. use bytes; # Read whole file in single gulp. undef $/; $_ = <>; @units = split(/(.*>>>>>>>>.*\n|.*<<<<<<<<.*\n)/); # shift to ignore everything before 1st request marker. shift @units; # Tack delimiter back on to unit for sorting. for ($i = 0; $units[$i]; $i += 2) { push @tmp, $units[$i] . $units[$i+1]; } @requests = grep />>>>>>>>/, @tmp; @responses = grep /<<<<<<<