Data::Binary(3pm)
π Data::Binary π
okay bestie, so Data::Binary is a lil Perl module (from the User Contributed Perl Documentation crew, iykyk) that does exactly one iconic thing: it tells you whether a string is text or binary. that's it. that's the whole vibe. periodt. π
β¨ NAME β¨
Data::Binary β Simple detection of binary versus text in strings π¦
πΈ SYNOPSIS πΈ
use Data::Binary qw(is_text is_binary);
my $text = File::Slurp::read_file("test1.doc");
my $is_text = is_text($text); # equivalent to -T "test1.doc"
my $is_binary = is_binary($text); # equivalent to -B "test1.doc"
like yes bestie, you literally use it, you pull in is_text and is_binary, you slurp a file with File::Slurp::read_file, and you vibe-check that string. no cap. π₯
π DESCRIPTION π
so here's the tea β β this simple module gives you string equivalents to the -T / -B operators. the way that -T and -B only work on file names and file handles? rude. so this module provides the same functions, but for strings instead. obsessed. π«Ά
ngl, heads up bestie: the actual implementation is currently different, basically because the-T/-Bfunctions are in C/XS, and this module is written in pure Perl. for now, anyway. π
π FUNCTIONS π
π is_text($string)
uses the same kind of heuristics as -T, but applies them to a string. returns true if the string is basically text. slay. β¨
π§ is_binary($string)
uses the same kind of heuristics as -B, but applies them to a string. returns true if the string is basically binary. iconic. π
π AUTHOR π
Stuart Watt, stuart@morungos.com β king behavior honestly π
π COPYRIGHT π
Copyright (c) 2014 Stuart Watt. All rights reserved. π
and that's the whole page bestie, no crumbs left π β this was Data::Binary(3pm), rocking with perl v5.36.0, dated 2022-12-04. go forth and detect those binaries, main character ππΈ
π¦ where this page comes from
- debian bookworm: libdata-binary-perl 0.01-2 Β· Artistic-2.0
- debian trixie: libdata-binary-perl 0.01-2 Β· Artistic-2.0
- ubuntu noble: libdata-binary-perl 0.01-2 Β· Artistic-2.0
- ubuntu resolute: libdata-binary-perl 0.01-2 Β· Artistic-2.0
- ubuntu stonking: libdata-binary-perl 0.01-2 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms