Skip to content

Instantly share code, notes, and snippets.

> (* + 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:
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);
> 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\',
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;
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 );
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
@berekuk
berekuk / test.pl
Created December 27, 2010 20:29
MX::Types caveat
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;
# 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;
./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
@berekuk
berekuk / daxim-example
Created May 26, 2011 11:31
ubic restart on code update
# vim: ft=perl
# this is ~/ubic/service/daxim-example
use strict;
use warnings;
use autodie;
use parent qw(Ubic::Service::SimpleDaemon);