| 1 | # | ||
| 2 | # (c) Jan Gehring <jan.gehring@gmail.com> | ||
| 3 | # | ||
| 4 | # vim: set ts=3 sw=3 tw=0: | ||
| 5 | # vim: set expandtab: | ||
| 6 | |||
| 7 | package Rex::Endpoint::HTTP::Interface::File; | ||
| 8 | |||
| 9 | use strict; | ||
| 10 | use warnings; | ||
| 11 | |||
| 12 | sub create { | ||
| 13 | my ($class, $type) = @_; | ||
| 14 | |||
| 15 | if(! $type) { | ||
| 16 | if($^O =~ m/MSWin/) { | ||
| 17 | $type = "Windows"; | ||
| 18 | } | ||
| 19 | else { | ||
| 20 | $type = "Posix"; | ||
| 21 | } | ||
| 22 | } | ||
| 23 | |||
| 24 | my $klass = "Rex::Endpoint::HTTP::Interface::File::$type"; | ||
| 25 | eval "use $klass"; | ||
| 26 | |||
| 27 | if($@) { | ||
| 28 | die("Error loading Interface class ($klass)."); | ||
| 29 | } | ||
| 30 | |||
| 31 | return $klass->new; | ||
| 32 | } | ||
| 33 | |||
| 34 | 1; |