作り物

cutxout2005-07-25

Win32::DriveInfo - drives on Win32 systems

PerlからCDROMのドライブレターを取得する方法を探していたら、こんなのを発見した。目的は達せそうですが、ドライブレター決めうちじゃないとだめなのか...

use Win32::DriveInfo;
($VolumeName,
 $VolumeSerialNumber,
 $MaximumComponentLength,
 $FileSystemName, @attr) = Win32::DriveInfo::VolumeInfo('g');

いや、ちがう。さすがにそんなタコなしようじゃなかったようだ。:-)

   drive - drive-letter in either 'c' or 'c:' or 'c:\\' form.

   $VolumeName             - name of the specified volume.
   $VolumeSerialNumber     - volume serial number.
   $MaximumComponentLength -
        filename component supported by the specified file system.
        A filename component is that portion of a filename between backslashes.
        Indicate that long names are supported by the specified file system.
        For a FAT file system supporting long names, the function stores
        the value 255, rather than the previous 8.3 indicator. Long names can
        also be supported on systems that use the New Technology file system
        (NTFS).
   $FileSystemName         - name of the file system (such as FAT, FAT32, CDFS or NTFS).
   @attr                   - array of integers 1-6
     1 - file system preserves the case of filenames
     2 - file system supports case-sensitive filenames
     3 - file system supports Unicode in filenames as they appear on disk
     4 - file system preserves and enforces ACLs (access-control lists).
         For example, NTFS preserves and enforces ACLs, and FAT does not.
     5 - file system supports file-based compression
     6 - specified volume is a compressed volume; for ex., a DoubleSpace volume

一段落

  • 数多くの試行錯誤の末、スクリプト側はほぼ満足と言える動作をしてくれるようになった。
  • 一部で謎の挙動を示すところがあるんですが、パスを正確に記述すれば問題ないので、運用でカバー。:-)
  • 作ることが目的ではなく、使うために作ったのだから、実践投入ですね。
  • 今度は、データベース側の準備をしなくちゃ。データモデルを検証して、自動更新用のスクリプトを作るところまでが次のステップ。