| 1 | package FTN::Utils::OS_features; | ||||||||||||||||||||||||||||||||||
| 2 | 1 | our $VERSION = "1.02"; | |||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||
| 4 | BEGIN | ||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 6 | 1 | require Exporter; | |||||||||||||||||||||||||||||||||
| 7 | 1 | @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||
| 8 | 1 | @EXPORT = qw($needs_binmode $dir_separator); | |||||||||||||||||||||||||||||||||
| 9 | 1 | 1; | |||||||||||||||||||||||||||||||||
| 10 | } | ||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||
| 15 | 1 | our($needs_binmode, $dir_separator); | |||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||
| 17 | 1 | require Config; | |||||||||||||||||||||||||||||||||
| 18 | 1 | my $OS = $Config::Config{'osname'}; | |||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | if ($OS =~ /^MSWin/i) { $OS = 'WINDOWS'; } | ||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| |||||||||||||||||||||||||||||||||||
| 21 | 0 | elsif ($OS =~ /^VMS/i) { $OS = 'VMS'; } | |||||||||||||||||||||||||||||||||
| 22 | 0 | elsif ($OS =~ /^dos/i) { $OS = 'DOS'; } | |||||||||||||||||||||||||||||||||
| 23 | 0 | elsif ($OS =~ /^MacOS/i) { $OS = 'MACINTOSH';} | |||||||||||||||||||||||||||||||||
| 24 | 0 | elsif ($OS =~ /^os2/i) { $OS = 'OS2'; } | |||||||||||||||||||||||||||||||||
| 25 | 0 | elsif ($OS =~ /^epoc/i) { $OS = 'EPOC'; } | |||||||||||||||||||||||||||||||||
| 26 | 0 | elsif ($OS =~ /^cygwin/i){ $OS = 'CYGWIN'; } | |||||||||||||||||||||||||||||||||
| 27 | 1 | else { $OS = 'UNIX'; } | |||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||
| 29 | # Some OS logic. Binary mode enabled on DOS, NT and VMS | ||||||||||||||||||||||||||||||||||
| 30 | 1 | $needs_binmode = $OS=~/^(WINDOWS|DOS|OS2|CYGWIN)/; | |||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||
| 33 | # The path separator is a slash, backslash or semicolon, depending | ||||||||||||||||||||||||||||||||||
| 34 | # on the paltform. | ||||||||||||||||||||||||||||||||||
| 35 | $dir_separator = { | ||||||||||||||||||||||||||||||||||
| 36 | UNIX => '/', OS2 => '\\', EPOC => '/', CYGWIN => '/', | ||||||||||||||||||||||||||||||||||
| 37 | WINDOWS => '\\', DOS => '\\', MACINTOSH => ':', VMS => '/' | ||||||||||||||||||||||||||||||||||
| 38 | 1 | }->{$OS}; | |||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||
| 41 | 1 | 1; | |||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||
| 44 | =head1 NAME | ||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||
| 46 | FTN::OS_features - an auxiliary module for FTN::Forum and FTN::Pkt | ||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||
| 48 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||
| 50 | This module detects some features of your Operating System. Two variables are exported. | ||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||
| 52 | =over 8 | ||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||
| 54 | =item C<$needs_binmode> | ||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||
| 56 | Boolean. I<True> if this OS differ binary and text files (e.g. Windows), I<false> otherwise (e.g. UNIX). | ||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||
| 58 | =item C<$dir_separator> | ||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||
| 60 | String. A char to separate directories in a path. | ||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||
| 62 | =back | ||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||
| 64 | =head1 CREDITS | ||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||
| 66 | Thanks for Lincoln D. Stein, an author of CGI.pm | ||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||
| 68 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||
| 70 | Copyright 2008 Dmitry V. Kolvakh | ||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||
| 72 | This library is free software. | ||||||||||||||||||||||||||||||||||
| 73 | You may copy or redistribute it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||
| 75 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||
| 77 | Dmitry V. Kolvakh aka Keu | ||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||
| 79 | 2:5054/89@FIDOnet | ||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||
| 81 | =cut | ||||||||||||||||||||||||||||||||||