Created
February 17, 2011 14:10
-
-
Save sharifulin/831781 to your computer and use it in GitHub Desktop.
Format CRC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| warn $self->_format_crc(join('', 'a'..'z'), 17, '...', 4); | |
| sub _format_crc { | |
| my $self = shift; | |
| my $crc = shift; | |
| my $size = shift || 15; | |
| my $miss = shift || '...'; | |
| my $end = shift || 4; | |
| my $start = $size - $end - length $miss; | |
| $crc =~ s/^(.{$start}).*(.{$end})$/$1$miss$2/; | |
| return $crc; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment