home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 10 / AU_CD10.iso / Updates / Perl / RPC / !Perl / scripts / putlibs < prev    next >
Text File  |  1998-07-14  |  786b  |  48 lines

  1. #! perl -lw
  2. use RISCOS;
  3. use File::Copy;
  4.  
  5. # Swap the files in the perl library from Name/pm to pm.Name
  6.  
  7. die "$0 <from> <to>" unless( @ARGV == 2 );
  8.  
  9. $from = shift;
  10. $to = shift;
  11.  
  12. sub ensuredir ($) {
  13.     my ($path);
  14.     foreach (split /\./, $_[0])
  15.     {
  16.     if( defined $path )
  17.     {
  18.         $path .= ".$_";
  19.     }
  20.     else
  21.     {
  22.         $path = $_
  23.     }
  24.     mkdir $path, 0777 or warn $! unless -d $path;
  25.     }
  26. }
  27.  
  28. foreach (qw(Fcntl IO.File IO.Handle Opcode POSIX Socket SDBM_File))
  29. {
  30.     $lib = "$_/pm";
  31.     if (/(.*)\./)
  32.     {
  33.         # IO
  34.         $destdir = "$to.$1.lib.$1";
  35.         $dest = "$to.$1.lib.$lib";
  36.     }
  37.     else
  38.     {
  39.         $destdir = "$to.$_";
  40.         $dest = "$to.$_.$lib";
  41.     }
  42.     ensuredir $destdir;
  43.     rename "$from.$lib", "$dest",  or warn "$from.$lib    $dest $!"
  44.       if -f "$from.$lib";
  45. }
  46.  
  47.  
  48.