Mark;
> Perl in WSH has got a grip on me lately, but I'm making
> a little progress.
>
> Using Win95 Osr2 and PERL build 517
> IE 4.01 sp2 and WSH2-V 5.1 Script Engines
>
> Looking through Find.pm(5-9-99), I was able to get
> error messages by changing
> warn "blah blah" to $main::WScript->echo()
I add something like this block of code to the beginning of any WSH script
I write to avoid such recoding:
package WSH::Overrides;
BEGIN
{
*main::warn = \&WSH::Overrides::_warn;
*main::die = \&WSH::Overrides::_die;
#etc...
}
sub _warn
{
my ($package, $filename, $line) = caller;
my $str = "Warning in $package at $line: ";
$main::WScript->Echo( $str, @_, "\n" );
CORE::warn( @_ );
}
sub _die
{
my ($package, $filename, $line) = caller;
my $str = "Death in $package at $line: ";
$main::WScript->Echo( $str, @_, "\n" );
CORE::die( @_ );
}
#etc...
package main;
> The following line is causing the trouble in WSH...
>
> # snip Find.pm line 145
> opendir(DIR,'.') ||
> ($main::WScript->echo("Can't open $dir: $!\n"), $bydepth || return);
> my(@filenames) = readdir(DIR);
> closedir(DIR);
> # end snip
>
> Current Directory?
> The string '.' is not recognized in WSH launched scripts and Find.pm
returns
> without even starting to process the directory.
Hmmm.... this seems to fun fine in WSH, with '.' referring to the directory
the wsf file lives in:
opendir( DIR, '.' ) || die "no opendir";
@files = readdir(DIR);
closedir( DIR );
$WScript->Echo( join( "\n", @files ) );
Have you tried using the FileSystemObject object instead of Find.pm?
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]