1Data::Binary(3)       User Contributed Perl Documentation      Data::Binary(3)
2
3
4

NAME

6       Data::Binary - Simple detection of binary versus text in strings
7

SYNOPSIS

9        use Data::Binary qw(is_text is_binary);
10        my $text = File::Slurp::read_file("test1.doc");
11        my $is_text = is_text($text); # equivalent to -T "test1.doc"
12        my $is_binary = is_binary($text); # equivalent to -B "test1.doc"
13

DESCRIPTION

15       This simple module provides string equivalents to the -T / -B
16       operators. Since these only work on file names and file handles, this
17       module provides the same functions but on strings.
18
19       Note that the actual implementation is currently different, basically
20       because the -T / -B functions are in C/XS, and this module is written
21       in pure Perl.  For now, anyway.
22

FUNCTIONS

24   is_text($string)
25       Uses the same kind of heuristics in -T, but applies them to a string.
26       Returns true if the string is basically text.
27
28   is_binary($string)
29       Uses the same kind of heuristics in -B, but applies them to a string.
30       Returns true if the string is basically binary.
31

AUTHOR

33       Stuart Watt, stuart@morungos.com
34
36       Copyright (c) 2014 Stuart Watt. All rights reserved.
37
38
39
40perl v5.30.0                      2019-07-26                   Data::Binary(3)
Impressum