Skip Menu |

This queue is for tickets about the File-SortedSeek CPAN distribution.

Report information
The Basics
Id: 36131
Status: resolved
Priority: 0/
Queue: File-SortedSeek

People
Owner: Nobody in particular
Requestors: cpan [...] pjedwards.co.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.012
Fixed in: (no value)



Subject: PATCH for VMS (default record separator, versioned files)
Hello and thank you for File::SortedSeek 0.012 I had to make a few changes to get the tests to pass on VMS: From: http://search.cpan.org/dist/perl/pod/perlport.pod#VMS Show quoted text
>> What \n represents depends on the type of file opened. It >> usually represents \012 but it could also be \015, \012, >> \015\012, \000, \040, or nothing depending on the file >> organization and record format.
To get the tests to pass I needed to set it to \012. ==== SortedSeek.pm ==== @@ -26,7 +26,7 @@ my $EMAIL = 'jfreeman@tassie.net.au'; my %months = ( Jan => 0, Feb => 1, Mar => 2, Apr => 3, May => 4, Jun => 5, Jul => 6, Aug => 7, Sep => 8, Oct => 9, Nov => 10, Dec => 12); -my $default_rec_sep = ($^O =~ m/win32|vms/i) ? "\015\012" : +my $default_rec_sep = ($^O =~ m/win32/i) ? "\015\012" : ( $^O =~ /mac/i ) ? "\015" : "\012"; # some subs to set optional vars OO style @@ -531,7 +531,7 @@ This function needs to apply binmode so it splits the lines based on a system specific default record separator. This is derived as below: - my $default_rec_sep = ($^O =~ m/win32|vms/i) ? "\015\012" : + my $default_rec_sep = ($^O =~ m/win32/i) ? "\015\012" : ( $^O =~ /mac/i ) ? "\015" : "\012"; You can override this on a per file basis by passing the record separator @@ -599,7 +599,7 @@ This function needs to apply binmode so it splits the lines based on a system specific default record separator. This is derived as below: - my $default_rec_sep = ($^O =~ m/win32|vms/i) ? "\015\012" : + my $default_rec_sep = ($^O =~ m/win32/i) ? "\015\012" : ( $^O =~ /mac/i ) ? "\015" : "\012"; You can override this on a per file basis by passing the record separator @@ -737,4 +737,4 @@ For details about the mystical significance of the number 42 and how it can be applied to Life the Universe and everything see The Hitch Hiker's Guide -to the Galaxy 'trilogy' by the recently departed Douglas Adams.+to the Galaxy 'trilogy' by the recently departed Douglas Adams. VMS supports versions in files, to ensure all versions are cleaned up: http://search.cpan.org/dist/perl/pod/perlport.pod#System_Interactiom Show quoted text
>> Don't assume that a single unlink completely gets rid of >> the file: some filesystems (most notably the ones in VMS) >> have versioned filesystems, and unlink() removes only the >> most recent one (it doesn't remove all the versions because >> by default the native tools on those platforms remove just >> the most recent version, too). The portable idiom to remove >> all the versions of a file is >> >> 1 while unlink "file"; >> >> This will terminate if the file is undeleteable for some >> reason (protected, not there, and so on).
test.pl#2 @@ -660,7 +660,9 @@ close TEST; -if ( unlink $file ) { +1 while(unlink $file); + +if ( ! -e $file ) { print "Test file unlinked ok\n"; } else { Thanks, Peter (Stig) Edwards
Automatic context sensitive heuristic now used.