1Text::Quoted(3)       User Contributed Perl Documentation      Text::Quoted(3)
2
3
4

NAME

6       Text::Quoted - Extract the structure of a quoted mail message
7

SYNOPSIS

9           use Text::Quoted;
10           my $structure = extract($text);
11
12           # Optionally, customize recognized quote characters:
13           Text::Quoted::set_quote_characters( qr/[:]/ );
14

DESCRIPTION

16       "Text::Quoted" examines the structure of some text which may contain
17       multiple different levels of quoting, and turns the text into a nested
18       data structure.
19
20       The structure is an array reference containing hash references for each
21       paragraph belonging to the same author. Each level of quoting
22       recursively adds another list reference. So for instance, this:
23
24           > foo
25           > # Bar
26           > baz
27
28           quux
29
30       turns into:
31
32           [
33             [
34               { text => 'foo', quoter => '>', raw => '> foo' },
35               [
36                   { text => 'Bar', quoter => '> #', raw => '> # Bar' }
37               ],
38               { text => 'baz', quoter => '>', raw => '> baz' }
39             ],
40
41             { empty => 1 },
42             { text => 'quux', quoter => '', raw => 'quux' }
43           ];
44
45       This also tells you about what's in the hash references: "raw" is the
46       paragraph of text as it appeared in the original input; "text" is what
47       it looked like when we stripped off the quotation characters, and
48       "quoter" is the quotation string.
49

FUNCTIONS

51   extract
52         my $struct = extract($text, \%arg);
53
54       Takes a single string argument which is the text to extract quote
55       structure from.  Returns a nested datastructure as described above.
56
57       Second argument is optional: a hashref of options.  The only valid
58       argument at present is:
59
60         no_separators - never mark paragraphs as "separators"
61
62       Exported by default.
63
64   set_quote_characters
65       Takes a regex ("qr//") matching characters that should indicate a
66       quoted line.  By default, a very liberal set is used:
67
68           set_quote_characters(qr/[!#%=|:]/);
69
70       The character ">" is always recognized as a quoting character.
71
72       If "undef" is provided instead of a regex, only ">" will remain as a
73       quote character.
74
75       Not exported by default, but exportable.
76
77   combine_hunks
78         my $text = combine_hunks( $arrayref_of_hunks );
79
80       Takes the output of "extract" and turns it back into text.
81
82       Not exported by default, but exportable.
83

CREDITS

85       Most of the heavy lifting is done by a modified version of Damian
86       Conway's "Text::Autoformat".
87

AUTHOR

89       Best Practical Solutions, LLC <modules@bestpractical.com>
90
92       This software is Copyright (c) 2004-2015 by Best Practical Solutions,
93       LLC
94
95       This library is free software; you can redistribute it and/or modify it
96       under the same terms as Perl itself.
97
98
99
100perl v5.28.1                      2018-07-26                   Text::Quoted(3)
Impressum