This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
amigaos4: dist/PathTools/lib/File/Spec: add AmigaOS.pm
authorAndy Broad <andy@broad.ology.org.uk>
Fri, 14 Aug 2015 01:17:44 +0000 (21:17 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Sat, 5 Sep 2015 15:12:47 +0000 (11:12 -0400)
MANIFEST
dist/PathTools/lib/File/Spec.pm
dist/PathTools/lib/File/Spec/AmigaOS.pm [new file with mode: 0644]

index f80a35e..69fb34e 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -3304,6 +3304,7 @@ dist/Net-Ping/t/510_ping_udp.t            Ping Net::Ping
 dist/Net-Ping/t/520_icmp_ttl.t         Ping Net::Ping
 dist/PathTools/Cwd.pm                          Various cwd routines (getcwd, fastcwd, chdir)
 dist/PathTools/Cwd.xs                          Cwd extension external subroutines
+dist/PathTools/lib/File/Spec/AmigaOS.pm                portable operations on AmigaOS file names
 dist/PathTools/lib/File/Spec/Cygwin.pm portable operations on Cygwin file names
 dist/PathTools/lib/File/Spec/Epoc.pm           portable operations on EPOC file names
 dist/PathTools/lib/File/Spec/Functions.pm      Function interface to File::Spec object methods
index 2f35526..31e886b 100644 (file)
@@ -14,7 +14,8 @@ my %module = (MacOS   => 'Mac',
              NetWare => 'Win32', # Yes, File::Spec::Win32 works on NetWare.
              symbian => 'Win32', # Yes, File::Spec::Win32 works on symbian.
              dos     => 'OS2',   # Yes, File::Spec::OS2 works on DJGPP.
-             cygwin  => 'Cygwin');
+             cygwin  => 'Cygwin',
+             amigaos => 'AmigaOS');
 
 
 my $module = $module{$^O} || 'Unix';
diff --git a/dist/PathTools/lib/File/Spec/AmigaOS.pm b/dist/PathTools/lib/File/Spec/AmigaOS.pm
new file mode 100644 (file)
index 0000000..86c55c3
--- /dev/null
@@ -0,0 +1,61 @@
+package File::Spec::AmigaOS;
+
+use strict;
+use vars qw(@ISA $VERSION);
+require File::Spec::Unix;
+
+$VERSION = '3.57';
+$VERSION =~ tr/_//;
+
+@ISA = qw(File::Spec::Unix);
+
+=head1 NAME
+
+File::Spec::AmigaOS - File::Spec for AmigaOS
+
+=head1 SYNOPSIS
+
+ require File::Spec::AmigaOS; # Done automatically by File::Spec if needed
+
+=head1 DESCRIPTION
+
+Methods for manipulating file specifications.
+
+=head1 METHODS
+
+=over 2
+
+=item tmpdir
+
+Returns $ENV{TMPDIR} or if that is unset, "/t".
+
+=cut
+
+my $tmpdir;
+sub tmpdir {
+  return $tmpdir if defined $tmpdir;
+  $tmpdir = $_[0]->_tmpdir( $ENV{TMPDIR}, "/t" );
+}
+
+=item file_name_is_absolute
+
+Returns true if there's a colon in the file name,
+or if it begins with a slash.
+
+=cut
+
+sub file_name_is_absolute {
+  my ($self, $file) = @_;
+
+  # Not 100% robust as a "/" must not preceded a ":"
+  # but this cannot happen in a well formed path.
+  return $file =~ m{^/|:}s;
+}
+
+=back
+
+All the other methods are from L<File::Spec::Unix>.
+
+=cut
+
+1;