view release on metacpan or search on metacpan
lib/Android/Build.pm view on Meta::CPAN
283284285286287288289290291292293
android:targetSdkVersion=
"$targetSdk"
/>
<application
android:allowBackup=
"true"
android:icon=
"\@drawable/ic_launcher"
android:largeHeap=
"true"
android:debuggable=
"true"
android:hardwareAccelerated=
"true"
android:label=
"\@string/app_name"
>
<activity
android:name=
".$activity"
android:configChanges=
"keyboard|keyboardHidden|orientation|screenSize"
lib/Android/Build.pm view on Meta::CPAN
301302303304305306307308309310311
</activity>
</application>
$permissions
</manifest>
END
$manifest
=~ s/android:debuggable=
"true"
//gs
unless
$android
->debug;
overWriteFile(
$man
,
$manifest
);
}
#-------------------------------------------------------------------------------
# Create resources for app
lib/Android/Build.pm view on Meta::CPAN
401402403404405406407408409410411my
$keyStoreFile
=
$android
->keyStoreFileX;
-e
$keyStoreFile
or confess
"Key store file does not exists:\n$keyStoreFile\n"
;
my
$keyAlias
=
$android
->keyAliasX;
my
$keyStorePwd
=
$android
->keyStorePwd;
my
$alg
=
$android
->debug ?
''
:
"-sigalg SHA1withRSA -digestalg SHA1"
;
my
$c
=
"echo $keyStorePwd |"
.
"jarsigner $alg -keystore $keyStoreFile $apkFile $keyAlias"
;
my
$s
= zzz(
$c
);
lib/Android/Build.pm view on Meta::CPAN
view all matches for this distribution
607608609610611612613614615616617genLValueScalarMethods(
qw(activity)
);
# Activity name: default is B<Activity>. The name of the activity to start on your android device: L<device|/device> is L<package|/package>/L<Activity|/Activity>
genLValueScalarMethods(
qw(assets)
);
# A hash containing your assets folder (if any). Each key is the file name in the assets folder, each corresponding value is the data for that file. The keys of this has...
genLValueScalarMethods(
qw(buildTools)
);
# Name of the folder containing the build tools to be used to build the app, see L<prerequisites|/prerequisites>
genLValueScalarMethods(
qw(buildFolder)
);
# Name of a folder in which to build the app, The default is B</tmp/app/>. If you wish to include assets with your app, specify a named build folder and load it with the ...
genLValueScalarMethods(
qw(classes)
);
# A folder containing precompiled java classes and jar files that you wish to L<lint|/lint> against.
genLValueScalarMethods(
qw(debug)
);
# The app will be debuggable if this option is true.
genLValueScalarMethods(
qw(device)
);
# Device to run on, default is the only emulator or specify '-d', '-e', or '-s SERIAL' per L<adb|http://developer.android.com/guide/developing/tools/adb.html>
genLValueScalarMethods(
qw(fastIcons)
);
# Create icons in parallel if true - the default is to create them serially which takes more elapsed time.
genLValueScalarMethods(
qw(icon)
);
# Jpg file containing a picture that will be converted and scaled by L<ImageMagick|http://imagemagick.org/script/index.php> to make an icon for the app, default is B<icon...
genLValueScalarMethods(
qw(keyAlias)
);
# Alias of the key in your key store file which will be used to sign this app. See L<Signing key|/Signing key> for how to generate a key.
genLValueScalarMethods(
qw(keyStoreFile)
);
# Name of your key store file. See L<Signing key|/Signing key> for how to generate a key.
view release on metacpan or search on metacpan
lib/Android/ElectricSheep/Automator.pm view on Meta::CPAN
4849505152535455565758</* and <% vars %> and <% verbatim sections %> */>
{
"adb"
: {
"path-to-executable"
:
"/usr/local/android-sdk/platform-tools/adb"
},
"debug"
: {
"verbosity"
: 0,
</* cleanup temp files on
exit
*/>
"cleanup"
: 1
},
"logger"
: {
lib/Android/ElectricSheep/Automator.pm view on Meta::CPAN
8889909192939495969798my
$self
= {
'_private'
=> {
'confighash'
=>
undef
,
'configfile'
=>
''
,
# this should never be undef
'Android::ADB'
=>
undef
,
'debug'
=> {
'verbosity'
=> 0,
'cleanup'
=> 1,
},
'log'
=> {
'logger-object'
=>
undef
,
lib/Android/ElectricSheep/Automator.pm view on Meta::CPAN
135136137138139140141142143144if
(
$self
->init_module_specific(
$params
) ){
$log
->error(
"${whoami} (via $parent), line "
.__LINE__.
" : error, call to init_module_specific() has failed."
);
return
undef
}
# optional params, defaults exist above or in the configfile
if
(
exists
(
$params
->{
'verbosity'
}) &&
defined
(
$params
->{
'verbosity'
}) ){
$self
->verbosity(
$params
->{
'verbosity'
}) }
# later we will call verbosity()
if
(
exists
(
$params
->{
'cleanup'
}) &&
defined
(
$params
->{
'cleanup'
}) ){
$self
->cleanup(
$params
->{
'cleanup'
}) }
else
{
$self
->cleanup(
$self
->confighash->{
'debug'
}->{
'cleanup'
}) }
my
$verbosity
=
$self
->verbosity;
if
(
$verbosity
> 0 ){
$log
->info(
"${whoami} (via $parent), line "
.__LINE__.
" : done, success (verbosity is set to "
.
$self
->verbosity.
" and cleanup to "
.
$self
->cleanup.
")."
) }
lib/Android/ElectricSheep/Automator.pm view on Meta::CPAN
11931194119511961197119811991200120112021203# It takes a video recording of current screen on device and
# saves its to the specified file ($filename).
# Optionally specify 'time-limit' or a default of 10s is used.
# Optionally specify 'bit-rate'.
# Optionally specify %size = ('width' => ..., 'height' => ...)
# Optionally specify if $bugreport==1, then Android will overlay debug info on movie.
# Optionally specify 'display-id'.
# Output format of recording is MP4.
# It returns 1 on failure, 0 on success.
# it needs that connect_device() to have been called prior to this call
sub
dump_current_screen_video {
lib/Android/ElectricSheep/Automator.pm view on Meta::CPAN
1532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562sub
apps_roundabout_way {
return
$_
[0]->{
'apps-roundabout-way'
} }
sub
adb {
return
$_
[0]->{
'_private'
}->{
'Android::ADB'
} }
sub
log
{
return
$_
[0]->{
'_private'
}->{
'log'
}->{
'logger-object'
} }
# returns the current verbosity level optionally setting its value
# Value must be an integer >= 0
# setting a verbosity level will also spawn a chain of other debug subs,
sub
verbosity {
my
(
$self
,
$m
) =
@_
;
my
$log
=
$self
->
log
();
if
(
defined
$m
){
my
$parent
= (
caller
(1) )[3] ||
"N/A"
;
my
$whoami
= (
caller
(0) )[3];
$self
->{
'_private'
}->{
'debug'
}->{
'verbosity'
} =
$m
;
if
(
defined
$self
->adb ){
$self
->adb->{
'verbosity'
} =
$m
}
}
return
$self
->{
'_private'
}->{
'debug'
}->{
'verbosity'
}
}
sub
cleanup {
my
(
$self
,
$m
) =
@_
;
my
$log
=
$self
->
log
();
if
(
defined
$m
){
my
$parent
= (
caller
(1) )[3] ||
"N/A"
;
my
$whoami
= (
caller
(0) )[3];
$self
->{
'_private'
}->{
'debug'
}->{
'cleanup'
} =
$m
;
}
return
$self
->{
'_private'
}->{
'debug'
}->{
'cleanup'
}
}
# return configfile or read+check+set a configfile,
# returns undef on failure or the configfile on success
sub
configfile {
lib/Android/ElectricSheep/Automator.pm view on Meta::CPAN
16211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643#print STDOUT "${whoami} (via $parent), line ".__LINE__." : called ...\n";
# we are storing specified confighash but first check it for some fields
# required fields:
for
(
'adb'
,
'debug'
,
'logger'
){
if
( !
exists
(
$m
->{
$_
}) || !
defined
(
$m
->{
$_
}) ){
STDERR
"${whoami} (via $parent), line "
.__LINE__.
" : error, configuration does not have key '$_'.\n"
;
return
undef
}
}
my
$x
;
# adb params
$x
=
$m
->{
'adb'
};
for
(
'path-to-executable'
){
if
( !
exists
(
$x
->{
$_
}) || !
defined
(
$x
->{
$_
}) ){
STDERR
"${whoami} (via $parent), line "
.__LINE__.
" : error, configuration does not have key '$_'.\n"
;
return
undef
}
}
# debug params
$x
=
$m
->{
'debug'
};
if
(
exists
(
$x
->{
'verbosity'
}) &&
defined
(
$x
->{
'verbosity'
}) ){
$self
->verbosity(
$x
->{
'verbosity'
});
}
if
(
exists
(
$x
->{
'cleanup'
}) &&
defined
(
$x
->{
'cleanup'
}) ){
$self
->cleanup(
$x
->{
'cleanup'
});
lib/Android/ElectricSheep/Automator.pm view on Meta::CPAN
17161717171817191720172117221723172417251726172717281729173017311732173317341735# 2. check if exists in confighash
# 3. set default value
my
$v
;
if
(
exists
(
$params
->{
'verbosity'
}) &&
defined
(
$params
->{
'verbosity'
}) ){
$v
=
$params
->{
'verbosity'
};
}
elsif
(
exists
(
$confighash
->{
'debug'
}) &&
exists
(
$confighash
->{
'debug'
}->{
'verbosity'
}) &&
defined
(
$confighash
->{
'debug'
}->{
'verbosity'
}) ){
$v
=
$confighash
->{
'debug'
}->{
'verbosity'
};
}
else
{
$v
= 0;
# default
}
if
(
$self
->verbosity(
$v
) < 0 ){
$log
->error(
"${whoami} (via $parent), line "
.__LINE__.
" : error, call to 'verbosity()' has failed for value '$v'."
);
return
1 }
if
(
exists
(
$params
->{
'cleanup'
}) &&
defined
(
$params
->{
'cleanup'
}) ){
$v
=
$params
->{
'cleanup'
};
}
elsif
(
exists
(
$confighash
->{
'debug'
}) &&
exists
(
$confighash
->{
'debug'
}->{
'cleanup'
}) &&
defined
(
$confighash
->{
'debug'
}->{
'cleanup'
}) ){
$v
=
$confighash
->{
'debug'
}->{
'cleanup'
};
}
else
{
$v
= 0;
# default
}
if
(
$self
->cleanup(
$v
) < 0 ){
$log
->error(
"${whoami} (via $parent), line "
.__LINE__.
" : error, call to 'cleanup()' has failed for value '$v'."
);
return
1 }
lib/Android/ElectricSheep/Automator.pm view on Meta::CPAN
18611862186318641865186618671868186918701871Current distribution is extremely alpha. API may change.
=head1 SYNOPSIS
The present package fascilitates the control
of a USB-debugging-enabled
Android device, e.g. a smartphone,
from a desktop computer using Perl.
It's basically a thickishly thin wrapper
to the omnipotent Android Debug Bridge (adb)
program.
lib/Android/ElectricSheep/Automator.pm view on Meta::CPAN
19501951195219531954195519561957195819591960{
"adb"
: {
"path-to-executable"
:
"/usr/local/android-sdk/platform-tools/adb"
},
"debug"
: {
"verbosity"
: 0,
</* cleanup temp files on
exit
*/>
"cleanup"
: 1
},
"logger"
: {
lib/Android/ElectricSheep/Automator.pm view on Meta::CPAN
view all matches for this distribution
2160216121622163216421652166216721682169HASH_REF
with
keys
C<width> and C<height>, in pixels. Default is "I<the
device's main display resolution>".
=item B<C<bugreport>>
optionally set this flag to 1 to have Android overlay debug information
on the recorded video, e.g. timestamp.
# Optionally specify 'display-id'.
=item B<C<display-id>>
view release on metacpan or search on metacpan
lib/Anki/Import.pm view on Meta::CPAN
4546474849505152535455
comment
=>
'provide details on progress of Anki::Import'
);
opt
vverbose
=> (
isa
=>
'Bool'
,
alias
=>
'V'
,
comment
=>
'verbose information plus debug info'
);
# start here
sub
anki_import {
my
$args
= optargs(
@_
);
lib/Anki/Import.pm view on Meta::CPAN
view all matches for this distribution
64656667686970717273# set log level as appropriate
if
(
$args
->{verbose}) {
set_log_level(
'info'
);
}
elsif
(
$args
->{vverbose}) {
set_log_level(
'debug'
);
}
else
{
set_log_level(
'error'
);
}
logi(
'Log level set'
);
view release on metacpan or search on metacpan
view all matches for this distribution
4243444546474849505152
* Added author feed; Bug
#13505
* Changed
link
format
to /~id/Dist/Path
#note_id; Fixed bug #13507
- Site tools
* Added an annocpan_undump script and a sample update.sh
- Various bug fixes:
* Removed spurious debugging message on Create
* Removed absolute uri on redirects and
join
form submission
* Fixed object_param to work
with
multiple
values
(required by
join
)
* Omitted hidden notes from front page (
#13585)
* Made undump actually load the note text and reference section
* Make sure tests pass
view release on metacpan or search on metacpan
lib/Ansible/Util/Vars.pm view on Meta::CPAN
view all matches for this distribution
136137138139140141142143144145146
default
=>
'localhost'
,
);
=head2 keepTempFiles
Keeps the generated tempfiles for debugging/troubleshooting. The tempfiles
used are a playbook, template, and json output.
=over
=item type: Bool
view release on metacpan or search on metacpan
lib/Ansible.pm view on Meta::CPAN
232425262728293031323334353637383940414243
eval
" use IO::String "
;
$iostrings
= $@ ? 0 : 1;
}
my
$debug_get
= 0;
my
$debug_mget
= 0;
my
$debug_set
= 0;
my
$debug_context
= 0;
my
$debug_text
= 0;
my
$ddata
=
$debug_get
||
$debug_mget
||
$debug_set
||
$debug_context
||
$debug_text
|| 0;
# add debugging data to data structures
my
$spec
=
qr{^ }
;
my
$text
=
" text"
;
my
$subs
=
" subs"
;
my
$next
=
" next"
;
lib/Ansible.pm view on Meta::CPAN
287288289290291292293294295296297sub
text {
my
(
$self
) =
@_
;
return
''
unless
$self
;
if
(
defined
$self
->{
$text
} ) {
return
$debug_text
?
$self
->{
$word
} .
" "
.
$self
->{
$text
}
:
$self
->{
$text
};
}
my
(
@p
) =
$self
->sortit(
grep
(! /
$spec
/o,
keys
%$self
));
if
(
@p
> 1 ) {
lib/Ansible.pm view on Meta::CPAN
302303304305306307308309310311312313314315316317318319320321322323324325326327328
my
%temp
=
map
{
$self
->{
$_
}->sequenced_text(0) }
@p
;
return
join
(
''
,
map
{
$temp
{
$_
} }
sort
keys
%temp
);
}
elsif
(
$self
->{
$dupl
} ) {
return
join
(
''
,
map
{
$_
->{
$word
} .
" "
.
$_
->{
$text
} } @{
$self
->{
$dupl
} })
if
$debug_text
;
return
join
(
''
,
map
{
$_
->{
$text
} } @{
$self
->{
$dupl
} });
}
confess
unless
@p
;
return
$self
->{
$p
[0]}->text;
}
sub
sequenced_text {
my
(
$self
,
$all
) =
@_
;
my
@t
= ();
if
(
defined
$self
->{
$text
} ) {
push
(
@t
,
$debug_text
? (
$self
->
seqn
=>
$self
->{
$word
} .
" "
.
$self
->{
$text
})
: (
$self
->
seqn
=>
$self
->{
$text
}));
}
if
(
exists
$self
->{
$dupl
} ) {
push
(
@t
,
$debug_text
?
map
{
$_
->
seqn
=>
$_
->{
$word
} .
" "
.
$_
->{
$text
} } @{
$self
->{
$dupl
} }
:
map
{
$_
->
seqn
=>
$_
->{
$text
} } @{
$self
->{
$dupl
} });
}
my
(
@p
) =
$self
->sortit(
grep
(! /
$spec
/o,
keys
%$self
));
if
(
@p
) {
lib/Ansible.pm view on Meta::CPAN
395396397398399400401402403404405406407408409410411412413# ip address x y
#
sub
setcontext {
my
(
$self
,
@extras
) =
@_
;
STDERR
"\nSETCONTEXT\n"
if
$debug_context
;
unless
(
$self
->block ) {
STDERR
"\nNOT_A_BLOCK $self->{$debg}\n"
if
$debug_context
;
$self
=
$self
->context;
}
printf
STDERR
"\nSELF %sCONTEXT %sCCONTEXT %sEXTRAS$#extras @extras\n"
,
$self
->{
$debg
},
$self
->context->{
$debg
},
$self
->context->context->{
$debg
}
if
$debug_context
;
my
$x
=
$self
->context;
return
(
grep
defined
,
$x
->context->setcontext,
trim(
$x
->zoom->{
$text
}),
@extras
)
lib/Ansible.pm view on Meta::CPAN
416417418419420421422423424425426427}
sub
contextcount {
my
$self
=
shift
;
my
(
@a
) =
$self
->setcontext(
@_
);
printf
STDERR
"CONTEXTCOUNT = %d\n"
,
scalar
(
@a
)
if
$debug_context
;
STDERR
map
{
"CC: $_\n"
}
@a
if
$debug_context
;
return
scalar
(
@a
);
}
sub
unsetcontext {
my
$self
=
shift
;
lib/Ansible.pm view on Meta::CPAN
445446447448449450451452453454455456457458459460461462463sub
set {
my
$self
=
shift
;
my
$new
=
pop
;
my
(
@designators
) =
@_
;
#my ($self, $designator, $new) = @_;
STDERR
"\nSET\n"
if
$debug_set
;
return
undef
unless
$self
;
my
$old
;
#my @designators;
STDERR
"\nSELF $self->{$debg}"
if
$debug_set
;
# move into the block if possible
$self
=
$self
->subs
if
$self
->subs;
STDERR
"\nSELF $self->{$debg}"
if
$debug_set
;
#if (ref $designator eq 'ARRAY') {
# @designators = @$designator;
# $old = $self->get(@designators);
# $designator = pop(@designators);
#} elsif ($designator) {
lib/Ansible.pm view on Meta::CPAN
471472473474475476477478479480481
$designator
=
pop
(
@designators
);
}
else
{
$old
=
$self
;
}
STDERR
"\nOLD $old->{$debg}"
if
$debug_set
;
my
(
@lines
) = expand(
grep
(/./,
split
(/\n/,
$new
)));
if
(
$lines
[0] =~ /^(\s+)/ ) {
my
$ls
= $1;
my
$m
= 1;
map
{
substr
(
$_
, 0,
length
(
$ls
)) eq
$ls
or
$m
= 0 }
@lines
;
lib/Ansible.pm view on Meta::CPAN
487488489490491492493494495496497498499500501502503
s/(\S)\s+/$1 /g;
s/\s+$//;
$_
=
'exit'
if
/^\s*!\s*$/;
$_
=
"$indent$_"
;
}
STDERR
"SET TO {\n@lines\n}\n"
if
$debug_set
;
my
$desig
=
shift
(
@lines
);
my
@o
;
undef
$old
if
!
$old
;
if
( !
$old
) {
STDERR
"NO OLD\n"
if
$debug_set
;
push
(
@o
, openangle(
$self
->setcontext(
@designators
)));
push
(
@o
,
$desig
);
}
elsif
( !
$designator
&& ! looks_like_a_block(
$desig
,
@lines
) ) {
if
(
$self
->block &&
$self
->context ) {
lib/Ansible.pm view on Meta::CPAN
505506507508509510511512513514515
$old
=
$self
->context;
undef
$desig
;
}
else
{
unshift
(
@lines
,
$desig
);
STDERR
"IN NASTY BIT\n"
if
$debug_set
;
#
# this is a messy situation: we've got a random
# block of stuff to set inside a random block.
# In theorey we could avoid the die, I'll leave
# that as an exercise for the reader.
lib/Ansible.pm view on Meta::CPAN
534535536537538539540541542543544545546547548
unshift
(
@o
,
$self
->setcontext)
if
@o
;
}
}
elsif
(
$old
->teql(
$desig
) ) {
STDERR
"DESIGNATOR EQUAL\n"
if
$debug_set
;
# okay
}
else
{
STDERR
"DESIGNATOR DIFERENT\n"
if
$debug_set
;
push
(
@o
, openangle(
$self
->setcontext(
@designators
)));
if
(
defined
$designator
) {
push
(
@o
, iinvert(
$indent
,
$designator
));
}
else
{
lib/Ansible.pm view on Meta::CPAN
550551552553554555556557558559560561562563564565566567568569570571572573
}
push
(
@o
,
$desig
);
}
if
(
@lines
) {
if
(
$old
&& !
@o
&&
$old
->subs &&
$old
->subs->
next
) {
STDERR
"OLD= $old->{$debg}"
if
$debug_set
;
my
$ok
= 1;
my
$f
=
$old
->subs->
next
;
STDERR
"F= $f->{$debg}"
if
$debug_set
;
for
my
$l
(
@lines
) {
next
if
$l
=~ /^\s
*exit
\s*$/;
next
if
$f
->teql(
$l
);
STDERR
"LINE DIFF ON $l\n"
if
$debug_set
;
$ok
= 0;
last
;
}
continue
{
$f
=
$f
->
next
;
STDERR
"F= $f->{$debg}"
if
$debug_set
;
}
if
( !
$ok
||
$f
) {
push
(
@o
, openangle(
$self
->setcontext(
@designators
)));
push
(
@o
, iinvert(
$indent
,
$designator
));
push
(
@o
,
$desig
);
lib/Ansible.pm view on Meta::CPAN
614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654sub
get {
my
(
$self
,
@designators
) =
@_
;
return
$self
->mget(
@designators
)
if
wantarray
&&
@designators
> 1;
STDERR
"\nGET <@designators> $self->{$debg}"
if
$debug_get
;
return
$self
unless
$self
;
my
$zoom
=
$self
->zoom->subs;
$self
=
$zoom
if
$zoom
;
STDERR
"\nZOOMSUB $self->{$debg}"
if
$debug_get
;
while
(
@designators
) {
my
$designator
=
shift
(
@designators
);
# $self = $self->zoom;
# $self = $self->single || $self;
STDERR
"\nDESIGNATOR: $designator. ZOOMED: $self->{$debg}\n"
if
$debug_get
;
for
my
$d
(
split
(
' '
,
$designator
) ) {
STDERR
"\nDO WE HAVE A: $d?\n"
if
$debug_get
;
return
$undef
unless
$self
->{
$d
};
$self
=
$self
->{
$d
};
STDERR
"\nWE DO: $self->{$debg}\n"
if
$debug_get
;
}
last
unless
@designators
;
if
(
$self
->single ) {
$self
=
$self
->subs;
STDERR
"\nSINGLETON: $self->{$debg}\n"
if
$debug_get
;
}
else
{
STDERR
"\nNOT SINGLE\n"
if
$debug_get
;
return
$undef
;
}
}
STDERR
"\nDONE\n"
if
$debug_get
;
if
(
wantarray
) {
$self
=
$self
->zoom;
my
(
@k
) =
$self
->kids;
return
@k
if
@k
;
return
$self
;
lib/Ansible.pm view on Meta::CPAN
view all matches for this distribution
702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
my
$cl
= callerlevels;
my
@newset
;
if
(
@designators
> 1 ) {
STDERR
"\nGET$cl $designators[0]----------\n"
if
$debug_mget
;
my
(
@set
) =
$self
->get(
shift
@designators
);
for
my
$item
(
@set
) {
STDERR
"\nMGET$cl $item ----------\n"
if
$debug_mget
;
STDERR
"\nMGET$cl $item->{$debg}\n"
if
$debug_mget
;
my
(
@got
) =
$item
->mget(
@designators
);
STDERR
map
{
"\nRESULTS$cl: $_->{$debg}\n"
}
@got
if
$debug_mget
;
push
(
@newset
,
@got
);
}
}
else
{
STDERR
"\nxGET$cl $designators[0] -------\n"
if
$debug_mget
;
(
@newset
) =
$self
->get(
shift
@designators
);
STDERR
map
{
"\nxRESULTS$cl: $_->{$debg}\n"
}
@newset
if
$debug_mget
;
}
return
@newset
;
}
view release on metacpan or search on metacpan
src/ppport.h view on Meta::CPAN
13221323132413251326132713281329133013311332debop||5.005000|
debprofdump||5.005000|
debprof|||
debstackptrs||5.007003|
debstack||5.007003|
debug_start_match|||
deb||5.007003|v
defelem_target|||
del_sv|||
delete_eval_scope|||
delimcpy||5.004000|n
src/ppport.h view on Meta::CPAN
14881489149014911492149314941495149614971498get_context||5.006000|n
get_cvn_flags|5.009005||p
get_cvs|5.011000||p
get_cv|5.006000||p
get_db_sub|||
get_debug_opts|||
get_hash_seed|||
get_hv|5.006000||p
get_invlist_iter_addr|||
get_invlist_offset_addr|||
get_invlist_previous_index_addr|||
src/ppport.h view on Meta::CPAN
16401641164216431644164516461647164816491650incpush|||
ingroup|||
init_argv_symbols|||
init_constants|||
init_dbargs|||
init_debugger|||
init_global_struct|||
init_i18nl10n||5.006000|
init_i18nl14n||5.006000|
init_ids|||
init_interp|||
src/ppport.h view on Meta::CPAN
22792280228122822283228422852286228722882289rsignal_save|||
rsignal_state||5.004000|
rsignal||5.004000|
run_body|||
run_user_filter|||
runops_debug||5.005000|
runops_standard||5.005000|
rv2cv_op_cv||5.013006|
rvpv_dup|||
rxres_free|||
rxres_restore|||
src/ppport.h view on Meta::CPAN
view all matches for this distribution
26912692269326942695269626972698269927002701unreferenced_to_tmp_stack|||
unshare_hek_or_pvn|||
unshare_hek|||
unsharepvn||5.004000|
unwind_handler_stack|||
update_debugger_info|||
upg_version||5.009005|
usage|||
utf16_textfilter|||
utf16_to_utf8_reversed||5.006001|
utf16_to_utf8||5.006001|
view release on metacpan or search on metacpan
inc/Spiffy.pm view on Meta::CPAN
view all matches for this distribution
5051525354555657585960no
warnings;
my
$self_package
=
shift
;
# XXX Using parse_arguments here might cause confusion, because the
# subclass's boolean_arguments and paired_arguments can conflict, causing
# difficult debugging. Consider using something truly local.
my
(
$args
,
@export_list
) =
do
{
local
*boolean_arguments
=
sub
{
qw(
-base -Base -mixin -selfless
-XXX -dumper -yaml
view release on metacpan or search on metacpan
inc/Spiffy.pm view on Meta::CPAN
view all matches for this distribution
5051525354555657585960no
warnings;
my
$self_package
=
shift
;
# XXX Using parse_arguments here might cause confusion, because the
# subclass's boolean_arguments and paired_arguments can conflict, causing
# difficult debugging. Consider using something truly local.
my
(
$args
,
@export_list
) =
do
{
local
*boolean_arguments
=
sub
{
qw(
-base -Base -mixin -selfless
-XXX -dumper -yaml
view release on metacpan or search on metacpan
lib/AnyEvent/Beanstalk/Worker.pm view on Meta::CPAN
4243444546474849505152$self
->{_log_ctx}->title(__PACKAGE__);
$self
->{_log_ctx}->level(
$self
->{_log_level});
$self
->{_log} = {};
$self
->{_log}->{trace} =
$self
->{_log_ctx}->logger(
"trace"
);
$self
->{_log}->{debug} =
$self
->{_log_ctx}->logger(
"debug"
);
$self
->{_log}->{info} =
$self
->{_log_ctx}->logger(
"info"
);
$self
->{_log}->{note} =
$self
->{_log_ctx}->logger(
"note"
);
$self
->{_signal} = {};
$self
->{_signal}->{TERM} = AnyEvent->signal(
lib/AnyEvent/Beanstalk/Worker.pm view on Meta::CPAN
266267268269270271272273274275276277278AnyEvent->condvar(
cb
=>
sub
{
if
(
ref
(
$self
->{_cb}->{
$evt
} ) eq
'CODE'
) {
$self
->{_log}->{trace}->(
"event: $evt"
);
my
@data
=
$_
[0]->
recv
;
$self
->{_log}->{debug}->(
"shift event ($evt): "
.
shift
@{
$self
->{_events} } );
$self
->{_log}->{debug}->(
"EVENTS (s): "
.
join
(
' '
=> @{
$self
->{_events} } ) );
$self
->{_cb}->{
$evt
}->(
@data
);
}
$self
->{_event}->{
$evt
} = AnyEvent->condvar(
cb
=> __SUB__ );
lib/AnyEvent/Beanstalk/Worker.pm view on Meta::CPAN
view all matches for this distribution
283284285286287288289290291292293294295}
sub
emit {
my
$self
=
shift
;
my
$event
=
shift
;
$self
->{_log}->{debug}->(
"push event ($event)"
);
push
@{
$self
->{_events} },
$event
;
$self
->{_log}->{debug}
->(
"EVENTS (p): "
.
join
(
' '
=> @{
$self
->{_events} } ) );
$self
->{_event}->{
$event
}->
send
(
$self
,
@_
);
}
sub
beanstalk {
view release on metacpan or search on metacpan
lib/AnyEvent/Beanstalk.pm view on Meta::CPAN
3839404142434445464748
ttr
=>
$arg
{ttr} || 120,
priority
=>
$arg
{priority} || 10_000,
encoder
=>
$arg
{encoder} ||
$YAML_DUMP
,
decoder
=>
$arg
{decoder} ||
$YAML_LOAD
,
server
=>
$arg
{server} ||
undef
,
debug
=>
$arg
{debug} || 0,
on_error
=>
$arg
{on_error} ||
undef
,
on_connect
=>
$arg
{on_connect} ||
undef
,
},
ref
(
$proto
) ||
$proto
);
lib/AnyEvent/Beanstalk.pm view on Meta::CPAN
view all matches for this distribution
704705706707708709710711712713714715716subroutine that will be called
when
data from the beanstalkd server needs to be
decoded. The subroutine will be passed the data fetched from the beanstalkd
server and should
return
the value the application can
use
. The
default
is
to decode using YAML.
=item B<debug ([$debug])>
Set/get debug value. If set to a true value then all communication with the server will be
output with C<warn>
=item B<on_error ([$callback])>
A code reference to call when there is an error communicating with the server, for example
view release on metacpan or search on metacpan
lib/AnyEvent/BitTorrent.pm view on Meta::CPAN
7778798081828384858687
my
$h
=
shift
;
AE::
log
info
=>
'Socket EOF'
;
$s
->_del_peer(
$h
);
},
on_read
=>
sub
{
AE::
log
debug
=>
'Read Socket'
;
$s
->_on_read_incoming(
@_
);
}
);
$s
->_add_peer(
$handle
);
},
sub
{
lib/AnyEvent/BitTorrent.pm view on Meta::CPAN
102103104105106107108109110111112sub
_build_reserved {
my
$reserved
=
"\0"
x 8;
#vec($reserved, 5, 8) = 0x10; # Ext Protocol
vec
(
$reserved
, 7, 8) = 0x04;
# Fast Ext
AE::
log
debug
=>
'_build_reserved() => '
.
$reserved
;
$reserved
;
}
has
peerid
=> (
is
=>
'ro'
,
isa
=>
$PEERID
,
init_arg
=>
undef
,
lib/AnyEvent/BitTorrent.pm view on Meta::CPAN
146147148149150151152153154155156
my
$prio
= !!
$s
->files->[
$findex
]{priority};
for
my
$index
(
$s
->_file_to_range(
$findex
)) {
vec
(
$wanted
,
$index
, 1) =
$prio
&& !
vec
(
$s
->bitfield,
$index
, 1);
}
}
AE::
log
debug
=>
'->wanted() => '
.
unpack
'b*'
,
$wanted
;
$wanted
;
}
sub
complete {
my
$s
=
shift
;
lib/AnyEvent/BitTorrent.pm view on Meta::CPAN
192193194195196197198199200201202
#return if ref $s ne __PACKAGE__; # Applying roles makes deep rec
open
my
$fh
,
'<'
,
$s
->path;
sysread
$fh
,
my
$raw
, -s
$fh
;
my
$metadata
= bdecode
$raw
;
AE::
log
debug
=>
sub
{
'_build_metadata() => '
. Data::Dump::
dump
(
$metadata
);
};
$metadata
;
}
lib/AnyEvent/BitTorrent.pm view on Meta::CPAN
266267268269270271272273274275276sub
_build_size {
my
$s
=
shift
;
my
$ret
= 0;
$ret
+=
$_
->{
length
}
for
@{
$s
->files};
AE::
log
debug
=>
'_build_size() => '
.
$ret
;
$ret
;
}
sub
_open {
my
(
$s
,
$i
,
$m
) =
@_
;
lib/AnyEvent/BitTorrent.pm view on Meta::CPAN
331332333334335336337338339340341sub
_write_cache {
my
(
$s
,
$f
,
$o
,
$d
) =
@_
;
my
$path
=
$s
->_cache_path;
AE::
log
debug
=>
'Attempting to store %d bytes to cache file (%s) [$f=%s, $o=%s]'
,
length
(
$d
),
$path
,
$f
,
$o
;
my
@split
= File::Spec->splitdir(
$path
);
pop
@split
;
# File name itself
my
$dir
= File::Spec->catdir(
@split
);
lib/AnyEvent/BitTorrent.pm view on Meta::CPAN
346347348349350351352353354355356357358359360361362363364365366
my
$pos
=
sysseek
$fh
, 0, SEEK_CUR;
my
$w
=
syswrite
$fh
,
$d
;
flock
$fh
, LOCK_UN;
close
$fh
;
$s
->piece_cache->{
$f
}{
$o
} =
$pos
;
AE::
log
debug
=>
'Wrote %d bytes to cache file'
,
$w
;
return
$w
;
}
sub
_read_cache {
my
(
$s
,
$f
,
$o
,
$l
) =
@_
;
$s
->piece_cache->{
$f
} //
return
;
$s
->piece_cache->{
$f
}{
$o
} //
return
;
my
$path
=
$s
->_cache_path;
AE::
log
debug
=>
'Attempting to read %d bytes from cache file (%s) [$f=%s, $o=%s]'
,
$l
,
$path
,
$f
,
$o
;
sysopen
(
my
(
$fh
),
$path
, O_RDONLY)
||
return
;
flock
$fh
, LOCK_SH;
lib/AnyEvent/BitTorrent.pm view on Meta::CPAN
372373374375376377378379380381382}
sub
_read {
my
(
$s
,
$index
,
$offset
,
$length
) =
@_
;
AE::
log
debug
=>
'Attempting to read %d bytes from piece %d starting at %d bytes'
,
$length
,
$index
,
$offset
;
my
$data
=
''
;
my
$file_index
= 0;
my
$total_offset
= (
$index
*
$s
->piece_length) +
$offset
;
lib/AnyEvent/BitTorrent.pm view on Meta::CPAN
435436437438439440441442443444445446447448449450451}
sub
_write {
my
(
$s
,
$index
,
$offset
,
$data
) =
@_
;
AE::
log
debug
=>
'Attempting to write %d bytes from piece %d starting at %d bytes'
,
length
(
$data
),
$index
,
$offset
;
my
$file_index
= 0;
my
$total_offset
=
int
((
$index
*
$s
->piece_length) + (
$offset
|| 0));
AE::
log
debug
=>
'...calculated offset == %d'
,
$total_offset
;
SEARCH:
while
(
$total_offset
>
$s
->files->[
$file_index
]->{
length
}) {
$total_offset
-=
$s
->files->[
$file_index
]->{
length
};
$file_index
++;
lib/AnyEvent/BitTorrent.pm view on Meta::CPAN
659660661662663664665666667668669
. (
'&downloaded='
.
$s
->downloaded)
. (
'&left='
.
$s
->_left)
. (
'&port='
.
$s
->port)
.
'&compact=1'
. (
$e
?
'&event='
.
$e
:
''
);
AE::
log
debug
=>
'Announce URL: '
.
$_url
;
http_get
$_url
,
sub
{
my
(
$body
,
$hdr
) =
@_
;
AE::
log
trace
=>
sub
{
'Announce response: '
. Data::Dump::
dump
(
$body
,
$hdr
);
lib/AnyEvent/BitTorrent.pm view on Meta::CPAN
901902903904905906907908909910911sub
_on_read {
my
(
$s
,
$h
) =
@_
;
while
(
my
$packet
= parse_packet(\
$h
->rbuf)) {
last
if
!
$packet
;
AE::
log
debug
=>
sub
{
'Incoming packet: '
. Data::Dump::
dump
(
$packet
->{error});
};
if
(
defined
$packet
->{error}) {
$s
->_del_peer(
$h
);
lib/AnyEvent/BitTorrent.pm view on Meta::CPAN
12721273127412751276127712781279128012811282
default
=>
sub
{
'active'
}
);
sub
stop {
my
$s
=
shift
;
AE::
log
debug
=>
'Stopping...'
;
return
if
$s
->state eq
'stopped'
;
AE::
log
trace
=>
'Announcing "stopped" event to trackers...'
;
$s
->announce(
'stopped'
);
AE::
log
trace
=>
'Disconnecting peers...'
;
$s
->_clear_peers;
lib/AnyEvent/BitTorrent.pm view on Meta::CPAN
view all matches for this distribution
12881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322
$s
->_set_state(
'stopped'
);
}
sub
start {
my
$s
=
shift
;
AE::
log
debug
=>
'Starting...'
;
$s
->announce(
'started'
)
unless
$s
->state eq
'active'
;
$s
->peers;
AE::
log
trace
=>
'Starting new peers ticker...'
;
$s
->_peer_timer;
AE::
log
trace
=>
'Setting internal status...'
;
$s
->_set_state(
'active'
);
}
sub
pause {
my
$s
=
shift
;
AE::
log
debug
=>
'Pausing...'
;
$s
->peers;
AE::
log
trace
=>
'Starting new peers ticker...'
;
$s
->_peer_timer;
AE::
log
trace
=>
'Setting internal status...'
;
$s
->_set_state(
'paused'
);
}
#
sub
BUILD {
my
(
$s
,
$a
) =
@_
;
AE::
log
debug
=>
'BUILD()'
;
$s
->start && AE::
log
debug
=>
'Calling ->start()'
if
$s
->state eq
'active'
;
$s
->paused && AE::
log
debug
=>
'Calling ->paused() '
if
$s
->state eq
'paused'
;
}
# Testing stuff goes here
sub
_send_encrypted {
view release on metacpan or search on metacpan
examples/server.pl view on Meta::CPAN
7374757677787980818283
my
(
$id
,
$status
,
$reply
) = ($1, $2, $3);
if
(
defined
$requests
{
$id
}) {
my
$c
=
$requests
{
$id
};
if
(
defined
$clients
{
$c
}) {
my
$frame
= Protocol::WebSocket::Frame->new(
$message
);
$log
->debug(
"sending reply for $id"
);
$c
->push_write(
$frame
->to_bytes);
}
}
delete
$requests
{
$id
};
}
examples/server.pl view on Meta::CPAN
view all matches for this distribution
120121122123124125126127128129130sub
main()
{
my
$ld_log
= Log::Dispatch->new(
outputs
=> [
[
'Syslog'
,
min_level
=>
'info'
,
ident
=>
'chrome-siteshow'
],
[
'Screen'
,
min_level
=>
'debug'
,
newline
=> 1 ],
]
);
Log::Any::Adapter->set(
'Dispatch'
,
dispatcher
=>
$ld_log
);
$log
->info(
"starting up"
);
view release on metacpan or search on metacpan
ex/example.pl view on Meta::CPAN
view all matches for this distribution
910111213141516171819my
$cl
= My::Client->new(
host
=>
'127.0.0.1'
,
port
=> 7,
reconnect
=> 1,
debug
=> 0,
timeout
=> 1,
);
my
$cv
= AnyEvent->condvar;
my
$fails
= 0;
$cl
->reg_cb(
view release on metacpan or search on metacpan
lib/AnyEvent/Connector.pm view on Meta::CPAN
view all matches for this distribution
271272273274275276277278279280281282283284285286=back
=head1 REPOSITORY
=head1 BUGS AND FEATURE REQUESTS
Please report bugs and feature requests to my Github issues
Although I prefer Github, non-Github users can use CPAN RT
Please send email to C<bug-AnyEvent-Connector at rt.cpan.org> to report bugs
if you do not have CPAN RT account.
view release on metacpan or search on metacpan
lib/AnyEvent/Cron.pm view on Meta::CPAN
2425262728293031323334
(
is
=>
'rw'
,
isa
=>
'Int'
,
default
=>
sub
{ 1 } );
has
verbose
=>
(
is
=>
'rw'
,
isa
=>
'Bool'
,
default
=>
sub
{ 0 } );
has
debug
=>
(
is
=>
'rw'
,
isa
=>
'Bool'
,
default
=>
sub
{ 0 } );
# TODO:
has
ignore_floating
=>
(
is
=>
'rw'
,
isa
=>
'Bool'
,
default
=>
sub
{ 0 } );
lib/AnyEvent/Cron.pm view on Meta::CPAN
106107108109110111112113114115116117118119120121122123124125126127AnyEvent->now_update();
my
$now_epoch
= AnyEvent->now;
my
$next_epoch
;
my
$delay
;
my
$name
=
$job
->{name};
my
$debug
=
$job
->{debug};
if
(
$job
->{event} ) {
my
$event
=
$job
->{event};
$next_epoch
=
$event
->
next
->epoch;
# set next schedule time
$delay
=
$next_epoch
-
$now_epoch
;
warn
"delay:"
,
$delay
if
$debug
;
}
elsif
(
$job
->{seconds} ) {
$next_epoch
=
$now_epoch
+
$job
->{seconds};
$delay
=
$next_epoch
-
$now_epoch
;
warn
"delay:"
,
$delay
if
$debug
;
}
elsif
(
$job
->{
time
} ) {
my
$time
=
$job
->{
time
};
my
$now
= DateTime->from_epoch(
epoch
=>
$now_epoch
);
# depends on now
my
$next
=
$now
->clone;
lib/AnyEvent/Cron.pm view on Meta::CPAN
159160161162163164165166167168169170171172173174175176
$self
->_schedule(
$job
)
unless
$job
->{once};
if
(
$job
->{single} &&
$job
->{running}++ ) {
STDERR
"Skipping job '$name' - still running\n"
if
$debug
;
}
else
{
eval
{
$job
->{cb}->(
$self
->{_cv},
$job
); 1 }
or
warn
$@ ||
'Unknown error'
;
delete
$job
->{running};
STDERR
"Finished job '$name'\n"
if
$debug
;
}
$self
->{_cv}->end;
}
);
}
lib/AnyEvent/Cron.pm view on Meta::CPAN
view all matches for this distribution
193194195196197198199200201202203=head1 SYNOPSIS
my $cron = AnyEvent::Cron->new(
verbose => 1,
debug => 1,
ignore_floating => 1
);
# 00:00 (hour:minute)
$cron->add("00:00" => sub { warn "zero"; })
view release on metacpan or search on metacpan
lib/AnyEvent/Curl/Multi.pm view on Meta::CPAN
186187188189190191192193194195196
queue
=> [],
max_concurrency
=> 0,
max_redirects
=> 0,
timeout
=>
undef
,
proxy
=>
undef
,
debug
=>
undef
,
ipresolve
=>
undef
,
@_
);
if
(!
$MS_TIMEOUT_SUPPORTED
lib/AnyEvent/Curl/Multi.pm view on Meta::CPAN
view all matches for this distribution
358359360361362363364365366367368}
# Accept gzip or deflate-compressed responses
$easy_h
->setopt(CURLOPT_ENCODING,
""
);
$easy_h
->setopt(CURLOPT_VERBOSE, 1)
if
$self
->{debug} ||
$opts
{debug};
my
$proxy
=
$self
->{proxy} ||
$opts
{proxy};
$easy_h
->setopt(CURLOPT_PROXY,
$proxy
)
if
$proxy
;
my
$timeout
=
$self
->{timeout} ||
$opts
{timeout};
view release on metacpan or search on metacpan
ex/sample.pl view on Meta::CPAN
view all matches for this distribution
7891011121314151617181920my
$adb
= AnyEvent::DBD::Pg->new(
'dbi:Pg:dbname=test'
,
user
=>
'pass'
, {
pg_enable_utf8
=> 1,
pg_server_prepare
=> 0,
quote_char
=>
'"'
,
name_sep
=>
"."
,
},
debug
=> 1);
$adb
->queue_size( 4 );
$adb
->debug( 1 );
$adb
->
connect
;
$adb
->selectcol_arrayref(
"select pg_sleep( 0.1 ), 1"
, {
Columns
=> [ 1 ] },
sub
{
my
$rc
=
shift
or
return
warn
;
view release on metacpan or search on metacpan
inc/Spiffy.pm view on Meta::CPAN
view all matches for this distribution
5051525354555657585960no
warnings;
my
$self_package
=
shift
;
# XXX Using parse_arguments here might cause confusion, because the
# subclass's boolean_arguments and paired_arguments can conflict, causing
# difficult debugging. Consider using something truly local.
my
(
$args
,
@export_list
) =
do
{
local
*boolean_arguments
=
sub
{
qw(
-base -Base -mixin -selfless
-XXX -dumper -yaml
view release on metacpan or search on metacpan
t/fake-mysql view on Meta::CPAN
284285286287288289290291292293294my
$remote_dsn_user
;
my
$remote_dsn_password
;
my
$port
=
'23306'
;
my
$interface
=
'127.0.0.1'
;
my
$debug
;
my
@config_names
;
my
@rules
;
my
%storage
;
my
@args
=
@ARGV
;
t/fake-mysql view on Meta::CPAN
301302303304305306307308309310311312313314315316317318
"remote_dsn_user=s"
=> \
$remote_dsn_user
,
"remote_dsn_password=s"
=> \
$remote_dsn_password
,
"port=i"
=> \
$port
,
"config=s"
=> \
@config_names
,
"if|interface|ip=s"
=> \
$interface
,
"debug"
=> \
$debug
) or
die
;
@ARGV
=
@args
;
my
$start_dbh
;
if
(
defined
$start_dsn
) {
localtime
().
" [$$] Connecting to DSN $start_dsn.\n"
if
$debug
;
$start_dbh
= DBI->
connect
(
$start_dsn
,
$start_dsn_user
,
$start_dsn_password
);
}
$storage
{dbh} =
$start_dbh
;
$storage
{dsn} =
$start_dsn
;
t/fake-mysql view on Meta::CPAN
329330331332333334335336337338339340341342343344345346347
read
(CONFIG_FILE,
my
$config_text
, -s
$config_name
);
close
(CONFIG_FILE);
eval
(
'$config_sub = sub { '
.
$config_text
.
'}'
) or
die
$@;
my
@config_rules
=
&$config_sub
();
push
@rules
,
@config_rules
;
localtime
().
" [$$] Loaded "
.(
$#config_rules
+ 1).
" rules from $config_name.\n"
if
$debug
;
}
socket
(SERVER_SOCK, PF_INET, SOCK_STREAM,
getprotobyname
(
'tcp'
));
setsockopt
(SERVER_SOCK, SOL_SOCKET, SO_REUSEADDR,
pack
(
"l"
, 1));
bind
(SERVER_SOCK, sockaddr_in(
$port
, inet_aton(
$interface
))) ||
die
"bind: $!"
;
listen
(SERVER_SOCK,1);
localtime
().
" [$$] Note: port $port is now open on interface $interface.\n"
if
$debug
;
while
(1) {
my
$remote_paddr
=
accept
(
my
$remote_socket
, SERVER_SOCK);
if
(!
defined
(
my
$pid
=
fork
)) {
die
"cannot fork: $!"
;
t/fake-mysql view on Meta::CPAN
374375376377378379380381382383384$myserver
->sendOK();
while
(1) {
my
(
$command
,
$query
) =
$myserver
->readCommand();
localtime
().
" [$$] command: $command; data = $query\n"
if
$debug
;
last
if
(not
defined
$command
) || (
$command
== DBIx::MyServer::COM_QUIT);
my
$outgoing_query
=
$query
;
foreach
my
$i
(0..
$#rules
) {
t/fake-mysql view on Meta::CPAN
402403404405406407408409410411
if
(
ref
(
$rule
->{match_string}) eq
'Regexp'
) {
$rule_matches
= 1
if
@placeholders
=
$query
=~
$rule
->{match};
}
else
{
$rule_matches
= 1
if
$query
eq
$rule
->{match_string};
}
localtime
().
" [$$] Executing 'match' from rule $i: $rule->{match_string}, result is $rule_matches.\n"
if
$debug
;
}
else
{
$rule_matches
= 1;
}
$rule
->{placeholders} = \
@placeholders
;
t/fake-mysql view on Meta::CPAN
415416417418419420421422423424425my
(
$definitions
,
$data
);
undef
$storage
{data_sent};
if
(
defined
$rule
->{
before
}) {
localtime
().
" [$$] Executing 'before' from rule $i\n"
if
$debug
;
eval
{
$rule
->{
before
}(
$query
, @{
$rule
->{placeholders}});
};
error($@)
if
defined
$@ && $@ ne
''
;
}
t/fake-mysql view on Meta::CPAN
428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
if
(
ref
(
$rule
->{rewrite}) eq
'CODE'
) {
$outgoing_query
=
$rule
->{rewrite}(
$query
, @{
$rule
->{placeholders}});
}
else
{
$outgoing_query
=
$rule
->{rewrite};
}
localtime
().
" [$$] Executing 'rewrite' from rule $i, result is '$outgoing_query'\n"
if
$debug
;
}
elsif
(
defined
$rule
->{match}) {
$outgoing_query
=
$rule
->{match_string} eq
'Regexp'
?
$rule
->{placeholders}->[0] :
$outgoing_query
;
}
if
(
defined
$rule
->{error}) {
my
@error
=
ref
(
$rule
->{error}) eq
'CODE'
?
$rule
->{error}(
$query
, @{
$rule
->{placeholders}}) :
$rule
->{error};
my
@mid_error
=
ref
(
$error
[0]) eq
'ARRAY'
? @{
$error
[0]} :
@error
;
if
(
defined
$mid_error
[0]) {
localtime
().
" [$$] Sending error: "
.
join
(
', '
,
@mid_error
).
".\n"
if
$debug
;
error(
@mid_error
);
}
}
if
(
defined
$rule
->{ok}) {
my
@ok
=
ref
(
$rule
->{ok}) eq
'CODE'
?
$rule
->{ok}(
$query
, @{
$rule
->{placeholders}}) :
$rule
->{ok};
my
@mid_ok
=
ref
(
$ok
[0]) eq
'ARRAY'
? @{
$ok
[0]} :
@ok
;
if
(
defined
$mid_ok
[0]) {
localtime
().
" [$$] Sending OK: "
.
join
(
', '
,
@mid_ok
).
").\n"
if
$debug
;
ok(
@mid_ok
);
}
}
if
(
defined
$rule
->{columns}) {
t/fake-mysql view on Meta::CPAN
461462463464465466467468469470471472473474475476477478479480481482483
}
elsif
(
ref
(
$column_names
[0]) eq
'ARRAY'
) {
$column_names
=
$column_names
[0];
}
elsif
(
defined
$column_names
[0]) {
$column_names
= [
$column_names
[0] ];
}
localtime
().
" [$$] Converting column_names into definitions.\n"
if
$debug
;
$definitions
= [
map
{
$myserver
->newDefinition(
name
=>
$_
) }
@$column_names
];
}
if
(
defined
$rule
->{data}) {
my
@start_data
=
ref
(
$rule
->{data}) eq
'CODE'
?
$rule
->{data}(
$query
, @{
$rule
->{placeholders}}) :
$rule
->{data};
my
$mid_data
=
defined
$start_data
[1] ? \
@start_data
:
$start_data
[0];
if
(
ref
(
$mid_data
) eq
'HASH'
) {
localtime
().
" [$$] Converting data from hash.\n"
if
$debug
;
$data
= [
map
{ [
$_
,
$mid_data
->{
$_
} ] }
sort
keys
%$mid_data
];
}
elsif
((
ref
(
$mid_data
) eq
'ARRAY'
) && (
ref
(
$mid_data
->[0]) ne
'ARRAY'
)) {
localtime
().
" [$$] Converting data from a flat array.\n"
if
$debug
;
$data
= [
map
{ [
$_
] }
@$mid_data
];
}
elsif
(
ref
(
$mid_data
) eq
''
) {
$data
= [ [
$mid_data
] ];
}
else
{
$data
=
$mid_data
;
t/fake-mysql view on Meta::CPAN
490491492493494495496497498499500501502503) {
if
(
defined
$rule
->{dbh}) {
$myserver
->setDbh(
$rule
->{dbh});
}
elsif
(
defined
$rule
->{dsn}) {
if
(
ref
(
$rule
->{dsn}) eq
'ARRAY'
) {
localtime
().
" [$$] Connecting to DSN $rule->{dsn}->[0].\n"
if
$debug
;
$myserver
->setDbh(DBI->
connect
(@{
$rule
->{dsn}}));
}
else
{
localtime
().
" [$$] Connecting to DSN $rule->{dsn}.\n"
if
$debug
;
$myserver
->setDbh(DBI->
connect
(
$rule
->{dsn}, get(
'dsn_user'
), get(
'dsn_password'
)));
}
}
if
(not
defined
get(
'dbh'
)) {
error(
"No --dbh specified. Can not forward query."
,1235, 42000);
t/fake-mysql view on Meta::CPAN
view all matches for this distribution
510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
}
$storage
{data_sent} = 1;
}
if
(
defined
$definitions
) {
localtime
().
" [$$] Sending definitions.\n"
if
$debug
;
$myserver
->sendDefinitions(
$definitions
);
$storage
{data_sent} = 1;
}
if
(
defined
$data
) {
localtime
().
" [$$] Sending data.\n"
if
$debug
;
$myserver
->sendRows(
$data
);
$storage
{data_sent} = 1;
}
if
(
defined
$rule
->{
after
}) {
localtime
().
" [$$] Executing 'after' for rule $i\n"
if
$debug
;
$rule
->{
after
}(
$query
, @{
$rule
->{placeholders}})
}
last
if
defined
$storage
{data_sent};
}
}
localtime
().
" [$$] Exit.\n"
if
$debug
;
exit
;
}
sub
set {
my
(
$name
,
$value
) =
@_
;
$storage
{
$name
} =
$value
;
if
(
$name
eq
'dsn'
) {
if
(
defined
$value
) {
my
$dbh
;
if
(
ref
(
$value
) eq
'ARRAY'
) {
localtime
().
" [$$] Connecting to DSN $value->[0].\n"
if
$debug
;
$dbh
= DBI->
connect
(@{
$value
});
}
else
{
localtime
().
" [$$] Connecting to DSN $value.\n"
if
$debug
;
$dbh
= DBI->
connect
(
$value
, get(
'dsn_user'
), get(
'dsn_password'
));
}
$storage
{myserver}->setDbh(
$dbh
);
$storage
{dbh} =
$dbh
;
}
else
{
view release on metacpan or search on metacpan
lib/AnyEvent/DateTime/Cron.pm view on Meta::CPAN
2223242526272829303132$params
{quartz} = 0
unless
defined
$params
{quartz};
return
bless
{
_jobs
=> {},
_debug
=> 0,
_id
=> 0,
_running
=> 0,
_time_zone
=>
$params
{time_zone},
_quartz
=>
$params
{quartz},
},
$class
;
lib/AnyEvent/DateTime/Cron.pm view on Meta::CPAN
83848586878889909192939495969798
my
$self
=
shift
;
my
@ids
=
ref
$_
[0] eq
'ARRAY'
? @{
$_
[0] } :
@_
;
for
(
@ids
) {
STDERR
"Deleting job '$_'\n"
if
$self
->{_debug};
if
(
my
$job
=
delete
$self
->{_jobs}{
$_
} ) {
$job
->{watchers} = {};
}
elsif
(
$self
->{_debug} ) {
STDERR
"Job '$_' not found\n"
;
}
}
return
$self
;
}
lib/AnyEvent/DateTime/Cron.pm view on Meta::CPAN
106107108109110111112113114115116$cv
->begin(
sub
{
$self
->stop } );
$self
->{_signal} = AnyEvent->signal(
signal
=>
'TERM'
,
cb
=>
sub
{
STDERR
"Shutting down\n"
if
$self
->{_debug};
$cv
->end;
}
);
$self
->{_running} = 1;
$self
->_schedule(
values
%{
$self
->{_jobs} } );
lib/AnyEvent/DateTime/Cron.pm view on Meta::CPAN
140141142143144145146147148149150my
$time_zone
=
$self
->{_time_zone};
AnyEvent->now_update();
my
$now_epoch
= AnyEvent->now;
my
$now
= DateTime->from_epoch(
epoch
=>
$now_epoch
);
my
$debug
=
$self
->{_debug};
$now
->set_time_zone(
$time_zone
)
if
$time_zone
;
for
my
$job
(
@_
) {
my
$name
=
$job
->{name};
lib/AnyEvent/DateTime/Cron.pm view on Meta::CPAN
161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190my
$next_epoch
=
$next_run
->epoch;
my
$delay
=
$next_epoch
-
$now_epoch
;
STDERR
"Scheduling job '$name' for: $next_run\n"
if
$debug
;
my
$run_event
=
sub
{
STDERR
"Starting job '$name'\n"
if
$debug
;
$self
->{_cv}->begin;
delete
$job
->{watchers}{
$next_epoch
};
$self
->_schedule(
$job
);
if
(
$job
->{single} &&
$job
->{running}++ ) {
STDERR
"Skipping job '$name' - still running\n"
if
$debug
;
}
else
{
eval
{
$job
->{cb}->(
$self
->{_cv},
$job
); 1 }
or
warn
$@ ||
'Unknown error'
;
delete
$job
->{running};
STDERR
"Finished job '$name'\n"
if
$debug
;
}
$self
->{_cv}->end;
};
lib/AnyEvent/DateTime/Cron.pm view on Meta::CPAN
195196197198199200201202203204205206207208
);
}
}
#===================================
sub
debug {
#===================================
my
$self
=
shift
;
$self
->{_debug} =
shift
if
@_
;
return
$self
;
}
#===================================
sub
jobs {
shift
->{_jobs} }
lib/AnyEvent/DateTime/Cron.pm view on Meta::CPAN
231232233234235236237238239240241
)
->start
->
recv
$cron
= AnyEvent::DateTime::Cron->new();
$cron
->debug(1)->add(
'* * * * *'
,
name
=>
'job_name'
,
single
=> 1,
sub
{
'foo'
},
...
);
$cron
->
delete
(
$job_id
,
$job_id
...)
lib/AnyEvent/DateTime/Cron.pm view on Meta::CPAN
288289290291292293294295296297
);
Use C<add()> to add new cron jobs. It accepts a list of crontab entries,
optional paremeters and callbacks.
The C<name> parameter is useful
for
debugging, otherwise the auto-assigned
C<ID> is used instead.
The C<single> parameter,
if
C<true>, will only allow a single instance of
a job to run at any one
time
.
lib/AnyEvent/DateTime/Cron.pm view on Meta::CPAN
view all matches for this distribution
327328329330331332333334335336337338339340341
$job
=
$cron
->jobs
Returns a hashref containing all the current cron jobs.
=head2 debug()
$cron->debug(1|0)
Turn on debugging.
=head1 CALLBACKS
A callback is a coderef (eg an anonymous subroutine) which will be called
every time your job is triggered. Callbacks should use C<AnyEvent> themselves,
view release on metacpan or search on metacpan
lib/AnyEvent/Discord/Client.pm view on Meta::CPAN
1112131415161718192021use
URI;
use
HTTP::Request;
use
HTTP::Headers;
use
AnyEvent::HTTP;
my
$debug
= 0;
sub
new {
my
(
$class
,
%args
) =
@_
;
my
$self
= {
lib/AnyEvent/Discord/Client.pm view on Meta::CPAN
171172173174175176177178179180181die
"invalid message"
unless
ref
$msg
eq
'HASH'
&&
defined
$msg
->{op};
$self
->{last_seq} = 0+
$msg
->{s}
if
defined
$msg
->{s};
if
(
$msg
->{op} == 0) {
#dispatch
"\e[1;30mdispatch event $msg->{t}:"
.Dumper(
$msg
->{d}).
"\e[0m\n"
if
$debug
;
$event_handler
{
$msg
->{t}}(
$self
,
$msg
->{d})
if
$event_handler
{
$msg
->{t}};
}
elsif
(
$msg
->{op} == 10) {
#hello
$self
->{heartbeat_timer} = AnyEvent->timer(
after
=>
$msg
->{d}{heartbeat_interval}/1e3,
interval
=>
$msg
->{d}{heartbeat_interval}/1e3,
lib/AnyEvent/Discord/Client.pm view on Meta::CPAN
view all matches for this distribution
184185186187188189190191192193194
},
);
}
elsif
(
$msg
->{op} == 11) {
#heartbeat ack
# ignore for now; eventually, notice missing ack and reconnect
}
else
{
"\e[1;30mnon-event message op=$msg->{op}:"
.Dumper(
$msg
).
"\e[0m\n"
if
$debug
;
}
});
$self
->{conn}->on(
parse_error
=>
sub
{
my
(
$connection
,
$error
) =
@_
;
view release on metacpan or search on metacpan
lib/AnyEvent/Discord.pm view on Meta::CPAN
5354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
};
}
method on(Str
$event_type
, CodeRef
$handler
) {
$event_type
=
lc
(
$event_type
);
$self
->_debug(
'Requesting attach of handler '
.
$handler
.
' to event '
.
$event_type
);
$self
->_events->{
$event_type
} //= [];
return
if
(
scalar
(
grep
{
$_
eq
$handler
} @{
$self
->_events->{
$event_type
}}) > 0);
$self
->_debug(
'Attaching handler '
.
$handler
.
' to event '
.
$event_type
);
push
( @{
$self
->_events->{
$event_type
}},
$handler
);
}
method off(Str
$event_type
, CodeRef
$handler
?) {
$event_type
=
lc
(
$event_type
);
$self
->_debug(
'Requesting detach of handler '
. (
$handler
or
'n/a'
) .
' from event '
.
$event_type
);
if
(
$self
->_events->{
$event_type
}) {
if
(
$handler
) {
my
$index
= 0;
while
(
$index
<
scalar
(@{
$self
->_events->{
$event_type
}})) {
if
(
$self
->_events->{
$event_type
}->[
$index
] eq
$handler
) {
$self
->_debug(
'Detaching handler '
.
$handler
.
' from event '
.
$event_type
);
splice
( @{
$self
->_events->{
$event_type
}},
$index
, 1 );
}
$index
++;
}
}
else
{
$self
->_debug(
'Detaching '
.
scalar
(@{
$self
->_events->{
$event_type
}}) .
' handler(s) from event '
.
$event_type
);
delete
(
$self
->_events->{
$event_type
});
}
}
}
method
connect
() {
my
$gateway
=
$self
->_lookup_gateway();
$self
->_debug(
'Connecting to '
.
$gateway
);
my
$ws
= AnyEvent::WebSocket::Client->new(
$self
->socket_options);
$ws
->
connect
(
$gateway
)->cb(
sub
{
my
$socket
=
eval
{
shift
->
recv
};
if
($@) {
$self
->_debug(
'Received error connecting: '
. $@);
$self
->_handle_internal_event(
'error'
, $@);
return
;
}
$self
->_debug(
'Connected to '
.
$gateway
);
$self
->_socket(
$socket
);
# If we send malformed content, bail out
$socket
->on(
'parse_error'
,
sub
{
my
(
$c
,
$error
) =
@_
;
$self
->_debug(Data::Dumper::Dumper(
$error
));
die
$error
;
});
# Handle reconnection
$socket
->on(
'finish'
,
sub
{
my
(
$c
) =
@_
;
$self
->_debug(
'Received disconnect'
);
$self
->_handle_internal_event(
'disconnected'
);
unless
(
$self
->_force_disconnect()) {
my
$seconds
=
$self
->_backoff->failure();
$self
->_debug(
'Reconnecting in '
.
$seconds
);
my
$reconnect
;
$reconnect
= AnyEvent->timer(
after
=>
$seconds
,
cb
=>
sub
{
$self
->
connect
();
lib/AnyEvent/Discord.pm view on Meta::CPAN
134135136137138139140141142143144145146147148$self
->_trace(
'ws in: '
.
$message
->{
'body'
});
my
$payload
;
try
{
$payload
= AnyEvent::Discord::Payload->from_json(
$message
->{
'body'
});
}
catch
{
$self
->_debug(
$_
);
return
;
};
unless
(
$payload
and
defined
$payload
->op) {
$self
->_debug(
'Invalid payload received from Discord: '
.
$message
->{
'body'
});
return
;
}
$self
->_sequence(0 +
$payload
->s)
if
(
$payload
->s and
$payload
->s > 0);
if
(
$payload
->op == 10) {
lib/AnyEvent/Discord.pm view on Meta::CPAN
155156157158159160161162163164
$self
->_handle_event(
$payload
);
}
});
$self
->_discord_identify();
$self
->_debug(
'Completed connection sequence'
);
$self
->_backoff->success();
AnyEvent->condvar->
send
();
});
}
lib/AnyEvent/Discord.pm view on Meta::CPAN
211212213214215216217218219220221
return
;
}
# Send the 'identify' event to the Discord websocket
method _discord_identify() {
$self
->_debug(
'Sending identify'
);
$self
->_ws_send_payload(AnyEvent::Discord::Payload->from_hashref({
op
=> 2,
d
=> {
token
=>
$self
->token,
compress
=> JSON::false,
lib/AnyEvent/Discord.pm view on Meta::CPAN
231232233234235236237238239240241}
# Send a payload to the Discord websocket
method _ws_send_payload(AnyEvent::Discord::Payload
$payload
) {
unless
(
$self
->_socket) {
$self
->_debug(
'Attempted to send payload to disconnected socket'
);
return
;
}
my
$msg
=
$payload
->as_json;
$self
->_trace(
'ws out: '
.
$msg
);
$self
->_socket->
send
(
$msg
);
lib/AnyEvent/Discord.pm view on Meta::CPAN
256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305# Dispatch an internal event type
method _handle_internal_event(Str
$type
) {
foreach
my
$event_source
(
qw(_internal_events _events)
) {
if
(
$self
->{
$event_source
}->{
$type
}) {
map
{
$self
->_debug(
'Sending '
. (
$event_source
=~ /internal/ ?
'internal'
:
'caller'
) .
' event '
.
$type
);
$_
->(
$self
);
} @{
$self
->{
$event_source
}->{
$type
} };
}
}
}
# Dispatch a Discord event type
method _handle_event(AnyEvent::Discord::Payload
$payload
) {
my
$type
=
lc
(
$payload
->t);
$self
->_debug(
'Got event '
.
$type
);
foreach
my
$event_source
(
qw(_internal_events _events)
) {
if
(
$self
->{
$event_source
}->{
$type
}) {
map
{
$self
->_debug(
'Sending '
. (
$event_source
=~ /internal/ ?
'internal'
:
'caller'
) .
' event '
.
$type
);
$_
->(
$self
,
$payload
->d,
$payload
->op);
} @{
$self
->{
$event_source
}->{
$type
} };
}
}
}
# Send debug messages to console if verbose is >=1
method _debug(Str
$message
) {
say
time
.
' '
.
$message
if
(
$self
->verbose);
}
# Send trace messages to console if verbose is 2
method _trace(Str
$message
) {
say
time
.
' '
.
$message
if
(
$self
->verbose and
$self
->verbose == 2);
}
# Called when Discord provides the 'hello' event
method _event_hello(AnyEvent::Discord::Payload
$payload
) {
$self
->_debug(
'Received hello event'
);
my
$interval
=
$payload
->d->{
'heartbeat_interval'
};
my
$timer
= AnyEvent->timer(
after
=>
$interval
*
rand
() / 1000,
interval
=>
$interval
/ 1000,
cb
=>
sub
{
$self
->_debug(
'Heartbeat'
);
$self
->_ws_send_payload(AnyEvent::Discord::Payload->from_hashref({
op
=> 1,
d
=>
$self
->_sequence()
}));
AnyEvent->condvar->
send
();
lib/AnyEvent/Discord.pm view on Meta::CPAN
view all matches for this distribution
400401402403404405406407408409410Used to
override
options to sent to AnyEvent::WebSocket::Client,
if
needed.
=item verbose (Num) (defaults to 0)
Verbose output, writes internal debug information at 1, additionally writes
network conversation at 2.
=back
=head1 DATA ACCESSORS
view release on metacpan or search on metacpan
lib/AnyEvent/EC2/Tiny.pm view on Meta::CPAN
view all matches for this distribution
7980818283848586878889my
$ec2
= AnyEvent::EC2::Tiny->new(
AWSAccessKey
=>
$ENV
{
'AWS_ACCESS_KEY'
},
AWSSecretKey
=>
$ENV
{
'AWS_SECRET_KEY'
},
region
=>
$ENV
{
'AWS_REGION'
},
debug
=> 1,
);
# We are essentially encoding 'raw' EC2 API calls with a v2
# signature and turning XML responses into Perl data structures
my
$xml
=
$ec2
->
send
(
view release on metacpan or search on metacpan
lib/AnyEvent/eris/Server.pm view on Meta::CPAN
78910111213141516use
Sys::Hostname;
use
AnyEvent::Handle;
use
AnyEvent::Socket;
use
AnyEvent::Graphite;
my
@_STREAM_NAMES
=
qw(subscription match debug full regex)
;
my
%_STREAM_ASSISTERS
= (
subscription
=>
'programs'
,
match
=>
'words'
,
);
lib/AnyEvent/eris/Server.pm view on Meta::CPAN
2122232425262728293031);
sub
_server_error {
my
(
$self
,
$err_str
,
$fatal
) =
@_
;
my
$err_num
= $!+0;
AE::
log
debug
=>
"SERVER ERROR: $err_num, $err_str"
;
$fatal
and
$self
->{
'_cv'
}->
send
;
}
my
%client_commands
= (
lib/AnyEvent/eris/Server.pm view on Meta::CPAN
3334353637383940414243nofullfeed
=>
qr{^nofull(feed)?}
,
subscribe
=>
qr{^sub(?:scribe)?\s(.*)}
,
unsubscribe
=>
qr{^unsub(?:scribe)?\s(.*)}
,
match
=>
qr{^match (.*)}
,
nomatch
=>
qr{^nomatch (.*)}
,
debug
=>
qr{^debug}
,
nobug
=>
qr{^no(de)?bug}
,
regex
=>
qr{^re(?:gex)?\s(.*)}
,
noregex
=>
qr{^nore(gex)?}
,
status
=>
qr{^status}
,
dump
=>
qr{^dump\s(\S+)}
,
lib/AnyEvent/eris/Server.pm view on Meta::CPAN
142143144145146147148149150151152153154155156157158159160161162163164165
join
(
', '
,
@words
) .
"\n"
);
}
sub
handle_debug {
my
(
$self
,
$handle
,
$SID
) =
@_
;
$self
->remove_stream(
$SID
,
'full'
);
$self
->clients->{
$SID
}{
'debug'
} = 1;
$handle
->push_write(
"Debugging enabled.\n"
);
}
sub
handle_nobug {
my
(
$self
,
$handle
,
$SID
) =
@_
;
$self
->remove_stream(
$SID
,
'debug'
);
delete
$self
->clients->{
$SID
}{
'debug'
};
$handle
->push_write(
"Debugging disabled.\n"
);
}
sub
handle_regex {
my
(
$self
,
$handle
,
$SID
,
$args
) =
@_
;
lib/AnyEvent/eris/Server.pm view on Meta::CPAN
292293294295296297298299300301302303304305306307}
sub
hangup_client {
my
(
$self
,
$SID
) =
@_
;
delete
$self
->clients->{
$SID
};
AE::
log
debug
=>
"Client Termination Posted: $SID"
;
}
sub
remove_stream {
my
(
$self
,
$SID
,
$stream
) =
@_
;
AE::
log
debug
=>
"Removing '$stream' for $SID"
;
my
$client_streams
=
delete
$self
->clients->{
$SID
}{
'streams'
}{
$stream
};
# FIXME:
# I *think* what this is supposed to do is delete assists
lib/AnyEvent/eris/Server.pm view on Meta::CPAN
361362363364365366367368369370371on_eof
=>
sub
{
my
(
$hdl
) =
@_
;
my
$SID
=
$inner_self
->_session_id(
$hdl
);
$inner_self
->hangup_client(
$SID
);
$hdl
->destroy;
AE::
log
debug
=>
"SERVER, client $SID disconnected."
;
},
on_read
=>
sub
{
my
(
$hdl
) =
@_
;
chomp
(
my
$line
=
delete
$hdl
->{
'rbuf'
} );
lib/AnyEvent/eris/Server.pm view on Meta::CPAN
430431432433434435436437438439440
);
1;
} or
do
{
my
$error
= $@ ||
'Zombie error'
;
AE::
log
debug
=>
"Graphite server setup failed: $error"
;
}
}
sub
stats {
my
$self
=
shift
;
lib/AnyEvent/eris/Server.pm view on Meta::CPAN
view all matches for this distribution
460461462463464465466467468469470471472473474475476477
eval
{
$self
->{
'_graphite'
}->
send
(
$metric
,
$stats
->{
$stat
},
$time
);
1;
} or
do
{
my
$error
= $@ ||
'Zombie error'
;
AE::
log
debug
=>
'Error sending statistics, reconnecting.'
;
$self
->graphite_connect;
last
;
}
}
}
AE::
log
debug
=>
'STATS: '
.
join
', '
,
map
"$_:$stats->{$_}"
,
keys
%{
$stats
};
}
sub
run {
my
$self
=
shift
;
view release on metacpan or search on metacpan
example/fget.pl view on Meta::CPAN
10111213141516171819202122232425use
Term::ProgressBar;
my
$debug
= 0;
my
$progress
= 0;
my
$active
= 0;
GetOptions(
'd'
=> \
$debug
,
'p'
=> \
$progress
,
'a'
=> \
$active
,
);
my
$remote
=
shift
;
example/fget.pl view on Meta::CPAN
view all matches for this distribution
697071727374757677787980818283$ftp
->on_send(
sub
{
my
(
$cmd
,
$arguments
) =
@_
;
$arguments
//=
''
;
$arguments
=
'XXXX'
if
$cmd
eq
'PASS'
;
say
"CLIENT: $cmd $arguments"
if
$debug
;
});
$ftp
->on_each_response(
sub
{
my
$res
=
shift
;
if
(
$debug
)
{
say
sprintf
"SERVER: [ %d ] %s"
,
$res
->code,
$_
for
@{
$res
->message };
}
});
view release on metacpan or search on metacpan
inc/Spiffy.pm view on Meta::CPAN
view all matches for this distribution
5051525354555657585960no
warnings;
my
$self_package
=
shift
;
# XXX Using parse_arguments here might cause confusion, because the
# subclass's boolean_arguments and paired_arguments can conflict, causing
# difficult debugging. Consider using something truly local.
my
(
$args
,
@export_list
) =
do
{
local
*boolean_arguments
=
sub
{
qw(
-base -Base -mixin -selfless
-XXX -dumper -yaml
view release on metacpan or search on metacpan
inc/Spiffy.pm view on Meta::CPAN
view all matches for this distribution
5758596061626364656667no
warnings;
my
$self_package
=
shift
;
# XXX Using parse_arguments here might cause confusion, because the
# subclass's boolean_arguments and paired_arguments can conflict, causing
# difficult debugging. Consider using something truly local.
my
(
$args
,
@export_list
) =
do
{
local
*boolean_arguments
=
sub
{
qw(
-base -Base -mixin -selfless
-XXX -dumper -yaml
view release on metacpan or search on metacpan
inc/Spiffy.pm view on Meta::CPAN
view all matches for this distribution
5051525354555657585960no
warnings;
my
$self_package
=
shift
;
# XXX Using parse_arguments here might cause confusion, because the
# subclass's boolean_arguments and paired_arguments can conflict, causing
# difficult debugging. Consider using something truly local.
my
(
$args
,
@export_list
) =
do
{
local
*boolean_arguments
=
sub
{
qw(
-base -Base -mixin -selfless
-XXX -dumper -yaml
view release on metacpan or search on metacpan
lib/AnyEvent/GnuPG.pm view on Meta::CPAN
113114115116117118119120121122123124125126127128129130131my
$commands
;
$self
->{status_fd}->readlines_cb(
sub
{
my
$line
=
shift
;
unless
(
defined
$line
) {
AE::
log
debug
=>
"end of status parsing"
;
$cv
->
send
(
$commands
);
}
if
(
my
(
$cmd
,
$arg
) =
$line
=~ m{^\[gnupg:\]\s+(\w+)\s*(.+)?\s*$}i )
{
$arg
||=
''
;
my
@args
=
$arg
? (
split
/\s+/,
$arg
) : ();
AE::
log
debug
=>
"got command: $cmd ($arg)"
;
try
{
for
(
lc
$cmd
) {
_eq(
'newsig'
) &&
do
{
last
};
_eq(
'goodsig'
) &&
do
{
last
};
_eq(
'expsig'
)
lib/AnyEvent/GnuPG.pm view on Meta::CPAN
319320321322323324325326327328329
catch
{
s{\s+$}{};
$self
->_abort_gnupg(
$_
,
$cv
);
}
finally
{
AE::
log
debug
=>
"arguments parsed as: ["
. (
join
', '
,
map
{
"'$_'"
}
@args
) .
"]"
;
}
}
else
{
return
$self
->_abort_gnupg(
lib/AnyEvent/GnuPG.pm view on Meta::CPAN
341342343344345346347348349350351352353354AE::
log
error
=>
$msg
if
$msg
;
if
(
$self
->{gnupg_proc} ) {
$self
->{gnupg_proc}->fire_and_kill(
10,
sub
{
AE::
log
debug
=>
"fired and killed"
;
$self
->_end_gnupg(
sub
{
AE::
log
debug
=>
"gnupg aborted"
;
$cv
->croak(
$msg
);
}
);
}
);
lib/AnyEvent/GnuPG.pm view on Meta::CPAN
385386387388389390391392393394395
)
{
delete
$self
->{
$_
};
}
AE::
log
debug
=>
"gnupg exited"
;
$cv
->
send
;
}
);
}
lib/AnyEvent/GnuPG.pm view on Meta::CPAN
426427428429430431432433434435436unshift
@$cmdline
,
'--status-fd'
=>
$status
;
unshift
@$cmdline
,
'--command-fd'
=>
$command
;
my
$err
;
AE::
log
debug
=>
"running $gpg "
.
join
(
' '
=>
@$cmdline
);
my
$proc
= AnyEvent::Proc->new(
bin
=>
$gpg
,
args
=>
$cmdline
,
extras
=> [
$status
,
$command
],
ttl
=> 600,
lib/AnyEvent/GnuPG.pm view on Meta::CPAN
view all matches for this distribution
448449450451452453454455456457458
$self
->{command_fd} =
$command
;
$self
->{status_fd} =
$status
;
$self
->{gnupg_proc} =
$proc
;
AE::
log
debug
=>
"gnupg ready"
;
$proc
;
}
sub
_send_command {