App-Nopaste
view release on metacpan or search on metacpan
lib/App/Nopaste/Service/ssh.pm view on Meta::CPAN
SUFFIX => $suffix,
UNLINK => 1,
TMPDIR => 1,
);
my $filename = File::Spec->rel2abs($tmp->filename);
print $tmp $args{text}
or return (0, "Can't write to tempfile $filename");
close $tmp
or return (0, "Can't write to tempfile $filename");
chmod oct($mode), $filename
if defined $mode;
system('scp', '-pq', $filename, "$server:$docroot");
my $file = ( File::Spec->splitpath($filename) )[2];
$file = uri_escape($file);
$file =~ s/%2b/+/gi;
return (1, "$topurl/$file");
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
App::Nopaste::Service::ssh - Copies files to your server using scp
=head1 VERSION
version 1.013
=for stopwords dir Kevin Falcone Thomas Sibley
=head1 ENVIRONMENT VARIABLES
=over 4
=item NOPASTE_SSH_SERVER
The hostname to which you ssh. The left-hand side of the colon in the scp.
For example: C<sartak.org>.
=item NOPASTE_SSH_DOCROOT
The path on disk for your pastes. For example: C<public_html/paste>.
=item NOPASTE_SSH_WEBPATH
The path for URLs. For example: C<http://sartak.org/paste>.
=item NOPASTE_SSH_MODE
Octal permissions mode to set for the temporary file before uploading.
For example: C<0644>.
=item NOPASTE_SSH_USE_DESCRIPTION
Use the supplied description in the paste filename for easier identification of
pastes. Defaults to the source filename, if any, but is overridden by an
explicit C<-d> or C<--description> command line argument.
=back
=head1 APACHE CONFIGURATION RECOMMENDATIONS
The following is a recommended Apache configuration you can drop into
C<.htaccess> in your paste dir.
RemoveHandler .cgi
RemoveHandler .pl
AddDefaultCharset utf-8
Options -ExecCGI -FollowSymLinks -Includes -MultiViews
It prevents common means of script execution so that C<.pl> and C<.cgi>
files won't run and defaults the character set to UTF-8 so browsers
don't have to guess wrong.
=head1 SUPPORT
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=App-Nopaste>
(or L<bug-App-Nopaste@rt.cpan.org|mailto:bug-App-Nopaste@rt.cpan.org>).
=head1 AUTHOR
Kevin Falcone <falcone@cpan.org
Thomas Sibley <trs@bestpractical.com>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2008 by Shawn M Moore.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
( run in 0.837 second using v1.01-cache-2.11-cpan-b16cb0d3907 )