X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fbytes_heavy.pl;h=923381de58da95b1de3cfee2d2c67102f551d4c8;hb=2b37efcc2bc957549bbeb5c71adf3fced634e4c9;hp=47bdbf91b0d0802b813277f5ac2336f7041780c7;hpb=657b208b434818aa5e54d68b0a8ad320c0252adf;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/bytes_heavy.pl b/lib/bytes_heavy.pl index 47bdbf9..923381d 100644 --- a/lib/bytes_heavy.pl +++ b/lib/bytes_heavy.pl @@ -5,4 +5,36 @@ sub length ($) { return CORE::length($_[0]); } +sub substr ($$;$$) { + BEGIN { bytes::import() } + return + @_ == 2 ? CORE::substr($_[0], $_[1]) : + @_ == 3 ? CORE::substr($_[0], $_[1], $_[2]) : + CORE::substr($_[0], $_[1], $_[2], $_[3]) ; +} + +sub ord ($) { + BEGIN { bytes::import() } + return CORE::ord($_[0]); +} + +sub chr ($) { + BEGIN { bytes::import() } + return CORE::chr($_[0]); +} + +sub index ($$;$) { + BEGIN { bytes::import() } + return + @_ == 2 ? CORE::index($_[0], $_[1]) : + CORE::index($_[0], $_[1], $_[2]) ; +} + +sub rindex ($$;$) { + BEGIN { bytes::import() } + return + @_ == 2 ? CORE::rindex($_[0], $_[1]) : + CORE::rindex($_[0], $_[1], $_[2]) ; +} + 1;