PerlScript - FileSystemObject - Windows Scrpting Host

--0-276961901-1207166748=:68967
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Hello everybody,

Can anyone tell me why this simple code does not work?

<Job ID="Test">
<script language=PerlScript>

$objFSO = $WScript->CreateObject("Scripting.FileSystemObject");
$objFile = $objFSO->CreateTextFile("test2.txt", ForWriting);

$objFile->WriteLine("Hello");


</script>
</Job>

I got this error:
Error: (in cleanup) Can't call method "Writeline" on an undefined value

I suspect something with FileSystemObject but I could not find anything on the web and I have been searching for some days :-((((

...but the same code in java or VBscript works.

Any help will be really well apreciated.

Thanks in advance.






---------------------------------
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
--0-276961901-1207166748=:68967--
oscar gil [ Mi, 02 April 2008 22:05 ] [ ID #1934280 ]

Re: PerlScript - FileSystemObject - Windows Scrpting Host

From: oscar gil <racsolig [at] yahoo.com>
> Hello everybody,
>
> Can anyone tell me why this simple code does not work?
>
> <Job ID="Test">
> <script language=PerlScript>
>
> $objFSO = $WScript->CreateObject("Scripting.FileSystemObject");
> $objFile = $objFSO->CreateTextFile("test2.txt", ForWriting);
>
> $objFile->WriteLine("Hello");
>
>
> </script>
> </Job>
>
> I got this error:
> Error: (in cleanup) Can't call method "Writeline" on an undefined value
>
> I suspect something with FileSystemObject but I could not find anything on the web and I have been searching for some days :-((((

You would only use Scripting.FileSystemObject if you are a strong
masochist.

open my $OUT, '>', "test2.txt" or die "Failed to open: $^E\n";
print $OUT "Hello\n";

just like in normal Perl.

And most likely the problem is permissions. The account undex which
the ASP page runs doesn't have enough permissions to create the file
in the current directory.

Jenda
===== Jenda [at] Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Jenda Krynicky [ Mi, 02 April 2008 23:55 ] [ ID #1934281 ]

Re: PerlScript - FileSystemObject - Windows Scrpting Host

From: oscar gil <racsolig [at] yahoo.com>
> Hello everybody,
>
> Can anyone tell me why this simple code does not work?
>
> <Job ID="Test">
> <script language=PerlScript>
>
> $objFSO = $WScript->CreateObject("Scripting.FileSystemObject");
> $objFile = $objFSO->CreateTextFile("test2.txt", ForWriting);
>
> $objFile->WriteLine("Hello");
>
>
> </script>
> </Job>
>
> I got this error:
> Error: (in cleanup) Can't call method "Writeline" on an undefined value
>
> I suspect something with FileSystemObject but I could not find anything on the web and I have been searching for some days :-((((

You would only use Scripting.FileSystemObject if you are a strong
masochist.

open my $OUT, '>', "test2.txt" or die "Failed to open: $^E\n";
print $OUT "Hello\n";

just like in normal Perl.

And most likely the problem is permissions. The account undex which
the ASP page runs doesn't have enough permissions to create the file
in the current directory.

Jenda
===== Jenda [at] Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Jenda Krynicky [ Mi, 02 April 2008 23:55 ] [ ID #1934322 ]

RE: PerlScript - FileSystemObject - Windows Scrpting Host

-----Original Message-----
From: activeperl-bounces [at] listserv.ActiveState.com
[mailto:activeperl-bounces [at] listserv.ActiveState.com] On Behalf Of Jenda
Krynicky
Sent: Thursday, 3 April 2008 08:55 AM
To: ActivePerl [at] listserv.ActiveState.com; beginners [at] perl.org
Subject: Re: PerlScript - FileSystemObject - Windows Scrpting Host

From: oscar gil <racsolig [at] yahoo.com>
> Hello everybody,
>
> Can anyone tell me why this simple code does not work?
>
> <Job ID="Test">
> <script language=PerlScript>
>
> $objFSO = $WScript->CreateObject("Scripting.FileSystemObject");
> $objFile = $objFSO->CreateTextFile("test2.txt", ForWriting);
>
> $objFile->WriteLine("Hello");
>
>
> </script>
> </Job>
>
> I got this error:
> Error: (in cleanup) Can't call method "Writeline" on an undefined
> value
>
> I suspect something with FileSystemObject but I could not find
> anything on the web and I have been searching for some days :-((((

You would only use Scripting.FileSystemObject if you are a strong
masochist.

open my $OUT, '>', "test2.txt" or die "Failed to open: $^E\n"; print
$OUT "Hello\n";

just like in normal Perl.

And most likely the problem is permissions. The account undex which the
ASP page runs doesn't have enough permissions to create the file in the
current directory.

Jenda
===== Jenda [at] Krynicky.cz === http://Jenda.Krynicky.cz ===== When it comes
to wine, women and song, wizards are allowed to get drunk and croon as
much as they like.
-- Terry Pratchett in Sourcery

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

ForWriting is not defined. You should check the values returned
CreateObject and CreateTextFile.

Cheers,
Ken.


_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Ken Barker [ Do, 03 April 2008 02:53 ] [ ID #1935115 ]

RE: PerlScript - FileSystemObject - Windows Scrpting Host

-----Original Message-----
From: activeperl-bounces [at] listserv.ActiveState.com
[mailto:activeperl-bounces [at] listserv.ActiveState.com] On Behalf Of Jenda
Krynicky
Sent: Thursday, 3 April 2008 08:55 AM
To: ActivePerl [at] listserv.ActiveState.com; beginners [at] perl.org
Subject: Re: PerlScript - FileSystemObject - Windows Scrpting Host

From: oscar gil <racsolig [at] yahoo.com>
> Hello everybody,
>
> Can anyone tell me why this simple code does not work?
>
> <Job ID="Test">
> <script language=PerlScript>
>
> $objFSO = $WScript->CreateObject("Scripting.FileSystemObject");
> $objFile = $objFSO->CreateTextFile("test2.txt", ForWriting);
>
> $objFile->WriteLine("Hello");
>
>
> </script>
> </Job>
>
> I got this error:
> Error: (in cleanup) Can't call method "Writeline" on an undefined
> value
>
> I suspect something with FileSystemObject but I could not find
> anything on the web and I have been searching for some days :-((((

You would only use Scripting.FileSystemObject if you are a strong
masochist.

open my $OUT, '>', "test2.txt" or die "Failed to open: $^E\n"; print
$OUT "Hello\n";

just like in normal Perl.

And most likely the problem is permissions. The account undex which the
ASP page runs doesn't have enough permissions to create the file in the
current directory.

Jenda
===== Jenda [at] Krynicky.cz === http://Jenda.Krynicky.cz ===== When it comes
to wine, women and song, wizards are allowed to get drunk and croon as
much as they like.
-- Terry Pratchett in Sourcery

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

ForWriting is not defined. You should check the values returned
CreateObject and CreateTextFile.

Cheers,
Ken.


_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Ken Barker [ Do, 03 April 2008 02:53 ] [ ID #1935121 ]
Perl » gmane.comp.lang.perl.active-perl » PerlScript - FileSystemObject - Windows Scrpting Host

Vorheriges Thema: ppm
Nächstes Thema: Apache and mod_perl question