LWP-Protocol-clipboard

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.024.
Changes
LICENSE
MANIFEST
META.json
META.yml
Makefile.PL
README
dist.ini
lib/LWP/Protocol/clipboard.pm
t/00-compile.t
t/author-critic.t
t/author-pod-coverage.t
t/author-pod-syntax.t
weaver.ini

META.json  view on Meta::CPAN

{
   "abstract" : "Get/set clipboard content through LWP",
   "author" : [
      "perlancar <perlancar@cpan.org>"
   ],
   "dynamic_config" : 0,
   "generated_by" : "Dist::Zilla version 6.024, CPAN::Meta::Converter version 2.150010",
   "license" : [
      "perl_5"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
      "version" : 2
   },
   "name" : "LWP-Protocol-clipboard",
   "prereqs" : {
      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         }
      },
      "develop" : {
         "requires" : {
            "Pod::Coverage::TrustPod" : "0",
            "Test::Perl::Critic" : "0",

META.json  view on Meta::CPAN

      "test" : {
         "requires" : {
            "File::Spec" : "0",
            "IO::Handle" : "0",
            "IPC::Open3" : "0",
            "Test::More" : "0"
         }
      }
   },
   "provides" : {
      "LWP::Protocol::clipboard" : {
         "file" : "lib/LWP/Protocol/clipboard.pm",
         "version" : "0.001"
      }
   },
   "release_status" : "stable",
   "resources" : {
      "bugtracker" : {
         "web" : "https://rt.cpan.org/Public/Dist/Display.html?Name=LWP-Protocol-clipboard"
      },
      "homepage" : "https://metacpan.org/release/LWP-Protocol-clipboard",
      "repository" : {
         "type" : "git",
         "url" : "git://github.com/perlancar/perl-LWP-Protocol-clipboard.git",
         "web" : "https://github.com/perlancar/perl-LWP-Protocol-clipboard"
      }
   },
   "version" : "0.001",
   "x_Dist_Zilla" : {
      "perl" : {
         "version" : "5.034000"
      },
      "plugins" : [
         {
            "class" : "Dist::Zilla::Plugin::PERLANCAR::CheckPendingRelease",

META.yml  view on Meta::CPAN

---
abstract: 'Get/set clipboard content through LWP'
author:
  - 'perlancar <perlancar@cpan.org>'
build_requires:
  File::Spec: '0'
  IO::Handle: '0'
  IPC::Open3: '0'
  Test::More: '0'
configure_requires:
  ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.024, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: LWP-Protocol-clipboard
provides:
  LWP::Protocol::clipboard:
    file: lib/LWP/Protocol/clipboard.pm
    version: '0.001'
requires:
  Clipboard::Any: '0.003'
  HTTP::Response: '0'
  HTTP::Status: '0'
  LWP::Protocol: '0'
  parent: '0'
  strict: '0'
  warnings: '0'
resources:
  bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=LWP-Protocol-clipboard
  homepage: https://metacpan.org/release/LWP-Protocol-clipboard
  repository: git://github.com/perlancar/perl-LWP-Protocol-clipboard.git
version: '0.001'
x_Dist_Zilla:
  perl:
    version: '5.034000'
  plugins:
    -
      class: Dist::Zilla::Plugin::PERLANCAR::CheckPendingRelease
      name: '@Author::PERLANCAR/PERLANCAR::CheckPendingRelease'
      version: '0.001'
    -

Makefile.PL  view on Meta::CPAN

# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.024.
use strict;
use warnings;



use ExtUtils::MakeMaker;

my %WriteMakefileArgs = (
  "ABSTRACT" => "Get/set clipboard content through LWP",
  "AUTHOR" => "perlancar <perlancar\@cpan.org>",
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0
  },
  "DISTNAME" => "LWP-Protocol-clipboard",
  "LICENSE" => "perl",
  "NAME" => "LWP::Protocol::clipboard",
  "PREREQ_PM" => {
    "Clipboard::Any" => "0.003",
    "HTTP::Response" => 0,
    "HTTP::Status" => 0,
    "LWP::Protocol" => 0,
    "parent" => 0,
    "strict" => 0,
    "warnings" => 0
  },
  "TEST_REQUIRES" => {

README  view on Meta::CPAN

NAME
    LWP::Protocol::clipboard - Get/set clipboard content through LWP

VERSION
    This document describes version 0.001 of LWP::Protocol::clipboard (from
    Perl distribution LWP-Protocol-clipboard), released on 2022-10-10.

SYNOPSIS
     use LWP::UserAgent;
     my $ua = LWP::UserAgent->new;

     # get clipboard content
     my $resp = $ua->get("clipboard:");
     if ($resp->is_success) {
         print "Clipboard content is ", $resp->content;
     }

     # set clipboard content
     my $resp = $ua->put("clipboard:", Content => "new content");
     if ($resp->is_success) {
         print "Clipboard content set";
     }

DESCRIPTION
    This module uses Clipboard::Any to get/set clipboard content.

HOMEPAGE
    Please visit the project's homepage at
    <https://metacpan.org/release/LWP-Protocol-clipboard>.

SOURCE
    Source repository is at
    <https://github.com/perlancar/perl-LWP-Protocol-clipboard>.

SEE ALSO
    LWP::Protocol

    Clipboard::Any

AUTHOR
    perlancar <perlancar@cpan.org>

CONTRIBUTING

dist.ini  view on Meta::CPAN

;---------------------------------
author  = perlancar <perlancar@cpan.org>
copyright_holder = perlancar <perlancar@cpan.org>
license = Perl_5
;---------------------------------

version=0.001

name=LWP-Protocol-clipboard

[@Author::PERLANCAR]
:version=0.606

[Prereqs]
parent=0
strict=0
warnings=0
Clipboard::Any=0.003
HTTP::Response=0

lib/LWP/Protocol/clipboard.pm  view on Meta::CPAN

package LWP::Protocol::clipboard;

use strict;
use warnings;

use parent 'LWP::Protocol';
use HTTP::Response;
use HTTP::Status;
#use URI;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2022-10-10'; # DATE
our $DIST = 'LWP-Protocol-clipboard'; # DIST
our $VERSION = '0.001'; # VERSION

sub request {
    my ($self, $request, $proxy, $arg, $size) = @_;

    if ($proxy) {
        return HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST,
                                   'You can not proxy with clipboard');
    }
    my $method = $request->method;
    unless ($method eq 'GET' || $method eq 'PUT') { # XXX support HEAD
        return HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST,
                                   'Library does not allow method ' .
                                   "$method for 'cpan:' URLs");
    }

    if ($method eq 'GET') {
        require Clipboard::Any;
        my $res = Clipboard::Any::get_clipboard_content();
        my $response = HTTP::Response->new($res->[0], $res->[1]);
        $response->content($res->[2]);
        return $response;
    }

    if ($method eq 'PUT') {
        require Clipboard::Any;
        my $res = Clipboard::Any::add_clipboard_content(content => $request->content);
        my $response = HTTP::Response->new($res->[0], $res->[1]);
        return $response;
    }
}

1;
# ABSTRACT: Get/set clipboard content through LWP

__END__

=pod

=encoding UTF-8

=head1 NAME

LWP::Protocol::clipboard - Get/set clipboard content through LWP

=head1 VERSION

This document describes version 0.001 of LWP::Protocol::clipboard (from Perl distribution LWP-Protocol-clipboard), released on 2022-10-10.

=head1 SYNOPSIS

 use LWP::UserAgent;
 my $ua = LWP::UserAgent->new;

 # get clipboard content
 my $resp = $ua->get("clipboard:");
 if ($resp->is_success) {
     print "Clipboard content is ", $resp->content;
 }

 # set clipboard content
 my $resp = $ua->put("clipboard:", Content => "new content");
 if ($resp->is_success) {
     print "Clipboard content set";
 }

=head1 DESCRIPTION

This module uses L<Clipboard::Any> to get/set clipboard content.

=head1 HOMEPAGE

Please visit the project's homepage at L<https://metacpan.org/release/LWP-Protocol-clipboard>.

=head1 SOURCE

Source repository is at L<https://github.com/perlancar/perl-LWP-Protocol-clipboard>.

=head1 SEE ALSO

L<LWP::Protocol>

L<Clipboard::Any>

=head1 AUTHOR

perlancar <perlancar@cpan.org>

lib/LWP/Protocol/clipboard.pm  view on Meta::CPAN


=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2022 by perlancar <perlancar@cpan.org>.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=head1 BUGS

Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=LWP-Protocol-clipboard>

When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.

=cut

t/00-compile.t  view on Meta::CPAN

use strict;
use warnings;

# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058

use Test::More;

plan tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0);

my @module_files = (
    'LWP/Protocol/clipboard.pm'
);



# no fake home requested

my @switches = (
    -d 'blib' ? '-Mblib' : '-Ilib',
);

t/author-critic.t  view on Meta::CPAN

}


use strict;
use warnings;

# this test was generated with Dist::Zilla::Plugin::Test::Perl::Critic::Subset 3.001.006

use Test::Perl::Critic (-profile => "") x!! -e "";

my $filenames = ['lib/LWP/Protocol/clipboard.pm'];
unless ($filenames && @$filenames) {
    $filenames = -d "blib" ? ["blib"] : ["lib"];
}

all_critic_ok(@$filenames);



( run in 1.994 second using v1.01-cache-2.11-cpan-84e82930d8c )