view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
sub _version ($) {
my $s = shift || 0;
$s =~ s/^(\d+)\.?//;
my $l = $1 || 0;
my @v = map { $_ . '0' x (3 - length $_) } $s =~ /(\d{1,3})\D?/g;
$l = $l . '.' . join '', @v if @v;
return $l + 0;
}
# Cloned from Params::Util::_CLASS
view all matches for this distribution
view release on metacpan or search on metacpan
eg/xchat-laugh.pl view on Meta::CPAN
# and put this into your $HOME/.xchat2 directory.
#
# It will add a /laugh command that supports the following variants:
#
# /laugh # just generate a random laugh
# /laugh 50 # use 50 chunks of laugh, real length varies
# /laugh somenick # laugh at somenick
# /laugh somenick 50 # a combination of the two
#
use strict;
use Acme::Laugh qw(laugh);
Xchat::register("laugh", "1.1", "", "");
Xchat::print ("laugh 1.1 loaded.");
Xchat::print ("Usage /laugh [<nick>] [length]");
Xchat::hook_command ("laugh", sub {
my ($command, $nick, $chunks) = @{$_[0]};
if ($nick =~ /\A \d+ \z/xms) {
$chunks = $nick;
$nick = '';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Lexical/Thief.pm view on Meta::CPAN
my $depth = 0;
if ($$ref =~ /^((?: 0x[0-9A-F]+ | 0b[0-1]+ | 0[0-7]* | [1-9][0-9]* )\s*)/ixs)
{
$depth = eval $1;
substr($$ref, 0, length $1) = '';
}
my $extracted;
if ($$ref =~ /^\(/)
{
view all matches for this distribution
view release on metacpan or search on metacpan
use Test::More 'no_plan';
use Acme::LifeUniverseEverything;
my $zero = 0;
ok( length overload::Overloaded($zero), "Constant binary overloaded" );
my $ten = 10;
ok( length overload::Overloaded(10), "Constant int overloaded" );
ok( "$ten" eq "10", "Stringification" );
ok( length overload::Overloaded(10*5), "Multiplication overloaded" );
ok( (10*5)==50, "Multiplication correct" );
ok( length overload::Overloaded(10+5), "Addition overloaded" );
ok( (10+5)==15, "Addition correct" );
ok( length overload::Overloaded(10-5), "Subtraction overloaded" );
ok( (10-5)==5, "Subtraction correct" );
ok( length overload::Overloaded(10/5), "Division overloaded" );
ok( (10/5)==2, "Division correct" );
ok( length overload::Overloaded(-$ten), "Unary negation overloaded" );
ok( (-$ten)==-10, "Unary negation correct" );
ok( 10>5, "Comparison < correct" );
ok( 5<10, "Comparison > correct" );
ok( (10<=>5)>0, "Spaceship <=> correct" );
my $x = 10;
$x++;
ok( length overload::Overloaded($x), "Increment overloaded" );
ok( $x==11, "Increment correct" );
$x--;
ok( length overload::Overloaded($x), "Decrement overloaded" );
ok( $x==10, "Decrement correct" );
ok( length overload::Overloaded(abs(-10)), "abs() overloaded" );
ok( abs(-10)==10, "abs() correct" );
ok( 42==6*9, "6 * 9 fixed" );
view all matches for this distribution
view release on metacpan or search on metacpan
t/00-report-prereqs.t view on Meta::CPAN
}
if ( @reports ) {
push @full_reports, "=== $title ===\n\n";
my $ml = _max( map { length $_->[0] } @reports );
my $wl = _max( map { length $_->[1] } @reports );
my $hl = _max( map { length $_->[2] } @reports );
if ($type eq 'modules') {
splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl];
push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Lingua/ZH/Remix.pm view on Meta::CPAN
}
=head2 random_sentence( min => $min, max => $max )
Instance method. Optionally takes "min" or "max" parameter as the constraint of
sentence length (number of characters).
Both min and max values are required to be integers greater or equal to
zero. The value of max should be greater then the value of min. If any of these
values are invalidate, it is treated as if they are not passed.
The default values of min, max are 0 and 140, respectively.
The implementation random algorthm based, thus it needs indefinite time to
generate the result. If it takes more then 1000 iterations, it aborts and return
the results anyway, regardless the length constraint. This can happen when the
lengths of phrases from corpus do no adds up to a value within the given range.
The returned scalar is the generate sentence string of wide characters. (Which
makes Encode::is_utf8 return true.)
=cut
lib/Acme/Lingua/ZH/Remix.pm view on Meta::CPAN
my $str = "";
my @phrases;
my $ending = $self->random_phrase(random(qw/ã ï¼ ï¼/)) || "â¦";
while ( length($ending) > $options{max} ) {
$ending = $self->random_phrase(random(qw/ã ï¼ ï¼/)) || "â¦";
}
unshift @phrases, $ending;
my $l = length($ending);
my $iterations = 0;
my $max_iterations = 1000;
my $average = ($options{min} + $options{max}) / 2;
my $desired = int(rand($options{max} - $options{min}) + $options{min}) || $average || $options{max};
lib/Acme/Lingua/ZH/Remix.pm view on Meta::CPAN
$x = random('ï¼', 'ã', 'ï¼', '/')
} while ($self->phrase_ratio($x) == 0);
my $p = $self->random_phrase($x);
if ($l + length($p) < $options{max}) {
unshift @phrases, $p;
$l += length($p);
}
my $r = abs(1 - $l/$desired);
last if $r < 0.1;
last if $r < 0.2 && $iterations >= $max_iterations/2;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/List/CarCdr.pm view on Meta::CPAN
# -*- Perl -*-
#
# c[ad]+r list-operation support for Perl, based on (car) and (cdr) and
# so forth of lisp fame, though with a limit of 704 as to the maximum
# length any such shenanigans.
#
# Run perldoc(1) on this file for additional documentation.
package Acme::List::CarCdr;
lib/Acme/List/CarCdr.pm view on Meta::CPAN
my $start = 0;
my $end;
my $delve = 0;
while ( $ops =~ m/\G([ad])(\1*)/cg ) {
my $op = $1;
my $len = length $2 || 0;
if ( $op eq 'a' ) {
if ( $len > 0 ) {
for my $i ( 1 .. $len ) {
if ( ref $ref->[$start] ne 'ARRAY' ) {
croak "$method: " . $ref->[$start] . " is not a list";
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/AutoInstall.pm view on Meta::CPAN
my $cwd = Cwd::cwd();
$Config = [];
my $maxlen = length(
(
sort { length($b) <=> length($a) }
grep { /^[^\-]/ }
map {
ref($_)
? ( ( ref($_) eq 'HASH' ) ? keys(%$_) : @{$_} )
: ''
view all matches for this distribution
view release on metacpan or search on metacpan
t/00-report-prereqs.t view on Meta::CPAN
}
if ( @reports ) {
push @full_reports, "=== $title ===\n\n";
my $ml = _max( map { length $_->[0] } @reports );
my $wl = _max( map { length $_->[1] } @reports );
my $hl = _max( map { length $_->[2] } @reports );
if ($type eq 'modules') {
splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl];
push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports;
}
view all matches for this distribution
view release on metacpan or search on metacpan
author/ja2kana.pl view on Meta::CPAN
s#/$##;
my @en = split '/';
my $ja = shift @en;
# next if length $ja <= 1;
next if $ja =~ /^\p{InKatakana}+$/;
next if $ja !~ /\p{InHiragana}|\p{InCJKUnifiedIdeographs}/;
next if $ja eq 'ãã';
next if $ja eq 'ãã';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Lvalue.pm view on Meta::CPAN
: undef
}
],
[exp => sub { log $_[0] }],
[hex => sub { sprintf '%x', $_[0] }],
[length =>
sub {
my ($n, $x) = @_;
my $l = length $x;
$n <= $l
? substr $x, 0, $n
: $x . "\0" x ($n - $l)
}
],
lib/Acme/Lvalue.pm view on Meta::CPAN
my $x;
sqrt($x) = 3; # $x == 9
hex($x) = 212; # $x eq "d4"
$x = 2;
length(sqrt($x)) = 5; # $x == 1.999396
=head1 DESCRIPTION
This module makes a number of perl builtins return lvalues, letting you assign
to them. This lets you do things like:
lib/Acme/Lvalue.pm view on Meta::CPAN
L<C<chr>|perlfunc/chr>,
L<C<cos>|perlfunc/cos>,
L<C<defined>|perlfunc/defined>,
L<C<exp>|perlfunc/exp>,
L<C<hex>|perlfunc/hex>,
L<C<length>|perlfunc/length>,
L<C<log>|perlfunc/log>,
L<C<oct>|perlfunc/oct>,
L<C<ord>|perlfunc/ord>,
L<C<quotemeta>|perlfunc/quotemeta>,
L<C<reverse>|perlfunc/reverse>,
view all matches for this distribution
view release on metacpan or search on metacpan
$tex .= pack "C", 0; # Outside of the dot, it's transparent.
}
}
}
$Tex_Pixels = OpenGL::Array->new_scalar(GL_UNSIGNED_BYTE,$tex,length($tex));
$Tex_Type = GL_RGBA8;
$Tex_Format = GL_RGBA;
$Tex_Size = GL_UNSIGNED_BYTE;
}
# But, for fun, let's make the text partially transparent too.
glColor4f(0.6,1.0,0.6,.75);
$buf = sprintf "TIME TO EXIT: %.1fs", $time_to_exit;
my $bufwidth = 6 * length $buf;
glRasterPos2i($Window_Width-4-$bufwidth,2); ourPrintString(GLUT_BITMAP_HELVETICA_12,$buf);
# Render our various display mode settings.
$buf = sprintf "Mode: %s", $TexModesStr[$Curr_TexMode];
glRasterPos2i(2,2); ourPrintString(GLUT_BITMAP_HELVETICA_12,$buf);
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Inline.pm view on Meta::CPAN
else {
$o->{CONFIG} = {(%{$o->{CONFIG}}, @config)};
}
$o->print_info if $o->{CONFIG}{PRINT_INFO};
unless ($o->{INLINE}{object_ready} or
not length $o->{INLINE}{ILSM_suffix}) {
$o->build();
$o->write_inl_file() unless $o->{CONFIG}{_INSTALL_};
}
if ($o->{INLINE}{ILSM_suffix} ne 'so' and
$o->{INLINE}{ILSM_suffix} ne 'dll' and
inc/Inline.pm view on Meta::CPAN
not $o->{CONFIG}{DIRECTORY}) {
croak M49_usage_unsafe(1) if ($< == 0 or $> == 0);
warn M49_usage_unsafe(0) if $^W;
}
if ($o->{CONFIG}{AUTONAME} == -1) {
$o->{CONFIG}{AUTONAME} = length($o->{CONFIG}{NAME}) ? 0 : 1;
}
$o->{API}{cleanup} =
($o->{CONFIG}{CLEAN_AFTER_BUILD} and not $o->{CONFIG}{REPORTBUG});
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/MJD.pm view on Meta::CPAN
require Text::Wrap;
local $Text::Wrap::columns = 72;
my @lines = Text::Wrap::wrap('', '', $DeepThought);
if(length $lines[-1] < 63 ){
$lines[-1] .= " -- Mark Jason Dominus";
} else {
push @lines, " -- Mark Jason Dominus";
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/MUDLike.pm view on Meta::CPAN
// HANDLE: $(array)
a.constructor == Array && a ||
// HANDLE: $(arraylike)
// Watch for when an array-like object is passed as the selector
(a.jquery || a.length && a != window && !a.nodeType && a[0] != undefined && a[0].nodeType) && jQuery.makeArray( a ) ||
// HANDLE: $(*)
[ a ] );
};
lib/Acme/MUDLike.pm view on Meta::CPAN
jQuery.fn = jQuery.prototype = {
jquery: "1.1.2",
size: function() {
return this.length;
},
length: 0,
get: function( num ) {
return num == undefined ?
// Return a 'clean' array
lib/Acme/MUDLike.pm view on Meta::CPAN
var ret = jQuery(a);
ret.prevObject = this;
return ret;
},
setArray: function( a ) {
this.length = 0;
[].push.apply( this, a );
return this;
},
each: function( fn, args ) {
return jQuery.each( this, fn, args );
lib/Acme/MUDLike.pm view on Meta::CPAN
var obj = key;
// Look for the case where we're accessing a style value
if ( key.constructor == String )
if ( value == undefined )
return this.length && jQuery[ type || "attr" ]( this[0], key ) || undefined;
else {
obj = {};
obj[ key ] = value;
}
lib/Acme/MUDLike.pm view on Meta::CPAN
add: function(t) {
return this.pushStack( jQuery.merge(
this.get(),
t.constructor == String ?
jQuery(t).get() :
t.length != undefined && (!t.nodeName || t.nodeName == "FORM") ?
t : [t] )
);
},
is: function(expr) {
return expr ? jQuery.filter(expr,this).r.length > 0 : false;
},
val: function( val ) {
return val == undefined ?
( this.length ? this[0].value : null ) :
this.attr( "value", val );
},
html: function( val ) {
return val == undefined ?
( this.length ? this[0].innerHTML : null ) :
this.empty().append( val );
},
domManip: function(args, table, dir, fn){
var clone = this.length > 1;
var a = jQuery.clean(args);
if ( dir < 0 )
a.reverse();
return this.each(function(){
lib/Acme/MUDLike.pm view on Meta::CPAN
// copy reference to target object
var target = arguments[0],
a = 1;
// extend jQuery itself if only one argument is passed
if ( arguments.length == 1 ) {
target = this;
a = 0;
}
var prop;
while (prop = arguments[a++])
lib/Acme/MUDLike.pm view on Meta::CPAN
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
},
// args is for internal usage only
each: function( obj, fn, args ) {
if ( obj.length == undefined )
for ( var i in obj )
fn.apply( obj[i], args || [i, obj[i]] );
else
for ( var i = 0, ol = obj.length; i < ol; i++ )
if ( fn.apply( obj[i], args || [i, obj[i]] ) === false ) break;
return obj;
},
prop: function(elem, value, type, index, prop){
lib/Acme/MUDLike.pm view on Meta::CPAN
// String was a bare <thead> or <tfoot>
else if ( wrap[1] == "<table>" && s.indexOf("<tbody") < 0 )
tb = div.childNodes;
for ( var n = tb.length-1; n >= 0 ; --n )
if ( jQuery.nodeName(tb[n], "tbody") && !tb[n].childNodes.length )
tb[n].parentNode.removeChild(tb[n]);
}
arg = [];
for (var i=0, l=div.childNodes.length; i<l; i++)
arg.push(div.childNodes[i]);
}
if ( arg.length === 0 && !jQuery.nodeName(arg, "form") )
return;
if ( arg[0] == undefined || jQuery.nodeName(arg, "form") )
r.push( arg );
else
lib/Acme/MUDLike.pm view on Meta::CPAN
makeArray: function( a ) {
var r = [];
if ( a.constructor != Array )
for ( var i = 0, al = a.length; i < al; i++ )
r.push( a[i] );
else
r = a.slice( 0 );
return r;
},
inArray: function( b, a ) {
for ( var i = 0, al = a.length; i < al; i++ )
if ( a[i] == b )
return i;
return -1;
},
merge: function(first, second) {
var r = [].slice.call( first, 0 );
// Now check for duplicates between the two arrays
// and only add the unique items
for ( var i = 0, sl = second.length; i < sl; i++ )
// Check for duplicates
if ( jQuery.inArray( second[i], r ) == -1 )
// The item is unique, add it
first.push( second[i] );
lib/Acme/MUDLike.pm view on Meta::CPAN
var result = [];
// Go through the array, only saving the items
// that pass the validator function
for ( var i = 0, el = elems.length; i < el; i++ )
if ( !inv && fn(elems[i],i) || inv && !fn(elems[i],i) )
result.push( elems[i] );
return result;
},
lib/Acme/MUDLike.pm view on Meta::CPAN
var result = [], r = [];
// Go through the array, translating each of the items to their
// new value (or values).
for ( var i = 0, el = elems.length; i < el; i++ ) {
var val = fn(elems[i],i);
if ( val !== null && val != undefined ) {
if ( val.constructor != Array ) val = [val];
result = result.concat( val );
}
}
var r = result.length ? [ result[0] ] : [];
check: for ( var i = 1, rl = result.length; i < rl; i++ ) {
for ( var j = 0; j < i; j++ )
if ( result[i] == r[j] )
continue check;
r.push( result[i] );
lib/Acme/MUDLike.pm view on Meta::CPAN
insertAfter: "after"
}, function(i,n){
jQuery.fn[ i ] = function(){
var a = arguments;
return this.each(function(){
for ( var j = 0, al = a.length; j < al; j++ )
jQuery(a[j])[n]( this );
});
};
});
lib/Acme/MUDLike.pm view on Meta::CPAN
},
toggleClass: function( c ){
jQuery.className[ jQuery.className.has(this,c) ? "remove" : "add" ](this, c);
},
remove: function(a){
if ( !a || jQuery.filter( a, [this] ).r.length )
this.parentNode.removeChild( this );
},
empty: function() {
while ( this.firstChild )
this.removeChild( this.firstChild );
lib/Acme/MUDLike.pm view on Meta::CPAN
});
jQuery.each( [ "height", "width" ], function(i,n){
jQuery.fn[ n ] = function(h) {
return h == undefined ?
( this.length ? jQuery.css( this[0], n ) : null ) :
this.css( n, h.constructor == String ? h : h + "px" );
};
});
jQuery.extend({
expr: {
lib/Acme/MUDLike.pm view on Meta::CPAN
lt: "i<m[3]-0",
gt: "i>m[3]-0",
nth: "m[3]-0==i",
eq: "m[3]-0==i",
first: "i==0",
last: "i==r.length-1",
even: "i%2==0",
odd: "i%2",
// Child Checks
"nth-child": "jQuery.nth(a.parentNode.firstChild,m[3],'nextSibling',a)==a",
"first-child": "jQuery.nth(a.parentNode.firstChild,1,'nextSibling')==a",
"last-child": "jQuery.nth(a.parentNode.lastChild,1,'previousSibling')==a",
"only-child": "jQuery.sibling(a.parentNode.firstChild).length==1",
// Parent Checks
parent: "a.firstChild",
empty: "!a.firstChild",
lib/Acme/MUDLike.pm view on Meta::CPAN
".": "jQuery.className.has(a,m[2])",
"@": {
"=": "z==m[4]",
"!=": "z!=m[4]",
"^=": "z&&!z.indexOf(m[4])",
"$=": "z&&z.substr(z.length - m[4].length,m[4].length)==m[4]",
"*=": "z&&z.indexOf(m[4])>=0",
"": "z",
_resort: function(m){
return ["", m[1], m[3], m[2], m[5]];
},
_prefix: "z=a[m[3]];if(!z||/href|src/.test(m[3]))z=jQuery.attr(a,m[3]);"
},
"[": "jQuery.find(m[2],a).length"
},
// The regular expressions that power the parsing engine
parse: [
// Match: [@value='test'], [@foo]
lib/Acme/MUDLike.pm view on Meta::CPAN
context = context || document;
// Handle the common XPath // expression
if ( !t.indexOf("//") ) {
context = context.documentElement;
t = t.substr(2,t.length);
// And the / root expression
} else if ( !t.indexOf("/") ) {
context = context.documentElement;
t = t.substr(1,t.length);
if ( t.indexOf("/") >= 1 )
t = t.substr(t.indexOf("/"),t.length);
}
// Initialize the search
var ret = [context], done = [], last = null;
lib/Acme/MUDLike.pm view on Meta::CPAN
t = t.replace( re, "" );
if ( t.indexOf(" ") == 0 ) continue;
foundToken = true;
} else {
// Look for pre-defined expression tokens
for ( var i = 0; i < jQuery.token.length; i += 2 ) {
// Attempt to match each, individual, token in
// the specified order
var re = jQuery.token[i];
var m = re.exec(t);
lib/Acme/MUDLike.pm view on Meta::CPAN
// Reset the context
r = ret = [context];
// Touch up the selector string
t = " " + t.substr(1,t.length);
} else {
// Optomize for the case nodeName#idName
var re2 = /^([a-z0-9_-]+)(#)([a-z0-9\\*_-]*)/i;
var m = re2.exec(t);
lib/Acme/MUDLike.pm view on Meta::CPAN
re2 = /^([#.]?)([a-z0-9\\*_-]*)/i;
m = re2.exec(t);
}
// Try to do a global search by ID, where we can
if ( m[1] == "#" && ret[ret.length-1].getElementById ) {
// Optimization for HTML document case
var oid = ret[ret.length-1].getElementById(m[2]);
// Do a quick check for the existence of the actual ID attribute
// to avoid selecting by the name attribute in IE
if ( jQuery.browser.msie && oid && oid.id != m[2] )
oid = jQuery('[@id="'+m[2]+'"]', ret[ret.length-1])[0];
// Do a quick check for node name (where applicable) so
// that div#foo searches will be really fast
ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
lib/Acme/MUDLike.pm view on Meta::CPAN
// Handle IE7 being really dumb about <object>s
if ( jQuery.nodeName(this, "object") && tag == "*" )
tag = "param";
jQuery.merge( r,
m[1] != "" && ret.length != 1 ?
jQuery.getAll( this, [], m[1], m[2], rec ) :
this.getElementsByTagName( tag )
);
});
// It's faster to filter by class and be done with it
if ( m[1] == "." && ret.length == 1 )
r = jQuery.grep( r, function(e) {
return rec.test(e.className);
});
// Same with ID filtering
if ( m[1] == "#" && ret.length == 1 ) {
// Remember, then wipe out, the result set
var tmp = r;
r = [];
// Then try to find the element with the ID
lib/Acme/MUDLike.pm view on Meta::CPAN
// and finally build a regexp out of it
m = re.exec( t );
if ( m ) {
// Remove what we just matched
t = t.substring( m[0].length );
// Re-organize the first match
if ( jQuery.expr[ m[1] ]._resort )
m = jQuery.expr[ m[1] ]._resort( m );
lib/Acme/MUDLike.pm view on Meta::CPAN
add = s.getAttribute("id") == name;
if ( add )
r.push( s );
if ( token == "#" && r.length ) break;
if ( s.firstChild )
jQuery.getAll( s, r, token, name, re );
}
lib/Acme/MUDLike.pm view on Meta::CPAN
// Clean up after IE to avoid memory leaks
if (jQuery.browser.msie)
jQuery(window).one("unload", function() {
var global = jQuery.event.global;
for ( var type in global ) {
var els = global[type], i = els.length;
if ( i && type != 'unload' )
do
jQuery.event.remove(els[i-1], type);
while (--i);
}
lib/Acme/MUDLike.pm view on Meta::CPAN
jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
// Set header so the called script knows that it's an XMLHttpRequest
xml.setRequestHeader("X-Requested-With", "XMLHttpRequest");
// Make sure the browser sends the right content length
if ( xml.overrideMimeType )
xml.setRequestHeader("Connection", "close");
// Allow custom headers/mimetypes
if( s.beforeSend )
lib/Acme/MUDLike.pm view on Meta::CPAN
if ( !this.queue[type] )
this.queue[type] = [];
this.queue[type].push( fn );
if ( this.queue[type].length == 1 )
fn.apply(this);
});
}
});
view all matches for this distribution
view release on metacpan or search on metacpan
use strict; use warnings FATAL => 'all';
use Acme::MakeMoneyAtHome;
my $str = make_money_at_home;
ok length $str, "function produced some crap";
note $str;
done_testing
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Marvel/CinematicUniverse/Mite.pm view on Meta::CPAN
# Try to determine original filename for caller, minus libdir.
# This would normally be in %INC but caller hasn't finished loading yet.
require File::Spec;
my $orig = $file;
for my $base ( @INC ) {
$base eq substr $file, 0, length $base
and -f File::Spec->catfile( $base, substr $file, 1 + length $base )
and $orig = File::Spec->abs2rel( $file, $base )
and last;
}
# Changes to this filename must be coordinated with Mite::Compiled
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Math/PerfectChristmasTree.pm view on Meta::CPAN
}
my $pi = pi();
return (
'number_of_baubles' => _round(sqrt(17) / 20 * $tree_height),
'tinsel_length' => 13 * $pi / 8 * $tree_height,
'lights_length' => $pi * $tree_height,
'star_or_fairy_height' => $tree_height / 10,
);
}
sub _round {
lib/Acme/Math/PerfectChristmasTree.pm view on Meta::CPAN
my %perfect_tree = calc_perfect_christmas_tree($tree_height);
# Content of %perfect_tree
#
# 'star_or_fairy_height' => 14,
# 'tinsel_length' => 714.712328691678,
# 'number_of_baubles' => 29,
# 'lights_length' => 439.822971502571
=head1 DESCRIPTION
This module calculates perfect Christmas tree. Sorry, "perfect Christmas tree" is not a data tree.
lib/Acme/Math/PerfectChristmasTree.pm view on Meta::CPAN
This function needs an argument which specify height of tree (please input as centimeter).
This function returns a hash. Keys of hash are...
'star_or_fairy_height'
'tinsel_length'
'number_of_baubles'
'lights_length'
(Values of hash related to length or height are expressed as centimeter).
=back
=head1 CONFIGURATION AND ENVIRONMENT
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/AutoInstall.pm view on Meta::CPAN
my $cwd = Cwd::cwd();
$Config = [];
my $maxlen = length(
(
sort { length($b) <=> length($a) }
grep { /^[^\-]/ }
map {
ref($_)
? ( ( ref($_) eq 'HASH' ) ? keys(%$_) : @{$_} )
: ''
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/MetaSyntactic/counting_to_one.pm view on Meta::CPAN
lest they'd be tought-provoking. François Truffaut's film is
about a future where every single alphabetic character is banished,
not only the thought-provoking ones inside the books, but also
the utilitary characters such as "exit", "walk"/"don't walk",
"in", "out". When a character's personal file is briefly shown,
we can only see numbers. This goes to such length that the credits
are not written on the screen, but spoken by a narrator.
The contributor likes Ray Bradbury's book.
=item Monty Python's Holy Grail
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/MetaSyntactic/daleks.pm view on Meta::CPAN
source => "http://maddingue.org/daleks/movies.txt",
extract => sub {
return sort _uniq(
map { $_ = _tr_nonword($_) ; s/^_+|_+$//g ; s/_+/_/g ; $_ }
grep { !/^\d/ }
grep { length }
split "\012", shift
)
},
);
view all matches for this distribution
view release on metacpan or search on metacpan
devdata/article.html view on Meta::CPAN
if ( 'placeholder' in input ) {
comment.attr( 'placeholder', jQuery( '.comment-textarea label' ).remove().text() );
}
// Expando Mode: start small, then auto-resize on first click + text length
jQuery( '#comment-form-identity' ).hide();
jQuery( '#comment-form-subscribe' ).hide();
jQuery( '#commentform .form-submit' ).hide();
comment.css( { 'height':'10px' } ).one( 'focus', function() {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/MetaSyntactic/vim.pm view on Meta::CPAN
syntax
tabstop
tabline
tabpagemax
tagbsearch
taglength
tagrelative
tags
tagstack
term
termbidi
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Test/MetaSyntactic.pm view on Meta::CPAN
$tb->subtest( "$theme load", sub { subtest_load(@args); } )
or return;
$tb->subtest( "$theme version", sub { subtest_version(@args); } );
$tb->subtest( "$theme data", sub { subtest_data(@args); } );
$tb->subtest( "$theme format", sub { subtest_format(@args); } );
$tb->subtest( "$theme length", sub { subtest_length(@args); } );
$tb->subtest( "$theme import", sub { subtest_import(@args); } );
$tb->subtest( "$theme noimport", sub { subtest_noimport(@args); } );
$tb->subtest( "$theme theme", sub { subtest_theme(@args); } );
$tb->subtest( "$theme remote", sub { subtest_remote(@args); } );
$tb->done_testing;
lib/Test/MetaSyntactic.pm view on Meta::CPAN
$tb->is_num( $ok, scalar @items, "All names correct for $theme" );
$tb->diag("Bad names: @failed") if @failed;
}
}
# t/23length.t
sub subtest_length {
my ($theme) = @_;
my $tb = __PACKAGE__->builder;
my @metas = _theme_sublists($theme);
$tb->plan( tests => 2 * @metas );
lib/Test/MetaSyntactic.pm view on Meta::CPAN
$tb->cmp_ok( 0 + @items, '>=', 1, "$theme has at least one item" );
# no empty names
my @failed;
my $ok = 0;
( length($_) >= 1 && length($_) <= 251 && ++$ok ) || push @failed, $_
for @items;
$tb->is_num( $ok, scalar @items, "All names correct for $theme" );
$tb->diag("Names too long: @failed") if @failed;
}
}
lib/Test/MetaSyntactic.pm view on Meta::CPAN
=head2 subtest_format( $theme )
Checks that each metasyntactic name in the theme is a valid Perl
variable name.
=head2 subtest_length( $theme )
Checks that each name in the theme has valid length.
=head2 subtest_data( $theme, $source )
Checks that the C<__DATA__> section (if any) of the theme source is
properly formatted.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Mitey/Cards/Deck.pm.mite.pm view on Meta::CPAN
ref( \$value ) eq 'SCALAR'
or ref( \( my $val = $value ) ) eq 'SCALAR';
}
}
)
&& ( length($value) > 0 )
)
or croak "Type check failed in constructor: %s should be %s",
"reverse", "NonEmptyStr";
$self->{"reverse"} = $value;
};
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
$s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg;
}
$s =~ s/^(\d+)\.?//;
my $l = $1 || 0;
my @v = map {
$_ . '0' x (3 - length $_)
} $s =~ /(\d{1,3})\D?/g;
$l = $l . '.' . join '', @v if @v;
return $l + 0;
}
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
$s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg;
}
$s =~ s/^(\d+)\.?//;
my $l = $1 || 0;
my @v = map {
$_ . '0' x (3 - length $_)
} $s =~ /(\d{1,3})\D?/g;
$l = $l . '.' . join '', @v if @v;
return $l + 0;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Monkey.pm view on Meta::CPAN
$ycoord -= 1;
my $location = ($ycoord * $self->{WIDTH}) + $xcoord;
for my $line(@$what) {
substr($self->{BUFFER}, $location, length($line), $line);
$location += $self->{WIDTH};
}
}
sub draw {
view all matches for this distribution
view release on metacpan or search on metacpan
sub record{
local $_ = unpack 'b*', pop;
s/(.)/$1?$long:$short/eg;
$_="\0\xC0\x11\0\xFF\x59\x02\0\0$_\0\xFF\x2F";
$hearable . pack('L', length($_)) . $_;
}
sub play{
local $_ = pop;
chomp;
s/^$hearable.{4}.+?\0{2}//;s/\0\xFF\x2F$//;
s/\xFF\x40(.+?)\x56\0/length($1)==7?1:0/ge;
pack 'b*', $_;
}
open 0 or die "Cannot hear '$0'.\n";
(my $telegram = do{local $/=undef;<0>}) =~ s/.*^\s*(use|no)\s+Acme::Morse::Audible\s*;\n//sm;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
sub _version {
my $s = shift || 0;
$s =~ s/^(\d+)\.?//;
my $l = $1 || 0;
my @v = map { $_ . '0' x (3 - length $_) } $s =~ /(\d{1,3})\D?/g;
$l = $l . '.' . join '', @v if @v;
return $l + 0;
}
1;
view all matches for this distribution