Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Perl Monk, Perl Meditation
 
PerlMonks  

Re^5: File NCopy concat (glob)

by ikegami (Patriarch)
on Sep 15, 2006 at 01:08 UTC ( [id://573055]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re^4: File NCopy concat
in thread File NCopy concat

File::NCopy's copy's argument is a glob pattern, not a file name. This pattern is passed to glob, which considers spaces to be pattern seperators, not literals. Refer to the passage I emphasised in the following snippet from File::Glob's documentation:

Since v5.6.0, Perl's CORE::glob() is implemented in terms of [File::Glob's] bsd_glob(). Note that they don't share the same prototype — CORE::glob() only accepts a single argument. Due to historical reasons, CORE::glob() will also split its argument on whitespace, treating it as multiple patterns, whereas bsd_glob() considers them as one pattern.

Update: File::NCopy works if you execute the following before calling copy:

{ package File::NCopy; use File::DosGlob qw( glob ); }

And if the spaces are backslashed (or quoted).
And if / is used as the path seperator on Windows.

$filename = 'c:/directory\\ name/file\\ name.txt'; $filename = '"c:/directory name/file name.txt"'; $filename = 'c:/"directory name"/"file name.txt"';

Truly, File::NCopy should be used with care if not considered outright broken. At the very least, it would be best if File::NCopy used bsd_glob rather than glob.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://573055]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.