1#!/usr/bin/perl
2
3# PODNAME: clipaccumulate
4use strict;
5use warnings;
6
7use Clipboard;
8my $END_STRING = 'endEndENDenDend';
9my $should_quit = 0;
10my $prev = Clipboard->paste;
11my $total = '';
12warn "To exit, hit ^C, or copy this string into the clipboard: $END_STRING\n";
13$SIG{INT} = sub { $should_quit = 1 };
14while (1) {
15    my $cur = Clipboard->paste;
16    $should_quit = 1 if $cur eq $END_STRING;
17    last if $should_quit;
18    if ($prev ne $cur) {
19        print $cur, ' ';
20        $total .= $cur . ' ';
21    }
22    $prev = $cur;
23}
24END {
25    Clipboard->copy($total);
26    print "\nClipboard accumulated.\n";
27}
28
29__END__
30
31=pod
32
33=encoding UTF-8
34
35=head1 NAME
36
37clipaccumulate - Make a bunch of little clipboards into one big one.
38
39=head1 VERSION
40
41version 0.28
42
43=head1 USAGE
44
45The first thing it says (which goes to STDERR, so you can redirect into a file
46if you want), is how to exit, which is by copying the magic "end" string into
47the clipboard.  Crufty?  Yep.  You can still do Ctrl+C if you don't like this
48(or if the string scrolls off the top of the screen).
49
50The next thing it does is wait for the clipboard to change, at which point it
51will print out the new data and go back to waiting for the clipboard to
52change.
53
54Then you copy the exit string, and it will fill the clipboard with all the
55little pieces it saw along the way.
56
57(Right now, it just joins everything with spaces in between - is this bugging
58anyone?)
59
60=head1 MOTIVATION
61
62Hard to explain.  I run into cases where I wanted to make a bunch of small
63notes that included all these different bits of info.  Instead of jotting them
64down on a scrap of paper, I made this.
65
66Let me know how it can be made better.
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