Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^5: File NCopy concat (glob)

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


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
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2025-06-14 00:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.