1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6# PODNAME: clipjoin
7use Clipboard;
8
9my $data = join '', Clipboard->paste;
10$data =~ s/\s+\|\s+//gm;
11$data =~ s/^\+//gm;
12$data =~ s/\n//gms;
13$data =~ s/\s{2,}/ /g;
14Clipboard->copy($data);
15print Clipboard->paste, "\n...is now in the Clipboard\n"
16    unless $ARGV[0] eq '-q';
17
18__END__
19
20=pod
21
22=encoding UTF-8
23
24=head1 NAME
25
26clipjoin - Remove superfluous spaces from the clipboard.
27
28=head1 VERSION
29
30version 0.28
31
32=head1 MOTIVATION
33
34Often you'll copy some stuff, like this:
35
36  <ingy> hey rking, you should use YBFOD: http://search.cpan
37    | .org/~ingy/Acme-YBFOD-0.11/
38
39Getting that URL to a browser is tedious.
40
41Another IRC example is longer quotes:
42
43  <strunk> Objective consideration of contemporary phenomena compels the
44      conclusion that success or failure in competitive activities
45      exhibits no tendency to be commensurate with enate capacity but
46      that a considerable element of the unpredictable must invariably
47      be taken into account. I returned, and saw under the sun, that the
48      race is not to the swift, nor the battle to the strong, neither
49      yet bread to the wise, nor yet riches to men of understanding, nor
50      yet favour to men of skill, but time and chance happeneth to them all.
51
52If you wanted to quote that to someone, you'd have \n's and "   "'s
53everywhere, unless you ran "clipjoin" first.
54
55An example from mutt:
56
57,-------------------------------------------.
58|  xterm                                (X) |
59+-------------------------------------------+
60| http://www.thisisalink.com/that/wrapped/ar|
61|+ound/a/line/and/its/a/pain/without/the/joi|
62|+inclip/script                             |
63`-------------------------------------------'
64
65Becomes:
66http://www.thisisalink.com/that/wrapped/around/a/line/and/its/a/pain/without/the/clipjoin/script
67
68=head1 AUTHOR
69
70Ryan King <rking@panoptic.com>
71
72=head1 COPYRIGHT
73
74Copyright (c) 2010.  Ryan King.  All rights reserved.
75
76This program is free software; you can redistribute it and/or modify it
77under the same terms as Perl itself.
78
79See L<http://www.perl.com/perl/misc/Artistic.html>
80
81=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
82
83=head1 SUPPORT
84
85=head2 Websites
86
87The following websites have more information about this module, and may be of help to you. As always,
88in addition to those websites please use your favorite search engine to discover more resources.
89
90=over 4
91
92=item *
93
94MetaCPAN
95
96A modern, open-source CPAN search engine, useful to view POD in HTML format.
97
98L<https://metacpan.org/release/Clipboard>
99
100=item *
101
102RT: CPAN's Bug Tracker
103
104The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
105
106L<https://rt.cpan.org/Public/Dist/Display.html?Name=Clipboard>
107
108=item *
109
110CPANTS
111
112The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
113
114L<http://cpants.cpanauthors.org/dist/Clipboard>
115
116=item *
117
118CPAN Testers
119
120The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
121
122L<http://www.cpantesters.org/distro/C/Clipboard>
123
124=item *
125
126CPAN Testers Matrix
127
128The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
129
130L<http://matrix.cpantesters.org/?dist=Clipboard>
131
132=item *
133
134CPAN Testers Dependencies
135
136The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
137
138L<http://deps.cpantesters.org/?module=Clipboard>
139
140=back
141
142=head2 Bugs / Feature Requests
143
144Please report any bugs or feature requests by email to C<bug-clipboard at rt.cpan.org>, or through
145the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=Clipboard>. You will be automatically notified of any
146progress on the request by the system.
147
148=head2 Source Code
149
150The code is open to the world, and available for you to hack on. Please feel free to browse it and play
151with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
152from your repository :)
153
154L<https://github.com/shlomif/Clipboard>
155
156  git clone git://github.com/shlomif/Clipboard.git
157
158=head1 AUTHOR
159
160Shlomi Fish <shlomif@cpan.org>
161
162=head1 BUGS
163
164Please report any bugs or feature requests on the bugtracker website
165L<https://github.com/shlomif/Clipboard/issues>
166
167When submitting a bug or request, please include a test-file or a
168patch to an existing test-file that illustrates the bug or desired
169feature.
170
171=head1 COPYRIGHT AND LICENSE
172
173This software is copyright (c) 2021 by Ryan King <rking@panoptic.com>.
174
175This is free software; you can redistribute it and/or modify it under
176the same terms as the Perl 5 programming language system itself.
177
178=cut
179