From b0fc9065f534932f52f8d25f47e49490df94698a Mon Sep 17 00:00:00 2001 From: Elijah Perrault Date: Sun, 27 Feb 2011 16:17:40 -0700 Subject: [PATCH] Added fpfmt() to API::Std, and removed the %20's from Bin. --- bin/auto | 1 - doc/CHANGELOG | 1 + lib/API/Std.pm | 10 +++++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bin/auto b/bin/auto index 2cd3173..c37548d 100755 --- a/bin/auto +++ b/bin/auto @@ -19,7 +19,6 @@ use Class::Unload; use FindBin qw($Bin); our $Bin = $Bin; ## no critic qw(NamingConventions::Capitalization Variables::ProhibitPackageVars) BEGIN { - $Bin =~ s/\s/%20/gxsm; unshift @INC, "$Bin/../lib"; open my $gitfh, '<', "$Bin/../.git/refs/heads/indev"; diff --git a/doc/CHANGELOG b/doc/CHANGELOG index e553c78..59243e5 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log 3.0 Indev =============================================================================== + * Added fpfmt() to API::Std. * Auto::GR renamed to $Auto::VERGITREV. * Bumped minimum version for API to 3.0.0a6. * Changed on_topic args to: full source hashref, new topic array diff --git a/lib/API/Std.pm b/lib/API/Std.pm index 4ac986b..3dc4854 100644 --- a/lib/API/Std.pm +++ b/lib/API/Std.pm @@ -12,7 +12,7 @@ use base qw(Exporter); our (%LANGE, %MODULE, %EVENTS, %HOOKS, %CMDS); our @EXPORT_OK = qw(conf_get trans err awarn timer_add timer_del cmd_add cmd_del hook_add hook_del rchook_add rchook_del match_user - has_priv mod_exists ratelimit_check); + has_priv mod_exists ratelimit_check fpfmt); # Initialize a module. @@ -516,6 +516,14 @@ sub awarn return 1; } +# Formatting a file path. +sub fpfmt { + my ($path) = @_; + + if ($path =~ m/\s/xsm) { return "\"$path\""; } + else { return $path; } +} + 1; # vim: set ai et sw=4 ts=4: