develooper Front page | perl.perl5.porters | Postings from September 2005

Pls Review: File::System::Spec

Thread Next
From:
John E. Malmberg
Date:
September 29, 2005 21:56
Subject:
Pls Review: File::System::Spec
Message ID:
433CC569.8030001@qsl.net
Michael G Schwern wrote:
 >
 > Put the logic in a module.  Put the module on CPAN.
 >
 > And this part is really my fault.  I've been meaning to write
 > File::System::Spec and Operating::System::Spec for a long time
 > now to allow easy answers to just these sorts of questions.

Would this fit the bill?  It is a File::System::Spec.

It gives 0 or 1 answers for UNIX and VMS and undef for other platforms 
until those can be added.

The code is vms.c will override these methods when it supports giving 
different answers.  In the mean time these methods will provide the 
expected results for VMS and I think for UNIX on older Perls.

It exposes the following methods that can optionally accept an argument 
to change the existing value.

In all cases, a return of undef indicates an exact answer is not known. 
  Usually that will be interpreted as a fallback to UNIX behavior.

   unix_report
                  0 = File specifications are returned in the default
                      behavior for the platform
                  1 = File specifications are return in UNIX format.

   unix_only
                  0 = File specifications are assumed to be in the
                      the default behavior for the platform.
                  1 = File specifications are assumed to be in UNIX
                      format.

   character_set_restricted
                  0 = Full character set is available for pathnames.
                  1 = A restricted character set is available for
                      pathnames.

   case_preserve
                  0 = The case of filenames is not preserved.
                  1 = The case of filenames is preserved.

   case_tolerant
                  0 = File lookups require exact case.  Implies
                      case_preserve.
                  1 = File lookups are case tolerant.

   case_lower
                  0 = File names are not forced to lower case.
                  1 = File names are forced to lower case.

   default_mandatory_locking
                  0 = No locking
                  1 = Files are locked by default on open.

Until the information for the other Perl platforms is added though, I do 
not see how it can get rid of the test for the platform name where these 
tests are done.

-John
wb8tyw@qsl.net
Personal Opinion Only

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About