Help for this page

Select Code to Download


  1. or download this
    use strict;
    sub win_fn  { print "windows version of function\n" }
    ...
        }
    }
    xplatform_fn();
    
  2. or download this
    use strict;
    my $OS_TYPE = $^O eq 'MSWin32' ? 'win' :
    ...
    );
    sub xplatform_fn { return $xplat{$OS_TYPE}->() }
    xplatform_fn();
    
  3. or download this
    use strict;
    my $OS_TYPE = $^O eq 'MSWin32' ? 'win' :
    ...
    sub XPlat::unix_fn { print "unix version of function\n"    }
    sub xplatform_fn   { return &{$XPlat::{$OS_TYPE."_fn"}} }
    xplatform_fn();