[18313] in Perl-Users-Digest
Perl-Users Digest, Issue: 481 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 13 14:16:14 2001
Date: Tue, 13 Mar 2001 11:15:46 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <984510946-v10-i481@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 13 Mar 2001 Volume: 10 Number: 481
Today's topics:
Re: Formatting HTML using Perl <wizard@psychodad.com>
Re: Formatting HTML using Perl (Malcolm Dew-Jones)
Re: from SETL to Perl <mischief@velma.motion.net>
Re: from SETL to Perl (Jay Tilton)
Re: Help Needed With CGI/PERL (Malcolm Dew-Jones)
Re: Help to Install Perl <webmaster@webdragon.munge.net>
Re: Help with integration problem between CGI Perl and (Rob Seegel)
Re: How to use result of grep as an array? (Tad McClellan)
Html logon??? <vatsupport@ukonline.co.uk>
Re: Html logon??? nobull@mail.com
Re: I need to graph some data <ciaran.mccreesh@useaddressbelow.please>
Re: looking for a script to count downloads nobull@mail.com
LWP problem <djmarcus@ex-pressnet.com>
Re: LWP problem <abc@def.com>
Re: LWP problem <djmarcus@ex-pressnet.com>
Re: Macbeth and Perl threads (Rocco Caputo)
Re: perl2exe performance problem <uwe_sprave@hp.com>
Running a UNIX command from inside a perl script <bixby@americasm01.nt.com>
Re: Running a UNIX command from inside a perl script <tony_curtis32@yahoo.com>
Re: Set Passwords on AIX <bowman@montana.com>
Re: Set Passwords on AIX <galen.menzel@mail.utexas.edu>
Re: stat/-X for symlinks ??? <mischief@velma.motion.net>
Re: stat/-X for symlinks ??? <mischief@velma.motion.net>
Re: subroutine recursion? (Tramm Hudson)
want create `my' arrays whose names are stored in an ar (Walter Tautz [MFCF])
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 13 Mar 2001 08:07:25 -0600
From: "Michael D. Kirkpatrick" <wizard@psychodad.com>
Subject: Re: Formatting HTML using Perl
Message-Id: <3AAE299D.F1E676A2@psychodad.com>
Nuet Lareton wrote:
> Yeah, I have Homesite and FP (yech) and they both do codesweepers of a
> sort, but I wanted to see the perl method of doing it. Mostly as an
> exercise on if I could write it or on using methods and Modules. I
> know the mantra of perl is that there are a million ways of doing even
> the simplest tasks, I would like to see if what I described would be
> going in the right direction or to look at a module and see the guts
> of it and see how it handles the job. Then find a way to apply it to
> the situation. I have been working like a bugger to try to learn perl.
> =)
>
> Nuety
Wow, I personally don't bother with formatting HTML in perl myself. I
suppose if I wanted to, I probably could write something that would do it,
but I don't have the desire to do that. Since HTML has beginning and
ending tag markers, you can use that to your advantage for indenting the
code... You will have to know all the HTML rules. Like <P> does not
necessarily have to have a </P> tag. Some HTML code editors like Claris
Home Page gives you the option to omit the </P> in code. The worse part
of doing this type of project is trying to come up with all
contingencies. I would say start writing the program and ask questions as
you go along. When you encounter areas you are not familiar with, ask
about those areas. Have patients since it will probably take you several
days to complete this project.
------------------------------
Date: 13 Mar 2001 09:48:23 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Formatting HTML using Perl
Message-Id: <3aae5d67@news.victoria.tc.ca>
Nuet Lareton (phibeta@newsguy.com) wrote:
: On Mon, 12 Mar 2001 16:18:44 -0600, "Michael D. Kirkpatrick"
: <wizard@psychodad.com> wrote:
: >Nuet Lareton wrote:
: <snippage>
: >> Thanks guys.
: >> Nuety
: >A typical HTML editor like Claris Home Page or Hot Metal will
: >automatically format the HTML that way. Check it out...
: Yeah, I have Homesite and FP (yech) and they both do codesweepers of a
: sort, but I wanted to see the perl method of doing it. Mostly as an
: exercise on if I could write it or on using methods and Modules. I
: know the mantra of perl is that there are a million ways of doing even
: the simplest tasks, I would like to see if what I described would be
: going in the right direction or to look at a module and see the guts
: of it and see how it handles the job. Then find a way to apply it to
: the situation. I have been working like a bugger to try to learn perl.
: =)
CPAN has various HTML parsing modules. One is called HTML Parser.
It will do what you want.
It used in long ago, so my recollection may be hazy. Each tag can have an
event handler. Because it's OO you only need to write one handler, all
the tags can use it.
If the handler simply prints the text of the tag as it handles it then
your parser code would basicaly just reproduce the original document. (I
forget how the text between tags is handled - but the pod will say.)
Once that's working then have the handler check the name of the tag and
(depending on the tag) add a new line and an indent, and have a few
variables to keep track of the indentation.
------------------------------
Date: Tue, 13 Mar 2001 16:47:34 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: from SETL to Perl
Message-Id: <tasjp6lcgmsea6@corp.supernews.com>
Damian James <damian@qimr.edu.au> wrote:
> Thus spake Jay Tilton on Mon, 12 Mar 2001 20:12:29 GMT:
>>On Sun, 11 Mar 2001 23:58:42 -0500, "cyberian bear"
>><cyberian_bear@hotmail.com> wrote:
>>
>>>The thing is, if at least I knew what the
>>>'Euler path construction', or 'Prime factors' are, I could just program them
>>>on my own without looking at the SETL code, but i don't.
>>
>>You would do yourself a great favor by researching them. Neither
>>concept is especially difficult to grasp. In fact, this would be more
>>appropriately posted to a math newsgroup. Since SETL is a
>>mathematics-oriented language, you might even find a SETL guru there,
>>if there is such a beast.
>>
> It's probably worth pointing out that _Mastering Algorithms with Perl_
> by Jon Orwant, Jarkko Hietaniemi & John Macdonald includes discussions on
> both Euler paths and prime factors. It even includes example Perl
> implementations of algorithms to calculate them. While it might not be the
I'm sure Knuth covers them, too. Any good introductory
algorithms book should cover at least the prime factors
if not both of these. Any algorithms book meant for more
than one level of programmer is sure to have both.
Chris
--
Christopher E. Stith
You must not lose faith in humanity. Humanity is an ocean;
if a few drops of the ocean are dirty, the ocean does not
become dirty. -- Mohandas K. Gandhi
------------------------------
Date: Tue, 13 Mar 2001 19:00:02 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: from SETL to Perl
Message-Id: <3aae6cfd.80479629@news.erols.com>
On 13 Mar 2001 02:33:39 GMT, damian@qimr.edu.au (Damian James) wrote:
>It's probably worth pointing out that _Mastering Algorithms with Perl_
>by Jon Orwant, Jarkko Hietaniemi & John Macdonald includes discussions on
>both Euler paths and prime factors. It even includes example Perl
>implementations of algorithms to calculate them.
Good catch. The code desired might even be in the book's 'examples'
download, acessible from the O'Reilly site.
------------------------------
Date: 13 Mar 2001 09:32:19 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Help Needed With CGI/PERL
Message-Id: <3aae59a3@news.victoria.tc.ca>
nobody@nowhere wrote:
: Hello Friends
: Can any one help me how can i run perl And work with CGI on
: Windows 2000 (NT5) ?
try www.activestate.com
------------------------------
Date: 13 Mar 2001 19:00:50 GMT
From: "Scott R. Godin" <webmaster@webdragon.munge.net>
Subject: Re: Help to Install Perl
Message-Id: <98lqp2$lpn$0@216.155.33.44>
In article <3aad414e.4776465@news.mco.edu>, avast@hortonsbay.com wrote:
| On Sat, 10 Mar 2001 07:43:54 GMT, "Suzanne" <dream1625@aol.com> wrote:
|
| >hmmmm .... a classic case of top-posting obsession disorder ... relax
| >Scott,
| >take a deep breath ... seek a 12-step anti-top-posting support group,
| >and
| >when all else fails:
| >Never sweat the petty things and
| >Never pet the sweaty things!
|
| As a long-time lurker I've found that elements of this newsgroup have
| an extremely mean-spirited streak to them. The more you stick around
| I'm sure you'll see what I mean. I frequent other newsgroups, mostly
| lurking for info and this particular newsgroup beats them all for
| meaness and a slathering anality for their rules. They'll claim that
| without these "rules" the group would descend into chaos. Oh well.
| They're also particularly anal about sticking to the topic at hand,
| namely Perl, except for threads like this for which they're more than
| willing abandon their rules. It's quite a hoot to watch them in their
| red-faced, forehead vein-popping frenzies, doncha think?
Personally I think neither of you has a clue as to the actual tone and
spirit and intent of the reply I made. Oh well. Smoke another one, it
might help... :)
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: 13 Mar 2001 14:43:49 GMT
From: robseegel@aol.com (Rob Seegel)
Subject: Re: Help with integration problem between CGI Perl and JavaScript
Message-Id: <20010313094349.03888.00000172@ng-mn1.aol.com>
>Can anyone give me any pointers in the right way to go about solving this.
Sure - when you're generating output
using CGI you've got complete control
over what's sent back, what's to stop
you from doing something like the
following in the html you send back?
<!--
var JScriptArray = new Array(
"This is the first line of my file",
"This is the second line",
"And the third",
"And so on, and so on..."
)
//-->
Rob
------------------------------
Date: Tue, 13 Mar 2001 09:58:03 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How to use result of grep as an array?
Message-Id: <slrn9asdbr.v9l.tadmc@tadmc26.august.net>
Chris Allen <chris@cjx.com> wrote:
>However, I would like to be able to do
>something like:
>
>$found = ${grep /^aa/,@foo}[1]; # (obviously) doesnt work
^ ^^^^^^^^^^^
But if it did work, wouldn't you want a zero there?
Or did you mean to grab the second match?
>using the result of grep directly as an array,
^^^^^^^^^^^
You mean "as a list", I think. There is a distinction.
Perl FAQ part 4:
"What is the difference between a list and an array?"
>and saving me from having to use @found.
What you seek is called a "list slice" (an "array slice" is similar
yet different).
>Is this possible, and if so can anybody point me
>to the right documentation that would help me?
see the "Slices" section in perldata.pod.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 13 Mar 2001 16:38:45 -0000
From: "PaulTargett" <vatsupport@ukonline.co.uk>
Subject: Html logon???
Message-Id: <yasr6.212542$Dd3.2793932@monolith.news.easynet.net>
I have created a CGI script that will enable myself to logon using a
HTaccess file popup screen. I am now wondering
how I can enable a web page based logon screen to point to the htpasswd file
to retrieve the username
and password to log on.
Does anyone know how to do this???
Paul T
paulandrewt@ukonline.co.uk
------------------------------
Date: 13 Mar 2001 17:53:06 +0000
From: nobull@mail.com
Subject: Re: Html logon???
Message-Id: <u9d7bl8sjh.fsf@wcl-l.bham.ac.uk>
"PaulTargett" <vatsupport@ukonline.co.uk> writes:
> I have created a CGI script that will enable myself to logon using a
> HTaccess file popup screen.
Huh? HTTP basic authentication is handled by the HTTP server -
this happens at an earlier phase of HTTP request handling than the
point at which CGI gets involved.
> I am now wondering how I can enable a web page based logon screen to
> point to the htpasswd file to retrieve the username and password to
> log on.
I assume by "web page based logon screen" you mean "an HTML form and
CGI script that act as a logon screen".
I assume by "point to the htpasswd file to retrieve the username and password to
log on" you mean "validate the username/password against the htpasswd
file".
I assume by "enable" you mean "write".
You may want to take a look as HTTPD::Realm
That said I think what you are doing is probably a bad idea. If you
are not using HTTP basic authentication then I don't see any reason to
use htpasswd files.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 13 Mar 2001 06:34:24 +0000
From: Ciaran McCreesh <ciaran.mccreesh@useaddressbelow.please>
Subject: Re: I need to graph some data
Message-Id: <HoHr3MAw9br6IwC2@harlawroad.freeserve.co.uk>
In article <3aae15b3.126289838@news3.mylinuxisp.com> (whatever that
means), cRYOFAN <cryofan@mylinuxisp.com> writes
>Should I use javascript or perl or what? If perl, then what is the
>easiest way to test if the server has the perl modules I need?
You could just try things and see if you get 500 errors... Or if you
have permission you could get a directory listing of the library path...
>I don't know any javascript.
>
>Any thoughts on how to best do this?
If I understand you correctly, maybe you could use a series of images
and override the sizes with HTML attributes width= and height= ? Messy,
but it works...
HTH,
Ciaran
--
Ciaran McCreesh
mail: keesh@users.sourceforge.net
web: http://www.opensourcepan.com/
------------------------------
Date: 13 Mar 2001 17:41:31 +0000
From: nobull@mail.com
Subject: Re: looking for a script to count downloads
Message-Id: <u9g0gh8t2s.fsf@wcl-l.bham.ac.uk>
"Teun" <jaap@microsoft.com> writes:
> "Richard Wilkerson" <rw@dreamgate.com> schreef in bericht
> news:3aab19dc.27320310@news.telocity.com...
> > Hi,
> >
> > I need a script that will count and log the number times a pdf file
> > is downloaded by a visitor.
> >
> > I realize the basic perl for this pretty simple and straightforward,
> > open the file, find the number, add one and close.
> >
> > But how would the visitor selecting a hyperlink initiate this
> > counting in the first place?
>
> How about you let him click on a link like this:
> http://domain.com/cgi-bin/count_downloads.pl?the_file_to_download.ext
>
> count_downloads.pl would then be the script to read the file and write it to
> the client.
Unless you put in a _lot_ of effort into doing it right then this is a
very anti-social approach. It breaks re-startable downloads and
caching. Better to put the download file in a directory that is
logged and has caching preferences that force revalidation against the
origin server always. To get the download count you periodically
parse the log.
Alternative approach is to have a CGI script increments the counter
file then does an _internal_ redirect to the true, secret URL of the
PDF file.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 13 Mar 2001 12:23:07 -0500
From: "David J. Marcus" <djmarcus@ex-pressnet.com>
Subject: LWP problem
Message-Id: <taslrnclsis004@corp.supernews.com>
Hi
I am new to Perl (very impressed and love it so far). I do have a lot of
experience in other languages (c/c++, java, mumps, etc).
I am trying to access a common website (www.yahoo.com).
I downloaded 5.6 (for Windows) and CPAN.
I tried the simple program provided on CPAN:
use LWP:Simple;
my $content = get("http://www.yahoo.com");
print "LWP::Simple: get of Yahoo: ", $content, "\n";
I get an error (apparently after the operation times out):
Request failed: Can't connect to www.yahoo.com:80 <Bad hostname
'www.yahoo.com'>
I am running on Windows 2000.
I am able to access the internet via the browser and other programs
including custom ones written in C++/MFC.
I have tried using a network sniffer to see what packets go out, but it
doesn't look like anything goes out.
I am wondering if there are some settings that I need to initialize to get
things to work.
Any help would be greatly appreciated.
-TIA
David
------------------------------
Date: Tue, 13 Mar 2001 18:45:32 +0100
From: HP <abc@def.com>
Subject: Re: LWP problem
Message-Id: <XZsr6.1255$341.4484@nntpserver.swip.net>
David J. Marcus wrote:
> Hi
>
> I am new to Perl (very impressed and love it so far). I do have a lot of
> experience in other languages (c/c++, java, mumps, etc).
>
> I am trying to access a common website (www.yahoo.com).
>
> I downloaded 5.6 (for Windows) and CPAN.
>
> I tried the simple program provided on CPAN:
> use LWP:Simple;
> my $content = get("http://www.yahoo.com");
> print "LWP::Simple: get of Yahoo: ", $content, "\n";
>
> I get an error (apparently after the operation times out):
> Request failed: Can't connect to www.yahoo.com:80 <Bad hostname
> 'www.yahoo.com'>
>
> I am running on Windows 2000.
>
> I am able to access the internet via the browser and other programs
> including custom ones written in C++/MFC.
>
> I have tried using a network sniffer to see what packets go out, but it
> doesn't look like anything goes out.
>
> I am wondering if there are some settings that I need to initialize to get
> things to work.
>
> Any help would be greatly appreciated.
>
> -TIA
> David
>
>
Works for me on my linux system (LWP:Simple->LWP::Simple)
HP
------------------------------
Date: Tue, 13 Mar 2001 12:55:15 -0500
From: "David J. Marcus" <djmarcus@ex-pressnet.com>
Subject: Re: LWP problem
Message-Id: <tasnnuoaggmgb4@corp.supernews.com>
Hi
Any suggestions on how to figure out what's going on and hopefully solve the
problem would be greatly appreciated. I have no doubt that on some systems
the simple program simply works.
-TIA
David
"David J. Marcus" <djmarcus@ex-pressnet.com> wrote in message
news:taslrnclsis004@corp.supernews.com...
> Hi
>
> I am new to Perl (very impressed and love it so far). I do have a lot of
> experience in other languages (c/c++, java, mumps, etc).
>
> I am trying to access a common website (www.yahoo.com).
>
> I downloaded 5.6 (for Windows) and CPAN.
>
> I tried the simple program provided on CPAN:
> use LWP:Simple;
> my $content = get("http://www.yahoo.com");
> print "LWP::Simple: get of Yahoo: ", $content, "\n";
>
> I get an error (apparently after the operation times out):
> Request failed: Can't connect to www.yahoo.com:80 <Bad hostname
> 'www.yahoo.com'>
>
> I am running on Windows 2000.
>
> I am able to access the internet via the browser and other programs
> including custom ones written in C++/MFC.
>
> I have tried using a network sniffer to see what packets go out, but it
> doesn't look like anything goes out.
>
> I am wondering if there are some settings that I need to initialize to get
> things to work.
>
> Any help would be greatly appreciated.
>
> -TIA
> David
>
>
------------------------------
Date: 13 Mar 2001 18:49:05 GMT
From: troc@netrus.net (Rocco Caputo)
Subject: Re: Macbeth and Perl threads
Message-Id: <slrn9asqs7.10b1.troc@eyrie.homenet>
On Fri, 9 Mar 2001 23:40:51 +0100, Peter van den Hamer <vdhamer@msn.com> wrote:
>
>Context: what I am trying to do is write a multi-threaded
>ping program which creates New threads for each site
>to be pinged. The results are written to a log file of the
>following format:
>
>[stuff deleted - best viewed in a fixed width font]
I've written a multi-host ping program in perl without threads.
Have you seen poing? http://poe.perl.org/poegrams/index.html#poing
-- Rocco Caputo / troc@netrus.net / poe.perl.org / poe.sourceforge.net
------------------------------
Date: Tue, 13 Mar 2001 17:36:11 +0100
From: Uwe Sprave <uwe_sprave@hp.com>
To: ac <clarke@hyperformix.com>
Subject: Re: perl2exe performance problem
Message-Id: <3AAE4C7B.12927FE5@hp.com>
Hi Allan
Thanks for your explanation.
I am quite sure that loading the files maybe somehow the key problem.
Perl-wrappers like PerlApp and perl2exe will load an overhead compared
to the perl interpreter that loads modules by require and use statements
when the interpreter 'sees' the statement. The exe version always loads
all modules, if needed or not.
I did use the PerlApp but it did not run my compiled application! The
runtime simply aborts with errors and ActiveState is not responsive to
my support question over months now. Even standard modules they deliver
(HTML/Element.pm) do not compile and ActiveState is not able to comment
this fact since Tue Jan 2 07:58:25 2001 ( see
http://bugs.activestate.com/ActivePerl/incoming?id=1487, still type
incoming).
So I tried perl2exe and this runs fine.
I have added the filesizes and would think that the sizes do not force
the execution time to nearly double! I think the operating systems disk
cache should buffer the load time after the first load as well. I see no
effect on this front.
Still puzzling...
Uwe
ac wrote:
>
> I use PerlApp from Activestate, but I'll give you some educated guesswork.
> PerlApp and Perl2Exe do not "compile" Perl, they bundle it together. You
> will never see a performance gain by using these products.
>
> Usually the bundling mechanism results in slower startup times. That is,
> when the exe is invoked, the required files that were bundled into the exe are
> now unbundled on the fly into a temp area. This will account for almost all of
> your slowdown.
>
> For PerlApp there is an option to delete or not these temp files when the
> exe runs. I haven't tried this but its likely that if you have this option
> and use it, the app will start up much quicker after the first time.
>
> Good luck.
>
> Allan
>
> "Uwe Sprave" <uwe_sprave@hp.com> wrote in message
> news:3AACF4F6.CB9F054F@hp.com...
> > Hi
> >
> > I recently bought the perl2exe tool from www.indigostar.com to "compile"
> > my perl application. Unfortunately the performance went dramatically
> > down compared to the interpreted version.
> >
> > We see now a runtime of 5-6 seconds instead of 3! My perl application
> > named sas.pl creates the source code of a HTML webpage and responds in 3
> > seconds while being run as sas.pl interpreted by perl.exe (ActiveState
> > Perl 5.6.0 623). If we use sas.exe instead, the performance is much much
> > slower.
> >
> > Unfortunately the CPAN Time::HiRes timer does not compile with perl2exe
> > (sas.pl does run fine) to make detailed performance analysis about
> > loadtime, runtime etc.
> >
> > I have no idea, how to troubleshoot this problem further down. Maybe you
> > have some experiences or thoughts that you like to share with me?
> >
> > Some details about my configuration:
> > Webserver: Microweb (www.Indigostar.com)
> > Perl: ActiveState 5.6.0 / 623
> > Perl2exe: V4.03 (www.Indigostar.com)
> >
> > Commandline to compile:
> > perl2exe -perloptions="-p2x_noshow_includes" -small -tiny sas.pl
> >
> > Files created with their size in bytes:
> > 554.187 sas.exe
> > 20.480 Base64.dll
> > 28.672 Dumper.dll
> > 20.480 Hostname.dll
> > 24.576 IO.dll
> > 643.072 p2x560.dll
> > 77.824 POSIX.dll
> > 86.016 re.dll
> > 24.576 Socket.dll
> >
> > Any idea is welcome.
> >
> > regards,
> >
> > Uwe Sprave
> > uwe_sprave@hp.com
------------------------------
Date: Tue, 13 Mar 2001 11:46:48 -0500
From: "White, Shawn [CAR:4B59:EXCH]" <bixby@americasm01.nt.com>
Subject: Running a UNIX command from inside a perl script
Message-Id: <3AAE4EF8.D93B90C7@americasm01.nt.com>
How do I call a UNIX command from inside a perl script? I'm just
starting the O'Rielly Learning Perl and curious about this...
Thanks,
Shawn
------------------------------
Date: 13 Mar 2001 11:00:16 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Running a UNIX command from inside a perl script
Message-Id: <873dchtxi7.fsf@limey.hpcc.uh.edu>
>> On Tue, 13 Mar 2001 11:46:48 -0500,
>> "White, Shawn [CAR:4B59:EXCH]" <bixby@americasm01.nt.com> said:
> How do I call a UNIX command from inside a perl script?
> I'm just starting the O'Rielly Learning Perl and curious
> about this...
perldoc -f system
or for more interesting scenarios:
perldoc perlipc
hth
t
--
Just reach into these holes. I use a carrot.
------------------------------
Date: Tue, 13 Mar 2001 06:09:58 -0700
From: "bowman" <bowman@montana.com>
Subject: Re: Set Passwords on AIX
Message-Id: <h5qr6.127$Zj5.1619@newsfeed.slurp.net>
Galen Menzel <galen.menzel@mail.utexas.edu> wrote in message
news:3AAD8C1C.8347F88E@mail.utexas.edu...
>
> if you're using AIX -- yikes!) I think passwd needs a controlling tty
though,
> so check out the IO::Pty module. Also look at the Expect module, which
> basically implements expect using perl as a base language instead of tcl.
passwd on AIX4 has a few other issues. prior to 4.3, one could change a
user's password if they new the existing password. With 4.3, one must be the
user. I am not positive, but I do not believe a suid to root will work
either; I believe you must be running as root to change any random user's
password.
We're doing it in C and using the Expect clib, but it isn't an entirely
satisfactory solution.
------------------------------
Date: Tue, 13 Mar 2001 09:38:39 -0600
From: Galen Menzel <galen.menzel@mail.utexas.edu>
Subject: Re: Set Passwords on AIX
Message-Id: <3AAE3EFF.E8D595F7@mail.utexas.edu>
bowman wrote:
(snip)
> passwd on AIX4 has a few other issues. prior to 4.3, one could change a
> user's password if they new the existing password. With 4.3, one must be the
> user. I am not positive, but I do not believe a suid to root will work
> either
I know for a fact that this will work. I wrote a CGI web based UNIX password
changing program in C a while ago, and it uses a setuid program to change
users' passwords automatically. It runs on our AIX 4.3 machine. I can't
remember exactly, but I think that I had to execute a setuid(0) inside of the
setuid program because passwd wouldn't run without knowing the users' passwords
unless the real and effective UIDs of the calling process were both 0, and the
setuid bit only sets the effective UID.
> I believe you must be running as root to change any random user's
> password.
If you do all the (pseudo-) terminal handling and setuid stuff properly, the
passwd program shouldn't be able to tell the difference between being executed
by your program and being executed by a user running as root through a
terminal.
galen
------------------------------
Date: Tue, 13 Mar 2001 17:19:55 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: stat/-X for symlinks ???
Message-Id: <tasllrfvjncka6@corp.supernews.com>
Michael D. Schleif <mds@helices.org> wrote:
> How to get stat/-X type information about symbolic links ???
> Yes, these functions return proper information; however, that
> information is about the source/original file and *not* about
> the link itself . . .
perldoc -f lstat
Just like in C, there is a slightly different stat() for
symlinks. There's likely not going to be much useful
information on the modes of a symlink , as has been
mentioned, and probably not anything useful about the
size, since this tends to be fixed. Whatever info you
really do need (like uid, gid, file times, etc.) are
there for the asking.
Chris
--
Christopher E. Stith
It's not the U in UBE that pisses people off. It's the B.
-- Martien Verbruggen in clp.misc
------------------------------
Date: Tue, 13 Mar 2001 18:07:35 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: stat/-X for symlinks ???
Message-Id: <tasof7b058p69a@corp.supernews.com>
David Efflandt <efflandt@xnet.com> wrote:
> On Tue, 13 Mar 2001 03:29:15 GMT, Michael D. Schleif <mds@helices.org> wrote:
>>
>>How to get stat/-X type information about symbolic links ???
>>
>>Yes, these functions return proper information; however, that
>>information is about the source/original file and *not* about the link
>>itself . . .
> On any system I have been on, you cannot set or change permissions of a
> symlink, so testing permissions of the symlink itself would be meaningless
> and pointless.
stat() does a little more than check permissions. So does lstat(),
which is what the OP is asking about. There's something to be said
for answering the question asked instead of blindly dismissing it.
Chris
--
Christopher E. Stith
The purpose of a language is not to help you learn the
language, but to help you learn other things by using the
language. --Larry Wall, The Culture of Perl, August 1997
------------------------------
Date: 13 Mar 2001 16:37:48 GMT
From: hudson@swcp.com (Tramm Hudson)
Subject: Re: subroutine recursion?
Message-Id: <98lics$aqh$1@sloth.swcp.com>
Jonas Nilsson <jonni@ifm.liu.se> wrote:
>My suggestion:
>
>sub factorial{
> return 1 if $_[0] == 0;
> return undef unless $_[0] >= 0;
> return $_[0] * factorial($_[0] - 1);
>}
Far too clear. I prefer:
#!/usr/bin/perl -w
use strict;
my $f = sub {
my $a = shift;
my @v = qw/0 1/;
sub { $a->( $a, my $n = shift, \@v ) }
}->( sub {
my $n = $_[1]--;
push @{$_[2]}, $n * $_[0]->(@_) if @{$_[2]} <= $n;
$_[2]->[$n];
} );
print "9! = ", $f->(9), "\n";
print "3! = ", $f->(3), "\n";
__END__
There, isn't that easier? It properly uses lexical variables
for the recursion, is -w and strict clean and now memoizes the
results. What else could you want?
Tramm
--
o hudson@swcp.com hudson@turbolabs.com O___|
/|\ http://www.swcp.com/~hudson/ H 505.323.38.81 /\ \_
<< KC5RNF @ N5YYF.NM.AMPR.ORG W 505.986.60.75 \ \/\_\
0 U \_ |
------------------------------
Date: 13 Mar 2001 16:39:54 GMT
From: wtautz@math.uwaterloo.ca (Walter Tautz [MFCF])
Subject: want create `my' arrays whose names are stored in an array reference passed to my subroutine...
Message-Id: <slrn9asjaq.3hv.wtautz@pythagoras.math.uwaterloo.ca>
specifically
foreach $attribute_name (@$print_queue_entries){# is there an easy way to my the entries of an array
if (/^$attribute=(.*)/){
my $$attribute[$countprinters] = $1;
}
is inside an if block and so I can't return it at the end of the subroutine. One way I suppose
is to use foreach loop at the beginning of the subroutine to create the arrays whose names
are stored in the array reference $queue_attributes but seems repetitive and wasteful...
I guess to put it another way is there a way to declare a my variable in an inner block
of subroutine and yet have it persist for the scope of the whole subroutine...
# Input: a reference to an array contains the names of Stanza entries
# Output: some array references containing data slurped in from files
sub parse_printer_database {
my ($queue_attributes, $printer_database_file = @_;
my $countprinters = 0;
# how does one make a filehandle a my value?
open PRINTERS, "$printer_database_file" or die "Can not open \"$printer_database_file\" -- $!\n";
# If I were not to close this filehandle would it persist out of this subroutine?
while(<PRINTERS>) {
# The stuff below handle whitespace looks clumsy, but since it works, we'll leave it for now
if (/^\s*#|^\s*[*]|^\s*$/) { next; } # skip blank lines and comments
if (/:$|:\s*$/) {
$_ =~ s/^\s*|\s*$//g; # avoid white space
}
else {
$_ =~ s/\s//g; # avoid white space
}
if (/:$/) {
$countprinters++;
my $printer[$countprinters] = $_; # create a my printer array
$printer[$countprinters] =~ s/://; # modify the printqueue name by deleting :
} else { # parse the stanza attribute fields
my $attribute_name;
foreach $attribute_name (@$queue_attributes){
if (/^$attribute=(.*)/){
my $$attribute[$countprinters] = $1; # Let arrays spring into existence corresponding
# attribute names, how to make these persist till end
# of subroutine, don't want to make them global to the file
}
}
}
close(PRINTERS);
if ($countprinters == 0) {
print "file \"$printer_database_file\" is empty";
#exit 0;
}
} # end of parse_printer_database()
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 481
**************************************