Skip to content

Instantly share code, notes, and snippets.

use Ubic::Service::SimpleDaemon;
my $service = Ubic::Service::SimpleDaemon->new(
bin => "/tmp/service.pl",
stdout => "/var/log/rubus/ubic.save.stdout.log",
stderr => "/var/log/rubus/ubic.save.stderr.log",
ubic_log => "/var/log/rubus/ubic.save.log",
user => "www-data",
#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';
ddd();
__END__
This script dies
#!/usr/bin/env perl
use strict;
use warnings FATAL => 'all';
use feature 'say';
use utf8;
use open qw(:std :utf8);
use Data::Printer;
use ElasticSearch;
bessarabov@lol:~$ ./get_pauseid_favorites.pl BESSARABV > import
WARNING: no info about repostitory url for Pod-Weaver-Section-Encoding
WARNING: no info about repostitory url for Perl6-Form
WARNING: no info about repostitory url for Net-FriendFeed
WARNING: no info about repostitory url for Regexp-Debugger
WARNING: no info about repostitory url for String-ShellQuote
WARNING: no info about repostitory url for Net-Domain-ExpireDate
WARNING: no info about repostitory url for M
WARNING: no info about repostitory url for lib-abs
WARNING: no info about repostitory url for App-Uni
use strict;
use warnings FATAL => 'all';
use Test::More;
use qbit;
pass('Loaded ok');
# left argument is less than right argument -1
bessarabov@lol:~/Dropbox/tmp$ ./get_pauseid_distibutions.pl BESSARABV > import
bessarabov@lol:~/Dropbox/tmp$ cat import
namespace,name,source
perl,App::IsGitSynced,https://github.com/bessarabov/App-IsGitSynced.git
perl,Weightbot::API,https://github.com/bessarabov/Weightbot-API.git
perl,Dist::Zilla::PluginBundle::BESSARABV,https://github.com/bessarabov/Dist-Zilla-PluginBundle-BESSARABV.git
perl,Trac::RPC,https://github.com/bessarabov/Trac-RPC.git
perl,Akado::Account,https://github.com/bessarabov/Akado-Account.git
perl,App::D,https://github.com/bessarabov/App-D.git
perl,SQL::Easy,https://github.com/bessarabov/SQL-Easy.git
#!/usr/bin/env perl
use strict;
use warnings FATAL => 'all';
use feature 'say';
use utf8;
use open qw(:std :utf8);
use Data::Printer;
use ElasticSearch;

Однострочники в Perl

date_time: 2014-08-07 23:30:31 MSK

Самый стандартный и часто используемый вариант написания кода на Perl — это создание текстового файла с кодом программы. Например, можно создать текстовый файл "hello.pl" вот с таким содержанием:

#!/usr/bin/perl
bessarabov@lol:~/Dropbox/git/App-AllMyChangesUtils$ bin/get_github_favorites svetlyak40wt
namespace,name,source
unknown,py-must-watch,https://github.com/s16h/py-must-watch.git
Ruby,vandamme,https://github.com/tech-angels/vandamme.git
Python,mobile-balance,https://github.com/svetlyak40wt/mobile-balance.git
JavaScript,nulan,https://github.com/Pauan/nulan.git
C,arcueid,https://github.com/dido/arcueid.git
Arc,arc-mg,https://github.com/mgiken/arc-mg.git
Python,bitsquat-script,https://github.com/artemdinaburg/bitsquat-script.git
unknown,dot-helpers,https://github.com/svetlyak40wt/dot-helpers.git
#!/usr/bin/perl
use strict;
use warnings;
sub main {
my $message;
if (@ARGV) {