Debian Codegraph @

scripts/clipbrowse

raw ◀ ▶
1 Debian patch touch this file
1 #!/usr/bin/perl
2
3 # PODNAME: clipbrowse
4 use strict;
5 use warnings;
6 use Clipboard;
•7 my $browser = $ENV{BROWSER} || 'sensible-browser "%s"';
8 $browser .= ' "%s"' unless $browser =~ /%s/;
9 my $query = Clipboard->paste;
10 $query =~ s/['"]/\\$&/;
11 system(sprintf $browser, $query);
12
13 __END__
14
15 =pod
16
17 =encoding UTF-8
18
19 =head1 NAME
20
21 clipbrowse - Load a URL from the clipboard into your browser.
22
23 =head1 VERSION
24
25 version 0.32
26
27 =head1 USAGE
28
29 # ...copy something
30 # (You might want to do a `clipjoin` if the URL text is messy)
31 $ clipbrowse
32
33 Remember that many browsers will usefully load things that don't look like
34 URL's. For example Firefox does a Google "I'm feeling lucky" with non-URLs.
35 This means you can have any text in your clipboard and `clipbrowse`.
36
37 =head1 MOTIVATION
38
39 It saves a couple of seconds every time you run it. Chrome and Firefox, for
40 examples, automatically create a new tab and loads the page when you invoke it
41 from the command line. Already we've saved a Ctrl+T and a Shift+Insert. When
42 you consider the parallelizing (that your browser will be actively loading the
43 page while you're Alt+Tabbing to it), you've squeaked out a little more.
44
45 Maybe I'm just a freak, but I like shaving out wasted time like that.
46
47 =head1 CONFIGURATION
48
49 The environment variable C<$BROWSER> will override the default launching
50 command. If you have a %s in the line, it will be replaced with the url. if
51 not, the url will be appended at the end.
52
53 The default is `chromium-browser "%s"` (Debian's Google Chrome)
54 If you still use Firefox, consider: `firefox -remote "openURL(%s,new-tab)"'`.
55
56 =head1 AUTHOR
57
58 Ryan King <[email protected]>
59 =head1 COPYRIGHT
60
61 Copyright (c) 2010. Ryan King. All rights reserved.
62
63 This program is free software; you can redistribute it and/or modify it
64 under the same terms as Perl itself.
65
66 See L<http://www.perl.com/perl/misc/Artistic.html>
67
68 =for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
69
70 =head1 SUPPORT
71
72 =head2 Websites
73
74 The following websites have more information about this module, and may be of help to you. As always,
75 in addition to those websites please use your favorite search engine to discover more resources.
76
77 =over 4
78
79 =item *
80
81 MetaCPAN
82
83 A modern, open-source CPAN search engine, useful to view POD in HTML format.
84
85 L<https://metacpan.org/release/Clipboard>
86
87 =item *
88
89 RT: CPAN's Bug Tracker
90
91 The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
92
93 L<https://rt.cpan.org/Public/Dist/Display.html?Name=Clipboard>
94
95 =item *
96
97 CPANTS
98
99 The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
100
101 L<http://cpants.cpanauthors.org/dist/Clipboard>
102
103 =item *
104
105 CPAN Testers
106
107 The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
108
109 L<http://www.cpantesters.org/distro/C/Clipboard>
110
111 =item *
112
113 CPAN Testers Matrix
114
115 The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
116
117 L<http://matrix.cpantesters.org/?dist=Clipboard>
118
119 =item *
120
121 CPAN Testers Dependencies
122
123 The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
124
125 L<http://deps.cpantesters.org/?module=Clipboard>
126
127 =back
128
129 =head2 Bugs / Feature Requests
130
131 Please report any bugs or feature requests by email to C<bug-clipboard at rt.cpan.org>, or through
132 the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=Clipboard>. You will be automatically notified of any
133 progress on the request by the system.
134
135 =head2 Source Code
136
137 The code is open to the world, and available for you to hack on. Please feel free to browse it and play
138 with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
139 from your repository :)
140
141 L<https://github.com/shlomif/Clipboard>
142
143 git clone git://github.com/shlomif/Clipboard.git
144
145 =head1 AUTHOR
146
147 Shlomi Fish <[email protected]>
148
149 =head1 BUGS
150
151 Please report any bugs or feature requests on the bugtracker website
152 L<https://github.com/shlomif/Clipboard/issues>
153
154 When submitting a bug or request, please include a test-file or a
155 patch to an existing test-file that illustrates the bug or desired
156 feature.
157
158 =head1 COPYRIGHT AND LICENSE
159
160 This software is copyright (c) 2025 by Ryan King <[email protected]>.
161
162 This is free software; you can redistribute it and/or modify it under
163 the same terms as the Perl 5 programming language system itself.
164
165 =cut