Well, I thought that it would be simpler than it has turned out to be, and obviously I am missing a concept or two somewhere.

On VMS, the methods in Filespec.pm are actually implemented in vms.c not in the .pm module.

I thought that I could add some stub methods it and put them in the EXPORT list in Filespec.pm, and they would get used until I could put in overrides in vms.c to actually return the active information.

The idea is so that I can make the changes to the other dual life modules to fully support the current openVMS features when run with a newer Perl and still have those modules be able to be used with older Perls that do not have the internal support with out a lot of conditional code.

My tests are showing that the routines are not being exported though,
so I do not know what I am doing wrong.

It looks like there must be a way to cause the additional functions to be exported, but I have not been able to figure it out from reading about use or export.

Or should I just add these to blead, and use some sort of check in the dual life modules to see if the methods are available before testing the setting?

-John
[EMAIL PROTECTED]
Personal Opinion Only

The following is what I am trying to do:

@EXPORT = qw( &vmsify &unixify &pathify &fileify
              &vmspath &unixpath &candelete &rmsexpand
              &unix_report &unix_only &posix_mode
              &case_preserve &efs_charset &is_vms_spec
              &is_unix_spec &decc_feature_support
              &decc_feature_get_value &decc_features_set_value
              &decc_feature_deed);

I have more detailed documentation in my local copy of Filespec.pm.

# for now for most of these new methods just return undefined,
# as that is the state of older versions of Perl that do not
# provide these functions.

# lets routines know that filenames will be returned in UNIX syntax.
# and are expected to be maintained in UNIX syntax, except for
# methods like vmsify that explicitly convert the syntax.
sub unix_report ($) {
   return undef;
}

# lets routines know that all filenames will be treated as UNIX
# except for selected cases, and should be returned in UNIX syntax.
# Implies unix_report.  Most routines will only be checking unix_report,
# and unix_only will only be used for very special cases, mostly test
# modules.
sub unix_only ($) {
   return undef;
}

# Future posix mode active.
# In almost all cases except for testing, the unix_report mode will
# cover these.
sub posix_mode ($) {
   return undef;
}

# case is preserved, do not assume VMS means lower case file names.
sub case_preserve ($) {
   return undef;
}

# Almost anything goes for characters in file specifications.
# Even 16 bit Unicode characters can be represented in VMS style.
sub efs_charset ($) {
   return undef;
}

# The rules used to be simple for this, but are currently being
# inconsistently applied, which is introducing hard to diagnose
# bugs.  Now they are more complex, so time to make them common.
sub is_vms_spec ($) {
  my($fspec) = @_;
  return 0 if ($fspec eq '.') || ($fspec eq. '..');
  # if []:;<> present then true.
  return 1 if $fspec =~ m#[:>\]]#;
  # if / present than false.
  return 1 if $fspec !~ m#[/]#;
  return 0
}

# The rules used to be simple for this, but are currently being
# inconsistently applied, which is introducing hard to diagnose
# bugs.  Now they are more complex, so time to make them common.
sub is_unix_spec($) {
  my($fspec) = @_;
  return 1 if ($fspec eq '.') || ($fspec eq. '..');
  # if / present than true
  return 1 if $fspec =~ m#[/]#;
  # if []:<> present then false.
  return 1 if $fspec !~ m#[:>\]]#;
  return 0;
}

# the DECC stuff is just to expose the 'raw' information used
# used for set/clear options when they are available to be
# changed, and may be needed for some of the tests so that I
# can remove some of the "skips" or "todo" for VMS by changing
# the DECC mode for the test. This may be deferred to a new
# xs module.
sub decc_feature_support {
   return undef;
}

sub decc_feature_get_value ($;$) {
    my ($feature, $mode) = @_;
   # look for DECC$ prefix on feature name.
    return $ENV{$feature} if (defined $feature);
    return undef;
}

sub decc_feature_set_value ($;$;$) {
    return undef;
}

sub decc_feature_deed($) {
    return 1;
}

Reply via email to