| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
# PODNAME: clipaccumulate |
| 4 |
use strict; |
| 5 |
use warnings; |
| 6 |
|
| 7 |
use Clipboard; |
| 8 |
my $END_STRING = 'endEndENDenDend'; |
| 9 |
my $should_quit = 0; |
| 10 |
my $prev = Clipboard->paste; |
| 11 |
my $total = ''; |
| 12 |
warn "To exit, hit ^C, or copy this string into the clipboard: $END_STRING\n"; |
| 13 |
$SIG{INT} = sub { $should_quit = 1 }; |
| 14 |
while (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 |
} |
| 24 |
END { |
| 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 |
|
| 37 |
clipaccumulate - Make a bunch of little clipboards into one big one. |
| 38 |
|
| 39 |
=head1 VERSION |
| 40 |
|
| 41 |
version 0.32 |
| 42 |
|
| 43 |
=head1 USAGE |
| 44 |
|
| 45 |
The first thing it says (which goes to STDERR, so you can redirect into a file |
| 46 |
if you want), is how to exit, which is by copying the magic "end" string into |
| 47 |
the 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 |
|
| 50 |
The next thing it does is wait for the clipboard to change, at which point it |
| 51 |
will print out the new data and go back to waiting for the clipboard to |
| 52 |
change. |
| 53 |
|
| 54 |
Then you copy the exit string, and it will fill the clipboard with all the |
| 55 |
little pieces it saw along the way. |
| 56 |
|
| 57 |
(Right now, it just joins everything with spaces in between - is this bugging |
| 58 |
anyone?) |
| 59 |
|
| 60 |
=head1 MOTIVATION |
| 61 |
|
| 62 |
Hard to explain. I run into cases where I wanted to make a bunch of small |
| 63 |
notes that included all these different bits of info. Instead of jotting them |
| 64 |
down on a scrap of paper, I made this. |
| 65 |
|
| 66 |
Let me know how it can be made better. |
| 67 |
|
| 68 |
=head1 AUTHOR |
| 69 |
|
| 70 |
Ryan King <[email protected]> |
| 71 |
|
| 72 |
=head1 COPYRIGHT |
| 73 |
|
| 74 |
Copyright (c) 2010. Ryan King. All rights reserved. |
| 75 |
|
| 76 |
This program is free software; you can redistribute it and/or modify it |
| 77 |
under the same terms as Perl itself. |
| 78 |
|
| 79 |
See 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 |
|
| 87 |
The following websites have more information about this module, and may be of help to you. As always, |
| 88 |
in addition to those websites please use your favorite search engine to discover more resources. |
| 89 |
|
| 90 |
=over 4 |
| 91 |
|
| 92 |
=item * |
| 93 |
|
| 94 |
MetaCPAN |
| 95 |
|
| 96 |
A modern, open-source CPAN search engine, useful to view POD in HTML format. |
| 97 |
|
| 98 |
L<https://metacpan.org/release/Clipboard> |
| 99 |
|
| 100 |
=item * |
| 101 |
|
| 102 |
RT: CPAN's Bug Tracker |
| 103 |
|
| 104 |
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN. |
| 105 |
|
| 106 |
L<https://rt.cpan.org/Public/Dist/Display.html?Name=Clipboard> |
| 107 |
|
| 108 |
=item * |
| 109 |
|
| 110 |
CPANTS |
| 111 |
|
| 112 |
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution. |
| 113 |
|
| 114 |
L<http://cpants.cpanauthors.org/dist/Clipboard> |
| 115 |
|
| 116 |
=item * |
| 117 |
|
| 118 |
CPAN Testers |
| 119 |
|
| 120 |
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions. |
| 121 |
|
| 122 |
L<http://www.cpantesters.org/distro/C/Clipboard> |
| 123 |
|
| 124 |
=item * |
| 125 |
|
| 126 |
CPAN Testers Matrix |
| 127 |
|
| 128 |
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms. |
| 129 |
|
| 130 |
L<http://matrix.cpantesters.org/?dist=Clipboard> |
| 131 |
|
| 132 |
=item * |
| 133 |
|
| 134 |
CPAN Testers Dependencies |
| 135 |
|
| 136 |
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution. |
| 137 |
|
| 138 |
L<http://deps.cpantesters.org/?module=Clipboard> |
| 139 |
|
| 140 |
=back |
| 141 |
|
| 142 |
=head2 Bugs / Feature Requests |
| 143 |
|
| 144 |
Please report any bugs or feature requests by email to C<bug-clipboard at rt.cpan.org>, or through |
| 145 |
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=Clipboard>. You will be automatically notified of any |
| 146 |
progress on the request by the system. |
| 147 |
|
| 148 |
=head2 Source Code |
| 149 |
|
| 150 |
The code is open to the world, and available for you to hack on. Please feel free to browse it and play |
| 151 |
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull |
| 152 |
from your repository :) |
| 153 |
|
| 154 |
L<https://github.com/shlomif/Clipboard> |
| 155 |
|
| 156 |
git clone git://github.com/shlomif/Clipboard.git |
| 157 |
|
| 158 |
=head1 AUTHOR |
| 159 |
|
| 160 |
Shlomi Fish <[email protected]> |
| 161 |
|
| 162 |
=head1 BUGS |
| 163 |
|
| 164 |
Please report any bugs or feature requests on the bugtracker website |
| 165 |
L<https://github.com/shlomif/Clipboard/issues> |
| 166 |
|
| 167 |
When submitting a bug or request, please include a test-file or a |
| 168 |
patch to an existing test-file that illustrates the bug or desired |
| 169 |
feature. |
| 170 |
|
| 171 |
=head1 COPYRIGHT AND LICENSE |
| 172 |
|
| 173 |
This software is copyright (c) 2025 by Ryan King <[email protected]>. |
| 174 |
|
| 175 |
This is free software; you can redistribute it and/or modify it under |
| 176 |
the same terms as the Perl 5 programming language system itself. |
| 177 |
|
| 178 |
=cut |