summaryrefslogtreecommitdiff
path: root/lib/bytes_heavy.pl
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-09-03 08:22:48 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-09-03 08:22:48 +0000
commit579f6b362c1dba5aba4049a91c9b6ef08e1b2c6d (patch)
tree6cdd8413b00066268f4f1bc998afc8bb016e0a6f /lib/bytes_heavy.pl
parent02f28d4422c060b571af1683cfd1890a475f4e8f (diff)
downloadperl-579f6b362c1dba5aba4049a91c9b6ef08e1b2c6d.tar.gz
Add, document, and test bytes::substr, index, rindex, chr,
document bytes::ord. p4raw-id: //depot/perl@21016
Diffstat (limited to 'lib/bytes_heavy.pl')
-rw-r--r--lib/bytes_heavy.pl32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/bytes_heavy.pl b/lib/bytes_heavy.pl
index 47bdbf91b0..923381de58 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;