[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH 3/3] Deprecate Sys::Guestfs::Lib::resolve_windows_path.



Richard W.M. Jones wrote:
...
> diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm
> index 8ea2c1b..f7aaf07 100644
> --- a/perl/lib/Sys/Guestfs/Lib.pm
> +++ b/perl/lib/Sys/Guestfs/Lib.pm
> @@ -247,6 +247,9 @@ sub _is_pv {
>
>  =head2 resolve_windows_path
>
> +I<This function is deprecated>.
> +Use C<$g-E<gt>case_sensitive_path> as a direct substitute.
> +
>   $path = resolve_windows_path ($g, $path);
>
>   $path = resolve_windows_path ($g, "/windows/system");
> @@ -267,38 +270,10 @@ by C</> characters.  Do not use C<\>, drive names, etc.

Hi Rich,

This looks fine.

>  sub resolve_windows_path
>  {
> -    local $_;
>      my $g = shift;
>      my $path = shift;

If you're interested in stylistic suggestions, you might
prefer the one-line style to repeated uses of "shift".
Saving N-1 lines per function is a Good Thing:

    my ($g, $path) = @_;

Also, a general guideline I've found useful is to say "file" or "filename"
in place of "path" (as long as we're not talking about shell search paths,
a la $PATH) with the implication that "filename" is general enough
to encompass names of things like directories and non-regular files.
POSIX does this, and it makes it a lot easier to write about
"file system objects" as "files" without having to say "regular files or
directories or special devices", etc.

i.e.,

    my ($g, $filename) = @_;


> -    if (substr ($path, 0, 1) ne "/") {
> -        warn __"resolve_windows_path: path must start with a / character";
> -        return undef;
> -    }
...


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]