This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #71710] fixes for File::Find
[perl5.git] / lib / Env.pm
index d1ee071..deac5fc 100644 (file)
@@ -1,5 +1,7 @@
 package Env;
 
+our $VERSION = '1.01';
+
 =head1 NAME
 
 Env - perl module that imports environment variables as scalars or arrays
@@ -130,8 +132,7 @@ sub TIEARRAY {
 
 sub FETCHSIZE {
     my ($self) = @_;
-    my @temp = split($sep, $ENV{$$self});
-    return scalar(@temp);
+    return 1 + scalar(() = $ENV{$$self} =~ /\Q$sep\E/g);
 }
 
 sub STORESIZE {
@@ -159,6 +160,19 @@ sub STORE {
     return $value;
 }
 
+sub EXISTS {
+    my ($self, $index) = @_;
+    return $index < $self->FETCHSIZE;
+}
+
+sub DELETE {
+    my ($self, $index) = @_;
+    my @temp = split($sep, $ENV{$$self});
+    my $value = splice(@temp, $index, 1, ());
+    $ENV{$$self} = join($sep, @temp);
+    return $value;
+}
+
 sub PUSH {
     my $self = shift;
     my @temp = split($sep, $ENV{$$self});
@@ -230,4 +244,11 @@ sub FETCH {
     return $ENV{$$self . ';' . $index};
 }
 
+sub EXISTS {
+    my ($self, $index) = @_;
+    return $index < $self->FETCHSIZE;
+}
+
+sub DELETE { }
+
 1;