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

MANIFEST with spaces in filenames?

by coppit (Beadle)
on Sep 15, 2004 at 20:05 UTC ( [id://391277]=perlquestion: print w/replies, xml ) Need Help??

coppit has asked for the wisdom of the Perl Monks concerning the following question:

maniread in ExtUtils::Manifest treats everything after the first whitespace as a comment. Is there some way to specify a filename that contains a space? Renaming the file isn't an option for me.

Previously I was leaving them out of the MANIFEST and added a PREOP in Makefile.PL to copy the files manually. Unfortunately, I've switched to Module::Install and it doesn't seem to have equivalent functionality. :(

Anyone have suggestions?

Replies are listed 'Best First'.
Re: MANIFEST with spaces in filenames?
by mifflin (Curate) on Sep 15, 2004 at 22:24 UTC
    I've been looking through the ExtUtils::Manifest package and it does not appear that you can.
    Line 189 (in the maniread sub) splits a MANIFEST line with this code:
    my($file, $comment) = /^(\S+)\s*(.*)/;
    It looks like anything after the first set of spaces is considered a comment.

    Update:
    After further investigation it looks like the open statement in the cp_if_diff sub might be the problem. The open statement is:
    open(F,"< $from\0") or die "Can't read $from: $!\n";
    If there was some way to represent a file with spaces using escape sequences (eg \x20, \040 ...) that would make this command open a file then it should work.
Re: MANIFEST with spaces in filenames?
by dondelelcaro (Monk) on Sep 15, 2004 at 23:51 UTC
    Renaming the file isn't an option for me.
    While renaming may in the end not be an option for you, I'd strongly suggest considering it, especially if you plan on having wide distribution for your module. I know it would be one of the first things I changed if I ended up packaging your module for inclusion in Debian.
      While renaming may in the end not be an option for you, I'd strongly suggest considering it, especially if you plan on having wide distribution for your module.
      I can't because, um, it's an input file used to test my program for filenames containing spaces!
        Can you have the .t test file create a file with a space in the filename, and then run your test on that 'dynamically' created file? This would solve your problem of not having to distribute it with the CPAN package.
Re: MANIFEST with spaces in filenames?
by PodMaster (Abbot) on Sep 16, 2004 at 02:20 UTC
    maniread in ExtUtils::Manifest treats everything after the first whitespace as a comment. Is there some way to specify a filename that contains a space? Renaming the file isn't an option for me.
    No, but here is a novel idea though (:
    use ExtUtils::Manifest(); sub ExtUtils::Manifest::maniread { print "blah blah blah"; } use ExtUtils::MakeMaker; ...
    Previously I was leaving them out of the MANIFEST and added a PREOP in Makefile.PL to copy the files manually. Unfortunately, I've switched to Module::Install and it doesn't seem to have equivalent functionality. :(
    According to scandeps, Module::Install doesn't use ExtUtils::Manifest so I'm not sure why you're looking at ExtUtils::Manifest, but you can always
    • switch back to MakeMaker
    • override/subclass the appropriate thing

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

      Actually, Module::Build::Base uses ExtUtils::Manifest. Even worse, when you run "make dist" you get:
      /usr/bin/perl -Iinc "-MExtUtils::Manifest=manicopy,maniread" \ -e "manicopy(maniread(),'Mail-Mbox-MessageParser-1.21.0', 'bes +t');"
      This means my only real option is to copy ExtUtils/Manifest.pm to inc/ and then modify it. Bleh. Instead, I've asked the author to provide support for escaped spaces in the MANIFEST.

      In the meantime, I've done the following:

      1. comment out the lines in the MANIFEST that involve files with spaces
      2. Put the following at the end of Makefile.PL:
        print "Fixing PREOP in the Makefile to copy files with spaces during + building\n"; my $commands = q{; \$(CP) t/mailboxes/*\\\\ * \$(DISTVNAME)/t/mailbo +xes; \$(CP) t/results/*\\\\ * \$(DISTVNAME)/t/results}; system "$^X -pi -e 's|^(PREOP\\s*=.*)|\$1$commands|' Makefile";
      The above code should work for both ExtUtils::MakeMaker and Module::Install.
Re: MANIFEST with spaces in filenames?
by graff (Chancellor) on Sep 16, 2004 at 03:36 UTC
    Renaming the file (with a space in its name) isn't an option for me.

    Well then, I guess making your package easy to port across platforms won't be an option either...

    I don't know where the file names are coming from (a pipeline? a list file? File::Find or readdir running inside ExtUtils::Manifest?). If you have a chance to manipulate the list of file names before passing it to ExtUtils::Manifest, you might try converting space to something else (just within the list, without actually changing the directory entry for the file), then undo the conversion (turn it back into space) after ExtUtils::Manifest is done with it.

    (... Just guessing.)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://391277]
Approved by kutsu
Front-paged by broquaint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-04-19 05:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found