diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-08-02 04:48:58 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-08-02 04:48:58 +0000 |
commit | 2b9fcc72ed97ec345a0769817e13379a98a02862 (patch) | |
tree | 96f94ae289330dee7e4be2c17bd4cd3ef9b6ffbd /MDK | |
parent | 4eb86f480428513e47aeeb97d671bbffba6daa14 (diff) | |
download | perl-MDK-Common-2b9fcc72ed97ec345a0769817e13379a98a02862.tar perl-MDK-Common-2b9fcc72ed97ec345a0769817e13379a98a02862.tar.gz perl-MDK-Common-2b9fcc72ed97ec345a0769817e13379a98a02862.tar.bz2 perl-MDK-Common-2b9fcc72ed97ec345a0769817e13379a98a02862.tar.xz perl-MDK-Common-2b9fcc72ed97ec345a0769817e13379a98a02862.zip |
- workaround bug in ocaml on ultrasparc
(can't catch exception "Fatal error: out-of-bound access in array or string" in native code)
- add begins_with in MDK::Common::String
Diffstat (limited to 'MDK')
-rw-r--r-- | MDK/Common.pm.pl | 2 | ||||
-rw-r--r-- | MDK/Common/String.pm | 14 |
2 files changed, 13 insertions, 3 deletions
diff --git a/MDK/Common.pm.pl b/MDK/Common.pm.pl index 2ac0e37..07198f5 100644 --- a/MDK/Common.pm.pl +++ b/MDK/Common.pm.pl @@ -74,7 +74,7 @@ use vars qw(@ISA @EXPORT $VERSION); #); # perl_checker: RE-EXPORT-ALL @EXPORT = map { @$_ } map { values %{'MDK::Common::' . $_ . 'EXPORT_TAGS'} } grep { /::$/ } keys %MDK::Common::; -$VERSION = "1.1.14"; +$VERSION = "1.1.15"; 1; EOF diff --git a/MDK/Common/String.pm b/MDK/Common/String.pm index 484ee2c..80c6598 100644 --- a/MDK/Common/String.pm +++ b/MDK/Common/String.pm @@ -42,6 +42,13 @@ remove "\n"s when the next line doesn't start with a space. Otherwise keep handle carriage return just like LaTeX: merge lines that are not separated by an empty line +=item begins_with(STRING, STRING) + +return true if first argument begins with the second argument. Use this +instead of regexps if you don't want regexps. + +begins_with("hello world", "hello") # => 1 + =item warp_text(STRING, INT) return a list of lines which do not exceed INT characters @@ -62,7 +69,7 @@ L<MDK::Common> use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK); @ISA = qw(Exporter); -@EXPORT_OK = qw(bestMatchSentence formatList formatError formatTimeRaw formatLines formatAlaTeX warp_text); +@EXPORT_OK = qw(bestMatchSentence formatList formatError formatTimeRaw formatLines formatAlaTeX begins_with warp_text); %EXPORT_TAGS = (all => [ @EXPORT_OK ]); @@ -128,7 +135,10 @@ sub formatAlaTeX { } - +sub begins_with { + my ($s, $prefix) = @_; + index($s, $prefix) == 0; +} sub warp_text { my ($text, $o_width) = @_; |