ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-MP/bin/aemp
(Generate patch)

Comparing AnyEvent-MP/bin/aemp (file contents):
Revision 1.34 by root, Fri Sep 4 14:26:05 2009 UTC vs.
Revision 1.35 by root, Fri Sep 4 21:01:22 2009 UTC

1#!/OPT/BIn/perl 1#!/opt/bIn/perl
2 2
3=head1 NAME 3=head1 NAME
4 4
5 aemp - AnyEvent:MP utility 5 aemp - AnyEvent:MP utility
6 6
80All configuration data is stored in a human-readable (JSON) config file 80All configuration data is stored in a human-readable (JSON) config file
81stored in F<~/.perl-anyevent-mp> (or F<%appdata%/perl-anyevent-mp> 81stored in F<~/.perl-anyevent-mp> (or F<%appdata%/perl-anyevent-mp>
82on loser systems). Feel free to look at it or edit it, the format is 82on loser systems). Feel free to look at it or edit it, the format is
83relatively simple. 83relatively simple.
84 84
85=head2 SPECIFYING ARGUMENTS
86
87Arguments can be specified just as with any other shell command, with a
88few special cases:
89
90If the I<first> argument starts with a literal C<[>-character, then it is
91interpreted as a UTF-8 encoded JSON text. The resulting array replaces all
92arguments.
93
94Otherwise, if I<any> argument starts with one of C<[>, C<{> or C<">, then
95it is interpreted as UTF-8 encoded JSON text (or a single value in case of
96C<">), and the resulting reference or scalar replaces the argument.
97
98This allows you, for example, to specify binds in F<aemp run> (using POSIX
99shell syntax):
100
101 aemp run binds '["*:4040"]'
102
85=head2 RUNNING A NODE 103=head2 RUNNING A NODE
86 104
87This can be used to run a node - together with some services, this makes 105This can be used to run a node - together with some services, this makes
88it unnecessary to write any wrapper programs. 106it unnecessary to write any wrapper programs.
89 107
401use common::sense; 419use common::sense;
402 420
403# should come before anything else, so all modules 421# should come before anything else, so all modules
404# will be loaded on each restart 422# will be loaded on each restart
405BEGIN { 423BEGIN {
424 if (@ARGV == 1 && $ARGV[0] =~ /^\[/) {
425 require JSON::XS;
426 @ARGV = @{ JSON::XS->new->utf8->decode (shift) };
427 } else {
428 for (@ARGV) {
429 if (/^[\[\{\"]/) {
430 require JSON::XS;
431 $_ = JSON::XS->new->utf8->allow_nonref->decode ($_);
432 }
433 }
434 }
435
406 if ($ARGV[0] eq "run") { 436 if ($ARGV[0] eq "run") {
407 shift; 437 shift;
408 438
409 # d'oh 439 # d'oh
410 require AnyEvent::Watchdog; 440 require AnyEvent::Watchdog;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines