Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > ASP --> PERL SCRIPT HELP>>PLEASE>>

Reply
Thread Tools

ASP --> PERL SCRIPT HELP>>PLEASE>>

 
 
kalusalu
Guest
Posts: n/a
 
      07-02-2003
Hello..I was browsing thru the newsgroups ...and was wondering if anyone
here can be of assistance to me....as I am very very new to PERL..and have
this ASP SCRIPT..I have to convert...

<%
'Response.Content.Type = "text/plain"
vpath = Request("vpath")

IF vpath = "" then
vpath = "/"
END IF

realPath = server.mappath(vpath)

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(realPath)

response.write f.Size & vbcrlf
response.write.realPath & vbcrlf
response.write vpath & vbcrlf
%>

it outputs the following:
34342323423 D:\www-roots\www.example.com.80/wwwroot/

the diskusage the real path the virtual path

I have written this..

# $d = det_dir_name();

$size = 0;
DIR = opendir $d

While (readdir DIR) {
next if /^\.\.?$/ ;
next if -d$_;
$size == -s $_;
}

print $size
print $d

cannot find a function for this det dir name...any ideas..and how I convert
this ASP SCRIPT ????


 
Reply With Quote
 
 
 
 
Barrett Clark
Guest
Posts: n/a
 
      07-08-2003
I think this may be more of a webserver question than a perl question.

Virtual server path sounds vaporish, and very Microsofty (given that you are
using ASP).

"kalusalu" <> wrote in message
news:KrpMa.38291$ le.rogers.com...
> Hello..I was browsing thru the newsgroups ...and was wondering if anyone
> here can be of assistance to me....as I am very very new to PERL..and have
> this ASP SCRIPT..I have to convert...
>
> <%
> 'Response.Content.Type = "text/plain"
> vpath = Request("vpath")
>
> IF vpath = "" then
> vpath = "/"
> END IF
>
> realPath = server.mappath(vpath)
>
> Set fs = CreateObject("Scripting.FileSystemObject")
> Set f = fs.GetFolder(realPath)
>
> response.write f.Size & vbcrlf
> response.write.realPath & vbcrlf
> response.write vpath & vbcrlf
> %>
>
> it outputs the following:
> 34342323423 D:\www-roots\www.example.com.80/wwwroot/
>
> the diskusage the real path the virtual path
>
> I have written this..
>
> # $d = det_dir_name();
>
> $size = 0;
> DIR = opendir $d
>
> While (readdir DIR) {
> next if /^\.\.?$/ ;
> next if -d$_;
> $size == -s $_;
> }
>
> print $size
> print $d
>
> cannot find a function for this det dir name...any ideas..and how I

convert
> this ASP SCRIPT ????
>
>



 
Reply With Quote
 
 
 
 
Sara
Guest
Posts: n/a
 
      07-08-2003
"kalusalu" <> wrote in message news:<KrpMa.38291$ ble.rogers.com>...
> Hello..I was browsing thru the newsgroups ...and was wondering if anyone
> here can be of assistance to me....as I am very very new to PERL..and have
> this ASP SCRIPT..I have to convert...
>
> <%
> 'Response.Content.Type = "text/plain"
> vpath = Request("vpath")
>
> IF vpath = "" then
> vpath = "/"
> END IF
>
> realPath = server.mappath(vpath)
>
> Set fs = CreateObject("Scripting.FileSystemObject")
> Set f = fs.GetFolder(realPath)
>
> response.write f.Size & vbcrlf
> response.write.realPath & vbcrlf
> response.write vpath & vbcrlf
> %>
>
> it outputs the following:
> 34342323423 D:\www-roots\www.example.com.80/wwwroot/
>
> the diskusage the real path the virtual path
>
> I have written this..
>
> # $d = det_dir_name();
>
> $size = 0;
> DIR = opendir $d
>
> While (readdir DIR) {
> next if /^\.\.?$/ ;
> next if -d$_;
> $size == -s $_;
> }
>
> print $size
> print $d
>
> cannot find a function for this det dir name...any ideas..and how I convert
> this ASP SCRIPT ????


Gooday:

First off try to get your organization off of ASP's- become part of
the solution not part of the problem. Bill isn't rich enough yet?

Having said that, a few variations on your idioms you might consider
(code is typed into the response panel - NOT TESTED!) :


#!(pathToPerl)/perl -w
# get used to using -w switch! And look at -T if you're writing CGI

use strict; # a great switch to use particularly for newbies

use diagnostics; # optional but gives you some nice wordy messages

# let's declare our vars
my $size = 0;

# let's be helpful to ourselves and signal problems? No?
# assumes $pathToDir was declared somewhere!
die "huh? what happened\n$!\n" unless opendir DIR, $pathtoDir;

# filtered arrays are much nicer to work with!
@d = grep !/^\.\.?$/, readdir DIR;

# close up this connection as soon as possible
closedir DIR;

# now I assume your trying to SUM the filesizes, ignoring directories?
# so I'd replace the == in your code with += if that's correct..

for (@d)
{next if -d $_;
$size += -s $_;
}
my $f = @d; # number of files
my $a = $size / $f; #average filesize for fun
print "total file size for $pathToDir is $size\n$f files, avergage
size $a\n";
print "Yes I love Perl- its everything that MS isn not!\n\n";
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CGI: Execute a perl script inside another perl script xdarcos@hotmail.com Perl Misc 20 01-18-2005 12:33 PM
Execute another perl script from my perl script Petterson Mikael Perl Misc 3 01-05-2005 01:31 PM
problem calling perl script from SOAP server perl script pj Perl Misc 3 04-09-2004 10:23 PM
Perl Help - Windows Perl script accessing a Unix perl Script dpackwood Perl 3 09-30-2003 02:56 AM
How to make Perl Script "POST" call from another Perl Script??? Wet Basement Perl 1 07-15-2003 10:25 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57