Mailru-Cloud

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

      },
      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "Encode" : "2.6",
            "File::Basename" : "2.8",
            "IO::Socket::SSL" : "2.002",
            "JSON::XS" : "3.04",
            "LWP::Protocol::https" : "6.06",
            "LWP::UserAgent" : "6.27",
            "URI::Escape" : "3.31",
            "perl" : "5.008008"
         }
      }
   },
   "release_status" : "stable",
   "resources" : {

META.yml  view on Meta::CPAN

  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: Mailru-Cloud
no_index:
  directory:
    - t
    - inc
requires:
  Encode: '2.6'
  File::Basename: '2.8'
  IO::Socket::SSL: '2.002'
  JSON::XS: '3.04'
  LWP::Protocol::https: '6.06'
  LWP::UserAgent: '6.27'
  URI::Escape: '3.31'
  perl: '5.008008'
resources:
  bugtracker: https://github.com/vrag86/perl-mailru-cloud-api/issues
  license: http://dev.perl.org/licenses/
  repository: https://github.com/vrag86/perl-mailru-cloud-api
version: '0.10'

Makefile.PL  view on Meta::CPAN

    LICENSE           => 'perl_5',
    AUTHOR            => 'Pavel Andryushin',
    VERSION_FROM      => 'lib/Mailru/Cloud.pm', # finds $VERSION, requires EU::MM from perl >= 5.5
    PREREQ_PM         => {
        'URI::Escape'           => 3.31,
        'LWP::UserAgent'        => 6.27,
        'LWP::Protocol::https'  => 6.06,
        'JSON::XS'              => 3.04,
        'File::Basename'        => 2.80,
        'Encode'                => 2.60,
        'IO::Socket::SSL'       => 2.002,
    },
    META_MERGE   => {
          requires  => { perl => '5.008008' },
          resources => {
                license     => 'http://dev.perl.org/licenses/',
                repository  => 'https://github.com/vrag86/perl-mailru-cloud-api',
                bugtracker  => 'https://github.com/vrag86/perl-mailru-cloud-api/issues'
              },
        },
    AUTHOR            => 'vrag <vrag867@gmail.com>',

README.md  view on Meta::CPAN

## shareResource(%opt)

Share resource for all. Return weblink if success. Die if error

    my $link = $cloud->shareResource(-path  => '/Temp/');           Share folder /Temp
    Options:
        -path       => Path to shared resource

# DEPENDENCE

[LWP::UserAgent](https://metacpan.org/pod/LWP::UserAgent), [JSON::XS](https://metacpan.org/pod/JSON::XS), [URI::Escape](https://metacpan.org/pod/URI::Escape), [IO::Socket::SSL](https://metacpan.org/pod/IO::Socket::SSL), [Encode](https://metacpan.org/...

# AUTHORS

- Pavel Andryushin <vrag867@gmail.com>

# COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Pavel Andryushin.

This is free software; you can redistribute it and/or modify it under

lib/Mailru/Cloud.pm  view on Meta::CPAN

use strict;
use warnings;
use utf8;
use open qw(:std :utf8);
use Carp qw/croak carp/;
use URI::Escape;
use File::Basename;
use HTTP::Request;
use JSON::XS;
use Encode;
use IO::Socket::SSL;
use base qw/Mailru::Cloud::Auth/;

our $VERSION = '0.10';

my $BUFF_SIZE = 512;

sub uploadFile {
    my ($self, %opt)    = @_;
    my $upload_file     = $opt{'-file'} || croak "You must specify -file param for method uploadFile";
    my $path            = $opt{'-path'} || '/';

lib/Mailru/Cloud.pm  view on Meta::CPAN

    my $link = 'https://cloud.mail.ru/public/' . $json->{body};

    return $link;
}

sub __upload_file {
    my ($self, $url, $file) = @_;

    my $u1 = URI->new($url);

#    $IO::Socket::SSL::DEBUG = 5;
    my $host = $u1->host;
    my $port = $u1->port;
    my $path = $u1->path;

    my $sock = IO::Socket::SSL->new(
                                        PeerAddr    => $host,
                                        PeerPort    => $port,
                                        Proto       => 'tcp',
                                    ) or croak "Cant connect to $host:$port";
    binmode $sock;
    $sock->autoflush(1);

    #Generate boundary
    my $boundary = '5';
    for (1..20) {

lib/Mailru/Cloud.pm  view on Meta::CPAN


Share resource for all. Return weblink if success. Die if error

    my $link = $cloud->shareResource(-path  => '/Temp/');           Share folder /Temp
    Options:
        -path       => Path to shared resource


=head1 DEPENDENCE

L<LWP::UserAgent>, L<JSON::XS>, L<URI::Escape>, L<IO::Socket::SSL>, L<Encode>, L<HTTP::Request>, L<Carp>, L<File::Basename>

=head1 AUTHORS

=over 4

=item *

Pavel Andryushin <vrag867@gmail.com>

=back



( run in 0.527 second using v1.01-cache-2.11-cpan-4d50c553e7e )