[24380] in Perl-Users-Digest
Perl-Users Digest, Issue: 6569 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat May 15 18:05:40 2004
Date: Sat, 15 May 2004 15: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 Sat, 15 May 2004 Volume: 10 Number: 6569
Today's topics:
Archive::Zip and File::Find error? <geoffacox@dontspamblueyonder.co.uk>
Re: Dynamic Menus in Perl <scobloke2@infotop.co.uk>
Re: Dynamic Menus in Perl <gnari@simnet.is>
Re: Finding all open filehandles and closing them befor <pb2@aracnet.com>
PHP/PERL User Manager with member directory (hans)
Sort an array + more <krzys-iek@-----wp.pl>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 15 May 2004 20:25:45 GMT
From: Geoff Cox <geoffacox@dontspamblueyonder.co.uk>
Subject: Archive::Zip and File::Find error?
Message-Id: <mvuca05mlbi37vpr2fj52q10ds02ln1c6k@4ax.com>
Hello
The following code should unzip all the zip files (which only contain
1 doc file each) in the folders within the d:/files folder. It isn't
working - where is it wrong?!
Thanks
Geoff
#!perl
use warnings;
use strict;
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
use File::Find;
my $dir = 'd:/files';
find sub {
#my $name = $_;
return if -d;
my $zip = Archive::Zip->new();
die "Error reading $name:$!" unless $zip->read( $name ) == AZ_OK;
$zip->read($_);
$zip->extractTree($name) ;
}, $dir;
------------------------------
Date: Sat, 15 May 2004 19:55:47 +0000 (UTC)
From: Ian Wilson <scobloke2@infotop.co.uk>
Subject: Re: Dynamic Menus in Perl
Message-Id: <40A6764C.8040406@infotop.co.uk>
Timothy Casey wrote:
> I am wondering if dynamic (multi-tiered dropdown/fold-out) menus are
> possible to impliment using a cgi/perl script.
They certainly are.
> A problem with CSS & large
> sites is remembering to edit the menu on every page! I imagine that a
> reference to a single perl script might simplify things.
It would. If the site content doesn't vary from day to day then I'd
consider using perl to edit menus into static HTML as part of my
publishing cycle.
> If so, are there any sample code/tutorials,
Have you tried Google?
> and what property or code can be
> implimented to allow the display of a menu to appear above and across frame
> boundaries.
Have you considered HTML layers? I'd examine the HTML & Javascript for
some sites that implement this type of menu.
> Alternatively, can a perl script be set up so that it does not have to be
> reloaded as the user browses from one page to another referencing the same
> script?
See caching directives in HTTP. A perl CGI script that outputs HTML can
include cache control directives in the headers it emits. However
browsers may ignore these if the URL looks dynamic (e.g. presence of
parameters in URL).
------------------------------
Date: Sat, 15 May 2004 21:28:53 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Dynamic Menus in Perl
Message-Id: <c861vk$gj5$1@news.simnet.is>
"Timothy Casey" <worIoq@iprimus.com.au> wrote in message
news:40a64e8a_1@news.iprimus.com.au...
> Alternatively, can a perl script be set up so that it does not have to be
> reloaded as the user browses from one page to another referencing the same
> script?
there are such things. my favorite is good old
Apache + mod_perl
gnari
------------------------------
Date: 15 May 2004 21:10:05 GMT
From: P Buder <pb2@aracnet.com>
Subject: Re: Finding all open filehandles and closing them before exiting
Message-Id: <c860vd01int@enews3.newsguy.com>
Rocco Caputo <troc@pobox.com> writes:
>> Also, keep in mind the number of FILE pointers you can have via the
>> perl open /C fopen can be less than the number of file descriptors via perl
>> sysopen/C open. In one version of Solaris you could have 256 FILE pointers but
>> 1024 file descriptors as I recall.
>I disagree. Multiple streams (FILE* in C) can refer to the same file
>descriptor. Check out the documentation for fdopen(3), which will
>create a new stream associated with an existing open descriptor.
>I can illustrate it in Perl. Here both the WHEE and STDIN file handles
>share descriptor 0.
> 1) poerbook:~% perl -wle 'open(WHEE, "<&=STDIN"); print fileno(STDIN); \
> print fileno(WHEE)'
> 0
> 0
>Closing the descriptor with POSIX::close() will close all the handles
>associated with it. It's "sneaky" enough that Perl won't give you the
>"print() on closed filehandle" warning.
> 1) poerbook:~% perl -wle 'use POSIX; open(WHEE, ">&=STDOUT"); \
> POSIX::close(fileno(WHEE)); print "narf"'
> 1) poerbook:~%
That may all be true but doesn't change the fact that in that version of
Solaris, the maximum number of FILE pointers was 256, presumably
because they were storing the number in an 8 bit unsigned char. Whereas
there could be over 1000 file descriptors. This bit me once years ago.
I had to skip standard IO and use raw file descriptors for that project.
------------------------------
Date: 15 May 2004 13:18:21 -0700
From: simplyred@gmx.de (hans)
Subject: PHP/PERL User Manager with member directory
Message-Id: <1e842472.0405151218.512213e7@posting.google.com>
Hello everybody,
I was searching on "www.freshmeat.net", "www.hotscripts.com", etc. but
I could not find anything.
I am searching for a web based user-manager (php/perl, mysql) with one
major feature:
There is one login-screen (like the login at a provider) to enter the
login-name and the password. If the user will log-in, he gets his
personal directory - based on the login-name, or other criteria.
Two examples:
Login: Hugo
Password: test
After the login, the user will see the content of the follow
directory:
/home/usr/..../downloads/Hugo/index.htm
Login: Master
Password: test
/home/usr/..../downloads/Master/index.htm
Some further wishes for the admin-area:
- no automatic registration functions
- free design of the htm-files (with css)
- unlimited (min. 100) users
- accounts with real names, not only the short names of the htpass
Does anybody know a php/perl script (cheaper than 1000,-$ ;-)) with
these functions?
Regards Hans
Did anybody know a user-manager with this function
------------------------------
Date: Sat, 15 May 2004 22:29:34 +0200
From: "krzys-iek" <krzys-iek@-----wp.pl>
Subject: Sort an array + more
Message-Id: <c85uk5$l5b$1@atlantis.news.tpi.pl>
Hi
I try to rewrite my AWK/BASH script (you can see it here:
www.krionix.net/perl/ - aw file)
This script reads passwd file (included there too) and displays only those
people we want.
They are placed in a nice, neat table.
You can run this script like that: ./aw 1000 1
And 1000 is a group ID, we will see only people with GID=1000.
1 is a sorting rule (sort by login name, 2 sort by name, 3 sort by surname).
So we will see sorted (by login) people with GID 1000.
OK, now I would like to rewrite this script and use only PERL language no
bash etc.
I have written something like this:
------------------------------------------
#!/usr/bin/perl -w
$file = 'passwd';
open(INFO, $file);
while (<INFO>)
{
chomp;
(m/^([a-zA-Z0-9_]*):x:[0-9]+:$ARGV[0]:/) && (push @ludzie_z_1000, $_);
}
# @ludzie_z_1000 = sort @ludzie_z_1000;
foreach (@ludzie_z_1000)
{
m/^([a-zA-Z0-9_]*):x:[0-9]+:$ARGV[0]:([^:,]*).*/;
print "$1 | ";
$_=$2;
m/^([^ ]*) (.*)/;
print "$1 | $2\n";
}
----------------------------------------
You can run it like that: ./script 1000
This perl script works but I got stuck...
I do not how to sort it with perl sort function ( I must sort it by login or
name or surname!).
Can you help me how to do that? I can not use linux sort function (as in my
./aw script... damn)
@ludzie_z_1000 = sort @ludzie_z_1000;
this solves only sorting by login but what about name and surname?:/
Next question, How can I do something like that:
printf "| %3s %2s %10s %2s %11s %2s %15s %2s \n", ile+1, "|", $1, "|", $2,
"|", $3, "|"; ile+=1;}
with perl language? You know, now my table does not look nice...
rafit | Rafal | Tomczak
serwik | S | Serwik
sq6elt | Pawel | Jarosz
tyciu | Mateusz | Tykierko
This is a neat table/array I want :)
rafit | Rafal | Tomczak
serwik | S | Serwik
sq6elt | Pawel | Jarosz
tyciu | Mateusz | Tykierko
Thank you!
------------------------------
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 6569
***************************************