in reply to Working with folders in Perl and HTML

Hello LinuxNoob and welcome to the monastery and to the wonderful world of Perl!

well design, program and test a web interface it is not simple as you said: more, if i understand it correctly, if you want the webserver on Linux and retrieve folders statistics from a win2k12 remote server..

If, by other hand, the webserver is on the windows machine itself, this can be easier.

First install StrawberryPerl on the machine. Now you can use cpan client to install modules as in linux, because strawberry perl comes with a running compiler and many other goodies.

Then you need to learn how to serve html pages: there are many different possibilities and among them Apache for windows. Apache has it's learning curve but is affordable.

Then you have to write your web application: there are a zillion of possibilities of doing this using Perl: you can search and install (via cpan client) Dancer2 as easy way to start with. Another learning curve.

If security is not an issue (well it is always an issue, but let's say you are in a protected env with strong firewall rules etc..) and you need some quick and dirty solution you can resolve with 2 lines of Perl (using UnxUtils to have du usable and Plack via cpan to have plackup at your disposal):

# spaces added for readability # use a perl oneliner to have a minimal output redirected to an index. +html file # it print the folder name, the output of du -csh and mtime a nd ctime + from perl's stat builtin, finally a horizontal rule tag perl -lE "print $_.' '.`du -csh $_`,join' ',map{scalar localtime($_)}( +stat ($_))[9..10].'<hr>' for @ARGV" c:\scripts\chart c:\SCRIPTS\csidl > index.html # use plackup to start a webserver listening on port 5000 plackup -p 5000 -MPlack::App::Directory -e "Plack::App::Directory->new +({root => q{.}})->to_app" # point your browser at the index start http://localhost:5000/index.html # enjoy the result! c:\scripts\chart 35K c:\scripts\chart 35K total Thu Apr 19 14:06 +:24 2012 Tue Apr 10 17:31:54 2012 ---------------------------------------------------------------------- +--------------------------------- c:\SCRIPTS\csidl 16K c:\SCRIPTS\csidl 16K total Thu Apr 19 14:06 +:24 2012 Tue Apr 10 17:31:55 2012 ---------------------------------------------------------------------- +---------------------------------

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: Working with folders in Perl and HTML
by Lotus1 (Vicar) on May 29, 2017 at 14:20 UTC

    You are using (stat)[10] to get the ctime which I didn't think would work on Win32 systems. It says in the documentation for stat:

    (*) Not all fields are supported on all filesystem types. Notably, the ctime field is non-portable. In particular, you cannot expect it to be a "creation time"; see Files and Filesystems in perlport for details.

    In perlport it states:

    ctime is creation time instead of inode change time (Win32).

    Thanks for posting.

Re^2: Working with folders in Perl and HTML
by LinuxNoob (Initiate) on Jun 05, 2017 at 22:42 UTC
    Hello Discipulus, Sorry for the delay, your method seems to be very helpful, I'm gonna try to use it and will let you know about the result. Thanks much!