[26275] in Perl-Users-Digest
Perl-Users Digest, Issue: 8457 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 26 09:05:20 2005
Date: Mon, 26 Sep 2005 06:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 26 Sep 2005 Volume: 10 Number: 8457
Today's topics:
[OT] Re: Script for migrating HTML tree into a single d <1usa@llenroc.ude.invalid>
Re: How do I get more-detailed directory info? <rprp@gmx.net>
Re: How do I get more-detailed directory info? <jurgenex@hotmail.com>
Re: How do I get more-detailed directory info? <tadmc@augustmail.com>
Re: problem with perldoc <tosoAplos@earth.space>
Re: Script for migrating HTML tree into a single direct <pertti.kosunen@pp.nic.fi>
Re: Script for migrating HTML tree into a single direct <noreply@gunnar.cc>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 26 Sep 2005 11:35:54 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: [OT] Re: Script for migrating HTML tree into a single directory ?
Message-Id: <Xns96DD4D4C8F65asu1cornelledu@127.0.0.1>
Pan Am <panam@nospam.com> wrote in
news:1127718782.dec091df8ad9e40ce5405a7cc5f29972@teranews:
> On Fri, 23 Sep 2005 13:13:35 -0400, Stan Brown wrote:
>
>> Frankly, that statement stuns me. Or are you using some "hosting
>> service" that will wrap your actual pages in a lot of ads and
>> Javascript and similar crap?
>
> not really... having very limited needs I use a free service: no
> ads, limited space, single directory. Very basic, but ok for me.
...
> The script could prefix filenames to avoid duplications...
Think about the value of time involved in writing such script -
including parsing HTML and replacing all the hyperlinks.
If that value is more than $36, then you might want to look at the
Starter package offered by Digitalspace:
http://www.digitalspace.net/webhosting/index.php
(And, no there is no monetary gain to me if you choose it). I have been
using this for my personal web pages for a while now, and I am quite
pleased.
I know writing a script that does what you want would take me more than
an hour, making the paid hosting option very attractive.
Hope this helps.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Mon, 26 Sep 2005 12:31:59 +0200
From: Reinhard Pagitsch <rprp@gmx.net>
Subject: Re: How do I get more-detailed directory info?
Message-Id: <4337ce20$0$49012$14726298@news.sunsite.dk>
Robbie Hatley wrote:
> Greetings, group. This is the first time I've posted here,
> or in any Perl-related forum for that matter. I'm a rank
> beginner at Perl. I'm trying to teaching myself the language
> from reading books (incl. one with a camel on the cover, and
> one with a llama; not that anyone here would recongize those,
> of course), trying my own Perl hacks, and struggling
> with compiler errror messages.
>
> The training program I'm currently trying to write is a
> duplicate-file finding/removing program. A rather elaborate
> program when written in C++. An engineer friend told me it
> would be much simpler in Perl. I had to tell him, "Cool, but
> I don't know Perl". He seemed offended and said "Your loss.".
>
> So... pasted below is my first (incomplete) attempt at writing
> a real Perl program.
>
> I have hundreds of questions about Perl, but for now I'll
> ask this group just two questions:
>
> 1:
> How do I get a more-detailed directory listing than is offered
> by the readdir function? Is their any way to goad that
> function into coughing-up file-type (file or directory or link),
> size in bytes, mod-time, mod-date, attribtutes, etc.? Or do I
> have to use some other approach to get that data?
>
> 2:
> Is there a better way to emulate the C++ concept of a "list of
> structs" than what I'm doing below? (I'm using an array of refs
> to hashes.)
>
>
[ code snipped ]
Here is an example:
Where to look:
perldoc -f stat (more detailed informations about a file)
perldoc perldsc, Perl Data Structures Cookbook (ARRAYS OF HASHES)
--- code---
use Cwd;
use strict;
my $CurDir = getcwd();
print "CWD = ", $CurDir, "\n";
opendir(DOT, ".") or die "Can\'t open the directory!!!";
my @LocalFiles;
my $FileName;
my @files = readdir(DOT);
my $Rec;
foreach (@files)
{
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks) = stat($_);
my $FileRecord = {};
$FileRecord->{Date} = "Unknown";
$FileRecord->{Time} = $mtime;
$FileRecord->{Type} = $mode;
$FileRecord->{Size} = $size;
$FileRecord->{Attr} = "Unknown";
$FileRecord->{Name} = $_;
push(@LocalFiles, $FileRecord);
}
closedir(DOT);
my $role;
foreach $Rec (@LocalFiles)
{
print "{ ";
for $role (keys %$Rec)
{
print "$role=" . $Rec->{$role} . " ";
}
print " }\n";
}
--- code ---
--
regards,
Reinhard
------------------------------
Date: Mon, 26 Sep 2005 12:34:48 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: How do I get more-detailed directory info?
Message-Id: <IVRZe.4247$WT3.466@trnddc03>
Robbie Hatley wrote:
> 1:
> How do I get a more-detailed directory listing than is offered
> by the readdir function? Is their any way to goad that
> function into coughing-up file-type (file or directory or link),
> size in bytes, mod-time, mod-date, attribtutes, etc.? Or do I
> have to use some other approach to get that data?
Those data are informations about individual files. See stat() and/or the
file test operators (e.g. -M, -f, ...)
> 2:
> Is there a better way to emulate the C++ concept of a "list of
> structs" than what I'm doing below? (I'm using an array of refs
> to hashes.)
I think that's the most perlish way.
jue
------------------------------
Date: Mon, 26 Sep 2005 07:59:15 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: How do I get more-detailed directory info?
Message-Id: <slrndjfs53.e06.tadmc@magna.augustmail.com>
Robbie Hatley <bogus.address@no.spam.com> wrote:
> and struggling
> with compiler errror messages.
It may help to lookup the messages in
perldoc perldiag
> 1:
> How do I get a more-detailed directory listing than is offered
> by the readdir function? Is their any way to goad that
> function into coughing-up file-type (file or directory or link),
> size in bytes, mod-time, mod-date, attribtutes, etc.?
perldoc -f stat
perldoc -f -X
Be sure to pay close attention to
perldoc -f readdir
particularly the part that starts with
If you're planning to filetest the return values out of a "readdir"...
> # Plan: Recursively decend directory tree starting from current working
> directory,
perldoc File::Find
> opendir(Dot, ".") or die "Can\'t open the directory!!!";
You should include the $! variable in your die() message.
There is no need to backslash a single quote in a double quoted string.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 26 Sep 2005 10:30:49 +0000 (UTC)
From: "Apostolos P. Tsompanopoulos" <tosoAplos@earth.space>
Subject: Re: problem with perldoc
Message-Id: <dh8iko$1jp8$1@ulysses.noc.ntua.gr>
On Êõñ, 25 Óåð 2005 at 19:35 GMT, axel@white-eagle.invalid.uk wrote:
> Sherm Pendley <sherm@dot-app.org> wrote:
>> Tad McClellan <tadmc@augustmail.com> writes:
>
>>> Apostolos P. Tsompanopoulos <tosoAplos@earth.space> wrote:
>
>>>> I have only v5.8.3 installed *BUT* (maybe
>>>> during the upgrade) I probably forgot to upgrade perl-doc(s), which
>>>> is v5.8.1
>
>>> The perldoc program and the *.pod files are part of a normal install,
>>> so they should have been already upgraded.
>
>> They're part of a normal manual install, but some Linux distributions
>> break the docs out into separate optional packages.
>
> Mandrake being one I found out much to my annoyance.
>
> Axel
Bingo!
This is indeed a Mandrake 9.2 system and perl was installed by rpm. I
upgraded the perl-doc package and now everything is ok again :-)
The good thing was that using PERL5LIB as the docs suggested, worked
also, but having the same version for the whole package is better
(and safer).
Apostolos
--
Replace earth.space with gmail.com for a valid e-mail
------------------------------
Date: Mon, 26 Sep 2005 11:36:37 GMT
From: Pertti Kosunen <pertti.kosunen@pp.nic.fi>
Subject: Re: Script for migrating HTML tree into a single directory ?
Message-Id: <93RZe.127$Jx3.83@read3.inet.fi>
Pan Am wrote:
> My Web hosting service does not support multiple directories...
> Can anyone suggest a Unix script that traverses a HTML tree and
> produces a working "single directory" version of the same?
Not perl but "wget --no-directories ..." might do the job.
------------------------------
Date: Mon, 26 Sep 2005 14:11:48 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Script for migrating HTML tree into a single directory ?
Message-Id: <3pq6s4Fbki4dU1@individual.net>
Pertti Kosunen wrote:
> Pan Am wrote:
>> My Web hosting service does not support multiple directories...
>> Can anyone suggest a Unix script that traverses a HTML tree and
>> produces a working "single directory" version of the same?
>
> Not perl but "wget --no-directories ..." might do the job.
Such a limited hosting account does most likely not offer shell access...
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 8457
***************************************