in reply to ActivePERL is the devil?

Read the documentation of use. This is, if not bogus, then silly:
use Shell qw( perl ); use Shell qw( dir ); use Shell qw( copy ); use Shell qw( del ); use Shell qw( cd );

A use statement is performed once per module, and you pass it a list:

use Shell qw( perl dir copy del cd );

would be the right idiom. But perl? cd? AFAIK cd is a shell builtin, and perl has chdir.

Probably the Shell->import() method will be invoked multiple times with your multiple use statements (I haven't tried), and your code thus is equivalent to

use Shell qw( perl ); BEGIN { Shell->import( qw( dir ) ); } BEGIN { Shell->import( qw( copy ) ); } BEGIN { Shell->import( qw( del ) ); } BEGIN { Shell->import( qw( cd ) ); }

but why invoke the same method multiple times with a single element, if you can invoke it once with a list?

But there are far more gotchas in your script, none of those have to do anything with ActiveState. E.g. you should use File::Spec to portably assemble directory and file names into a path.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Replies are listed 'Best First'.
Re^2: ActivePERL is the devil?
by ysth (Canon) on Jun 08, 2007 at 00:59 UTC
    cd? AFAIK cd is a shell builtin, and perl has chdir.
    He was using cd to change the current drive, not the current working directory. I don't know much about windows perl, so can't say whether that's a reasonable thing to try or not, or whether perl's chdir would have done as well.
      He was using cd to change the current drive, not the current working directory. I don't know much about windows perl, so can't say whether that's a reasonable thing to try or not...

      chdir will change drives as well as directories. But as I said previously, 'system("cd ...")' won't stay cd'd in your perl program, just in the command shell.

Re^2: ActivePERL is the devil?
by naikonta (Curate) on Jun 08, 2007 at 15:15 UTC
    and your code thus is equivalent to
    use Shell qw( perl ); BEGIN { Shell->import( qw( dir ) ); } BEGIN { Shell->import( qw( copy ) ); } BEGIN { Shell->import( qw( del ) ); } BEGIN { Shell->import( qw( cd ) ); }
    May be worse:
    BEGIN { require Shell; Shell->import( qw( perl ) ); } BEGIN { require Shell; Shell->import( qw( dir ) ); } BEGIN { require Shell; Shell->import( qw( copy ) ); } BEGIN { require Shell; Shell->import( qw( del ) ); } BEGIN { require Shell; Shell->import( qw( cd ) ); }
    Despite that only the first invocation of require compiles the module, it's still a sequence of invocations on the same function (require) with the same argument (Shell) within inside the very same file.

    Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!