This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> (* + 5) + (* + 6) | |
# 0.returns: Whatever | |
# 1.returns: Int | |
# body arity: | |
# sig arity: 1 | |
# result arity: 1 | |
# [0].returns: WhateverCode | |
# 0.returns: Whatever | |
# 1.returns: Int | |
# body arity: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elsif $upto_arity == 2 && $past[0].returns eq 'WhateverCode' && $past[1].returns eq 'WhateverCode' { | |
pir::say("# wc(" ~ $past[0].arity ~ ") + wc(" ~ $past[1].arity ~ ")"); | |
my $left := $past[0].shift; | |
my $left_arity := $left.arity; | |
my $right := $past[1].shift; | |
my $right_arity := $right.arity; | |
my $total_arity := $left_arity + $right_arity; | |
pir::say("# left_arity: " ~ $left_arity ~ ", right_arity: " ~ $right_arity); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> t/00_compile.t ............ ok | |
It compiles, yay! | |
> t/cmd.t ................... Failed to eval 't/service/sleeping-daemon': The 'user' parameter (undef) to | |
> Ubic::Service::SimpleDaemon::new was an 'undef', which is not one of the all | |
This is because I used $ENV{LOGNAME} as test services user. | |
You should replace it with windows equivalent or write some switch, I think... | |
Ubic::Service::SimpleDaemon->new({ | |
bin => \'sleep 100\', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Ubic::Credentials; | |
my $current_cr = Ubic::Credentials->current; | |
my $service_cr = $service->credentials; # or maybe to avoid adding one more method to Ubic::Service interface, Ubic->credentials($service_name) | |
$guard = $service_cr->effective_guard; # guard | |
... # write status file | |
undef $guard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/Perl/PrereqScanner.pm b/lib/Perl/PrereqScanner.pm | |
index 1c1a81e..55e2570 100644 | |
--- a/lib/Perl/PrereqScanner.pm | |
+++ b/lib/Perl/PrereqScanner.pm | |
@@ -60,6 +60,7 @@ Version::Requirements object describing the modules it requires. | |
sub scan_string { | |
my ($self, $str) = @_; | |
my $ppi = PPI::Document->new( \$str ); | |
+ return Version::Requirements->new unless defined $ppi; | |
return $self->scan_ppi_document( $ppi ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Changes b/Changes | |
index f25ec46..bc3ad3e 100644 | |
--- a/Changes | |
+++ b/Changes | |
@@ -1,6 +1,7 @@ | |
Revision history for Perl-PrereqScanner | |
{{$NEXT}} | |
+ - throw an exception if PPI fails to parse code | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Framework::Query; | |
use Moose; | |
has str => (is => "ro", required => 1); | |
package Framework::Types; | |
use MooseX::Types -declare => [qw( Query )]; | |
class_type Query, { class => "Framework::Query" }; | |
package Framework; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I've found this problem initially by using Coro with XML::LibXML; | |
# XML::LibXML::Error object on large invalid documents can contain lots of nested objects | |
sub more_nesting { | |
return bless { x => shift } => "A" | |
} | |
sub build_deep { | |
my $depth = shift; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./perl -e 'sub more_nesting { return bless { x => shift } => "A" }; sub build_deep { my $x; $x = more_nesting($x) for 1..shift(); return $x; } sub f { my $x = build_deep(shift @ARGV); undef $x } f()' 400000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim: ft=perl | |
# this is ~/ubic/service/daxim-example | |
use strict; | |
use warnings; | |
use autodie; | |
use parent qw(Ubic::Service::SimpleDaemon); |
OlderNewer