| 1 | package NKTI::general::file; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | # Create Subroutine for Clean Directory "/" Symbol : | ||
| 7 | # ------------------------------------------------------------------------ | ||
| 8 | =head1 dir_symbol() | ||
| 9 | |||
| 10 | Deskripsi Subroutine : | ||
| 11 | ---------------------------------------- | ||
| 12 | Subroutine yang berfungsi untuk clean Symbol "/" | ||
| 13 | dibagian depan dan akhir Lokasi Direktori. | ||
| 14 | |||
| 15 | Parameter Subroutine : | ||
| 16 | ---------------------------------------- | ||
| 17 | $locdir = [ Berisi ] | ||
| 18 | |||
| 19 | =cut | ||
| 20 | sub trim { | ||
| 21 | |||
| 22 | # Define parameter subroutine : | ||
| 23 | # ---------------------------------------------------------------- | ||
| 24 | my ($self, $locdir) = @_; | ||
| 25 | |||
| 26 | # Action Trim White Space : | ||
| 27 | # ---------------------------------------------------------------- | ||
| 28 | $locdir =~ s/^\s+//; | ||
| 29 | $locdir =~ s/\s+$//; | ||
| 30 | |||
| 31 | # Action Trim "/" : | ||
| 32 | # ---------------------------------------------------------------- | ||
| 33 | $locdir =~ s/^\///; | ||
| 34 | $locdir =~ s/\/$//; | ||
| 35 | |||
| 36 | # Return REuslt : | ||
| 37 | # ---------------------------------------------------------------- | ||
| 38 | return $locdir; | ||
| 39 | } | ||
| 40 | # End of Create Subroutine for Clean Directory "/" Symbol. | ||
| 41 | # =========================================================================================================== | ||
| 42 | |||
| 43 | # Create Subroutine for Convert Location File Or Dir into string regex : | ||
| 44 | # ------------------------------------------------------------------------ | ||
| 45 | =head1 convert_regex_mode() | ||
| 46 | |||
| 47 | Deskripsi Subroutine : | ||
| 48 | ---------------------------------------- | ||
| 49 | |||
| 50 | Parameter Subroutine : | ||
| 51 | ---------------------------------------- | ||
| 52 | describ_param | ||
| 53 | |||
| 54 | =cut | ||
| 55 | sub convert_regex_mode { | ||
| 56 | |||
| 57 | # Define paremter Subroutin : | ||
| 58 | # ---------------------------------------------------------------- | ||
| 59 | my ($elf, $location) = @_; | ||
| 60 | |||
| 61 | # Action convert location of files into regex mode : | ||
| 62 | # ---------------------------------------------------------------- | ||
| 63 | $location =~ s/\//\\\//g; | ||
| 64 | |||
| 65 | # Return Result : | ||
| 66 | # ---------------------------------------------------------------- | ||
| 67 | return $location; | ||
| 68 | } | ||
| 69 | # End of Create Subroutine for Convert Location File Or Dir into string regex. | ||
| 70 | # =========================================================================================================== | ||
| 71 | |||
| 72 | 1; | ||
| 73 | __END__ |