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

Ask a Question related to PERL Miscellaneous, Design and Development.

  1. #1

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

    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\[url]www.example.com.80/wwwroot/[/url]

    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 ????


    kalusalu Guest

  2. Similar Questions and Discussions

    1. RFC on first perl script
      Hi all well im trying at lerning this perl stuff.. reading from the "learning perl" oreilly book and a few other places, but also using perl a...
    2. Control a non-perl image viewer from perl script
      Below is a (non-finished) script that trys to run a linux viewer called eog (eye of gnome) in a script that will eventually allow me to power thru...
    3. ASP --> PERL SCRIPT
      try using $ENV{THIS_SCRIPT}
    4. Help with Perl Script
      Any help on this would be great since its a free script there is no support. I have a website on a win2k server running MSFP 2002 extensions. The...
    5. Execute shell script from a perl script
      Hi, How can I executed a Unix shell script from a Perl script. The shell script is a dump of a oracle table to a file. The perl script is for...
  3. #2

    Default Re: ASP --> PERL SCRIPT HELP>>PLEASE>>

    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" <jessanik@rogers.com> wrote in message
    news:KrpMa.38291$2ay.28126@news01.bloor.is.net.cab 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\[url]www.example.com.80/wwwroot/[/url]
    >
    > 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 ????
    >
    >

    Barrett Clark Guest

  4. #3

    Default Re: ASP --> PERL SCRIPT HELP>>PLEASE>>

    "kalusalu" <jessanik@rogers.com> wrote in message news:<KrpMa.38291$2ay.28126@news01.bloor.is.net.ca 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\[url]www.example.com.80/wwwroot/[/url]
    >
    > 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";
    Sara Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139