[7620] in Perl-Users-Digest
Perl-Users Digest, Issue: 1246 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 29 20:07:17 1997
Date: Wed, 29 Oct 97 17:00:25 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 29 Oct 1997 Volume: 8 Number: 1246
Today's topics:
Are there any modules to change permissions on WindowsN (Mark Nielsen)
AUTOLOAD and sort (Leonard Megliola)
Re: AUTOLOAD and sort (brian d foy)
Re: AUTOLOAD and sort (Leonard Megliola)
crypt on NT (Brian Wheeler)
Re: Execution time in Perl <Steinar.Kleven@ahs.hist.no>
Re: Help - PERL for WINDOWS 3.11 (Faust Gertz)
Re: how do I save an array into a file? (brian d foy)
Re: In-Line images and perl <usenet-tag@qz.little-neck.ny.us>
Re: In-Line images and perl (brian d foy)
insecure dependency error (Randy Rokosz)
insecure dependency error (Randy Rokosz)
Re: insecure dependency error (brian d foy)
Re: Interesting PERL command - need help (Tad McClellan)
Re: Module conflict <rootbeer@teleport.com>
mySQL <rfp@erienet.net>
Package for testing (and generating) CGI programs <hakank@kajen.com>
Re: Package for testing (and generating) CGI programs (brian d foy)
Re: Perl for NT and ARGV parameters (Mark Nielsen)
Re: Perl Suffix (Was: Can perl be maken to Compiler ins (Abigail)
Sockets..... <@rgarcia@leading.net@>
Re: Sockets..... (brian d foy)
Re: String Manipulation Help Required <osborri@mail.northgrum.com>
Re: Useless use of sort in void context <rootbeer@teleport.com>
Re: Userid and passwords <rootbeer@teleport.com>
Re: using -s to get file size (JoyDivisin)
Re: using -s to get file size (Jason Gloudon)
Re: Year2000 problem with localtime(); (Abigail)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 29 Oct 1997 14:48:30 -0500
From: men2@auto.med.ohio-state.edu (Mark Nielsen)
Subject: Are there any modules to change permissions on WindowsNT registries?
Message-Id: <6383ue$r3t$1@auto.med.ohio-state.edu>
I have been using the Reigstry pm in Win32 version of PERL for NT.
It doesn't appear to be able to change permissions. Is there any
plan for this?
Thanks!
Mark
--
---------------------------------------------------------------------------
Mark Nielsen men2@auto.med.ohio-state.edu or gytres+@osu.edu
Systems Specialist
The Ohio State University
------------------------------
Date: 29 Oct 1997 23:06:23 GMT
From: lmegliol@inertia.acs.uci.edu (Leonard Megliola)
Subject: AUTOLOAD and sort
Message-Id: <638fhf$2c6@news.service.uci.edu>
I have a program which makes a call to sort such as the
following:
sort _sort_subroutine ... ;
_sort_subroutine is an AutoLoaded routine, and because "the normal
calling code for subroutines [used in sort] is bypassed", the
_sort_subroutine is not loaded. An error is printed that
explains that the routine cannot be found.
This has haunted me for some time, and I just recently figured
out what is going on.
In the past, before I knew what was going on, I would manually
go into the .al files and shift the _sort_subroutine into the
same .al file that the sort call was being made.
Now that I've figured it out, my solution is to do something
like the following:
_sort_subroutine; # Gets AutoLoader to load it
sort _sort_subroutine ... ;
Another possible solution is to not have that one routine autoloaded.
What is the best possible solution?
Leonard
------------------------------
Date: Wed, 29 Oct 1997 18:56:54 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: AUTOLOAD and sort
Message-Id: <comdog-ya02408000R2910971856540001@news.panix.com>
In article <638fhf$2c6@news.service.uci.edu>, lmegliol@inertia.acs.uci.edu (Leonard Megliola) wrote:
> _sort_subroutine; # Gets AutoLoader to load it
> sort _sort_subroutine ... ;
>
>Another possible solution is to not have that one routine autoloaded.
>
>What is the best possible solution?
depends on what you are trying to do.
if you don't know what the subroutine is going to do before it is
loaded, then maybe you want to AUTOLOAD it.
if the subroutine does the same thing every time and is used every time,
then why autoload it?
if .....
and so on.
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: 30 Oct 1997 00:29:05 GMT
From: lmegliol@inertia.acs.uci.edu (Leonard Megliola)
Subject: Re: AUTOLOAD and sort
Message-Id: <638kch$4on@news.service.uci.edu>
In article <comdog-ya02408000R2910971856540001@news.panix.com>,
brian d foy <comdog@computerdog.com> wrote:
>
>>Another possible solution is to not have that one routine autoloaded.
>>
>>What is the best possible solution?
>
>depends on what you are trying to do.
>
>if you don't know what the subroutine is going to do before it is
>loaded, then maybe you want to AUTOLOAD it.
>
>if the subroutine does the same thing every time and is used every time,
>then why autoload it?
>
>if .....
>
>and so on.
Obviously, but the point of my post was not to discuss whether it
needs to be autoloaded. It does, if it matters. The point is that
the only way to get around this problem without making an additional
call to _sort_subroutine may be to not autoload the routine.
Thanks,
Leonard.
------------------------------
Date: 29 Oct 1997 22:39:18 GMT
From: bdwheele@indiana.edu (Brian Wheeler)
Subject: crypt on NT
Message-Id: <638dum$6iv$1@dismay.ucs.indiana.edu>
How do I get the crypt function to work on NT? I'm using the 5.00402 binary
distribution.
Thanks
Brian Wheeler
bdwheele@Indiana.edu
------------------------------
Date: Wed, 29 Oct 1997 22:45:46 +0100
From: Steinar Kleven <Steinar.Kleven@ahs.hist.no>
Subject: Re: Execution time in Perl
Message-Id: <3457AE8A.EDA0A455@ahs.hist.no>
cjz wrote:
>
> Hello,
> I am trying to find a way to time the execution of a script. At this
> time I have implemented something very simple that grabs the "time" in
> seconds at the start of the scripts and grabs it again at the end,
> compares them and prints out the time in seconds.
>
> I am looking for a way to measure the execution time more accurately,
> say in 10ths, 100ths, 1000ths etc. of a second. Please help.
>
> Thanks,
>
> -Eddy
Snipped from perldebug.html:
-----
If you wish to supply an alternative debugger for Perl to run, just
invoke your script with a colon and a package argument given
to the -d flag. One of the most popular alternative debuggers for Perl
is DProf, the Perl profiler. As of this writing, DProf is
not included with the standard Perl distribution, but it is expected to
be included soon, for certain values of ``soon''.
Meanwhile, you can fetch the Devel::Dprof module from CPAN. Assuming
it's properly installed on your system, to profile your
Perl program in the file mycode.pl, just type:
perl -d:DProf mycode.pl
When the script terminates the profiler will dump the profile
information to a file called tmon.out. A tool like dprofpp (also
supplied with the Devel::DProf package) can be used to interpret the
information which is in that profile.
----------
I'm using DProf on a package I'm currently working on, and dprofpp
creates a listing like this for one of the testscripts:
Total Elapsed Time = 4.215 Seconds
User+System Time = 4.215 Seconds
Exclusive Times
%Time Seconds #Calls sec/call Name
49.5 2.088 1 2.0880 DynaLoader::dl_load_file
12.3 0.522 1 0.5220 main::CODE(0x79a3c4)
6.83 0.288 1 0.2880 blib::CODE(0x7a0388)
4.13 0.174 1 0.1740 NDSm::NWDSCreateContext
3.99 0.168 1 0.1680 NDSm::bootstrap
3.91 0.165 1 0.1650 NDSm::NWCallsInit
1.78 0.075 2 0.0375 NDSm::NWDSWhoAmI
1.61 0.068 4 0.0170 NDSm::NWDSGetContext
1.28 0.054 1 0.0540 NDSm::NDSContext::CODE(0x765f24)
1.14 0.048 1 0.0480 main::CODE(0x74b2e0)
1.07 0.045 1 0.0450 NDSm::NDSContext::CODE(0x79e0dc)
0.97 0.041 1 0.0410 blib::import
0.93 0.039 2 0.0195 NDSm::NDSContext::RemoveAllTypes
0.88 0.037 2 0.0185 NDSm::NWDSRemoveAllTypes
0.66 0.028 2 0.0140 NDSm::NWDSSetContext
Hope this helps..
Steinar Kleven, http://www.ahs.hist.no/~stk (~root)
NDSm module: http://www.ahs.hist.no/distr/NDSm/
------------------------------
Date: Wed, 29 Oct 1997 20:00:49 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Help - PERL for WINDOWS 3.11
Message-Id: <34579210.938613@news.wwa.com>
On Tue, 28 Oct 1997 23:11:37 -0600, smurali@thiru.vetri.com wrote:
>Can anyone help me in getting PERL for Windows 3.11 ( 16 bit ).
Did you check CPAN (http://www.perl.com/CPAN)? Did you look under
'/CPAN-local/ports/win16'?
>I have PERL for Windows 95. But i need it in Windows 3.11 ( 16bit ) with
>ODBC Support.
If what you find in '/CPAN-local/ports/win16' isn't what you need,
read 'Pumpkin - Notes on handling the Perl Patch Pumpkin' and sign
onto the Perl5-porters mailing list.
HTH
Faust Gertz
Philosopher at Large
------------------------------
Date: Wed, 29 Oct 1997 16:13:40 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: how do I save an array into a file?
Message-Id: <comdog-ya02408000R2910971613400001@news.panix.com>
In article <345793c3.866606@news.cmc.ec.gc.ca>, sylvain.juneau@ec.gc.ca (Sylvain Juneau) wrote:
>how do I save an array into a file?
open FILE "> $file_name";
print FILE @array;
close FILE;
or if you really need to be sophisicated, you could use some of the
Data Manipulation modules [1], like Data::Dumper, to save the array. it's
difficult to recommend a solution when one doesn't know what the task
is :)
[1] CPAN has many goodies:
<URL:http://www.perl.com/>
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
the Bronx Zoo has camel rides for $3.
------------------------------
Date: 29 Oct 1997 20:52:31 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: In-Line images and perl
Message-Id: <eli$9710291527@qz.little-neck.ny.us>
Brian Lintz <blintz@com.nicorinc> wrote:
> Tom Phoenix wrote:
> : > open(GIF, "file.gif");
> : Even when your script is "just an example" (and perhaps especially in that
> : case!) you should _always_ check of the return value after opening a
> : file. Thanks!
> *nods* You know, I thought about that...
>
> Trouble is, when you're already sending out a content type of image/gif,
> the user won't be able to read what the die message was... ya know?
What's wrong with:
if (!open(GIF, "file.gif")) {
# Bugger!
if (!open(GIF, "broken-image.gif")) {
# Argh!
if (!open(MAIL, "|sendmail webmaster")) {
# Just hopeless, give up.
die "SNAFU: $!";
} else {
$Mail= q
!To: webmaster
- From: program
- Subject: things are broken
-
- things are around here.
!;
$Mail =~ s/\n\s+- |\s+\Z/\n/g;
print MAIL $Mail;
die "Bailing: no images!\n";
}
} else {
# we'll be using broken-image.gif instead of file.gif, oh well
# perhaps log a problem here?
}
}
# at this point we use file.gif as intended or broken-image.gif.
Feel free to continue on to deeper levels of open failure contingencies,
of course.
Elijah
------
perl -e 's Y Yreverse q N ny pm ,srekcah lrep kroy wen emosNYex and s Pmp ynP
P and s MsMjust sMx and print and s NYPM MPYN Nis or reverse and print q q q'
------------------------------
Date: Wed, 29 Oct 1997 16:33:36 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: In-Line images and perl
Message-Id: <comdog-ya02408000R2910971633360001@news.panix.com>
In article <eli$9710291527@qz.little-neck.ny.us>, Eli the Bearded <usenet-tag@qz.little-neck.ny.us> wrote:
>Brian Lintz <blintz@com.nicorinc> wrote:
>> Trouble is, when you're already sending out a content type of image/gif,
>> the user won't be able to read what the die message was... ya know?
don't send the content type until you know you have the content!
[snip]
> die "Bailing: no images!\n";
how about
die "Status: 204 Bailing: no images!\n\n";
or you could just embed the broken image GIF data under DATA so it
looks like you've written really long and robust script. (maybe
programmers should be paid by the byte)
>perl -e 's Y Yreverse q N ny pm ,srekcah lrep kroy wen emosNYex and s Pmp ynP
>P and s MsMjust sMx and print and s NYPM MPYN Nis or reverse and print q q q'
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
wonders if eli can write palindronic obfuscations
------------------------------
Date: 29 Oct 1997 11:54:42 -0700
From: rokosz@ug2.plk.af.mil (Randy Rokosz)
Subject: insecure dependency error
Message-Id: <6380pi$kvu$1@ug2.plk.af.mil>
I'm trying to write an adduser program that is setuid root. I try to do
the following:
$home_part = "/home/";
$username <--- is input from keyboard
$home_dir = $home_part.$username;
if ($homedir = /^([-\@\w.]+)$/) {
$homedir = $1;
}
system "/usr/bin/mkdir $home_dir";
And the mkdir command results in the following error:
Insecure dependency in system while running setuid at /home/useradm/.add_test
line 35, <STDIN> chunk 1.
How do I clean up this homedir variable if part of it is input from keyboard?
Or basically, how do I clean it up if it's not a command line argument?
Thanks in advance!
Randy Rokosz
------------------------------
Date: 29 Oct 1997 13:11:57 -0700
From: rokosz@ug2.plk.af.mil (Randy Rokosz)
Subject: insecure dependency error
Message-Id: <6385ad$nid$1@ug2.plk.af.mil>
I'm trying to write an adduser program that is setuid root. I try to do
the following:
$home_part = "/home/";
$username <--- is input from keyboard
$home_dir = $home_part.$username;
if ($homedir = /^([-\@\w.]+)$/) {
$homedir = $1;
}
system "/usr/bin/mkdir $home_dir";
And the mkdir command results in the following error:
Insecure dependency in system while running setuid at /home/useradm/.add_test
line 35, <STDIN> chunk 1.
How do I clean up this homedir variable if part of it is input from keyboard?
Or basically, how do I clean it up if it's not a command line argument?
Thanks in advance!
Randy Rokosz
------------------------------
Date: Wed, 29 Oct 1997 16:23:04 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: insecure dependency error
Message-Id: <comdog-ya02408000R2910971623040001@news.panix.com>
In article <6380pi$kvu$1@ug2.plk.af.mil>, rokosz@ug2.plk.af.mil (Randy Rokosz) wrote:
>I'm trying to write an adduser program that is setuid root. I try to do
>the following:
>$home_dir = $home_part.$username;
>if ($homedir = /^([-\@\w.]+)$/) {
shouldn't that be
$home_dir =~ /^([-\@\w.]+)$/
> $homedir = $1;
>}
>system "/usr/bin/mkdir $home_dir";
>Insecure dependency in system while running setuid at /home/useradm/.add_test
>line 35, <STDIN> chunk 1.
>
>How do I clean up this homedir variable if part of it is input from keyboard?
>Or basically, how do I clean it up if it's not a command line argument?
perhaps using the same variable name ($home_dir vs. $homedir) would help ;)
also, are you sure that you want to do the untainting at the $home_dir
stage rather than simply untainting $username? you'll need to check
that username is a valid username and is unique, so you might as
well untaint it in the process. since $home_part comes from the inside
the script, it won't be tainted.
you might also wish to use the list form of system:
system '/usr/bin/mkdir', $home_dir;
good luck :)
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
--likes userdel more than useradd.
------------------------------
Date: Wed, 29 Oct 1997 15:22:31 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Interesting PERL command - need help
Message-Id: <ne9836.mmv.ln@localhost>
[ Please configure your "newsreader" to post only plain text.
This is Usenet.
This in not the WWW.
]
Paul George (paul.george@gsc.gte.com) wrote:
: Does anyone know what this command does? open(MAIL, "|");
If you run it with the -w switch, it will tell you what it is
*asking* perl to do, and point out that you cannot get perl to
do that...
perl -we 'open(MAIL, "|")'
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 29 Oct 1997 13:22:26 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Phil Glatz <phil@glatz.com>
Subject: Re: Module conflict
Message-Id: <Pine.GSO.3.96.971029132157.1187E-100000@usertest.teleport.com>
On Wed, 29 Oct 1997, Phil Glatz wrote:
> Base.pm: "my" variable $sn masks earlier declaration in same scope at
> /usr/local/lib/perl5/site_perl/CGI/Base.pm line 591.
> Base.pm: "my" variable $qs masks earlier declaration in same scope at
> /usr/local/lib/perl5/site_perl/CGI/Base.pm line 601.
>
> Not sure why this is happening, any way around it?
Ask the module's author to fix the bugs. :-)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 29 Oct 1997 19:43:00 -0500
From: Kurt Schreiber <rfp@erienet.net>
Subject: mySQL
Message-Id: <3457D814.D55D3579@erienet.net>
I am new to the database game but seasoned to the Perl and Web game. I
run sites on a Linux Redhat 4.2 server and have recently implemented the
RPM for mySQL. However, I have no idea on how to get started with it.
Where do I make the tables, etc... Is that done directly through Perl?
I am pretty lost here and would appreciate any guidance to get started
with this, especially with any info on using mySQL.
Thanks,
Kurt
------------------------------
Date: Wed, 29 Oct 1997 22:16:00 +0100
From: Hakan Kjellerstrand <hakank@kajen.com>
Subject: Package for testing (and generating) CGI programs
Message-Id: <Pine.LNX.3.95.971029215711.14063A-100000@mother.kajen.com>
I've written some scripts for testing CGI programs, which may be of some
interest or use. They makes it possible to run the CGI programs without
been connected to a webserver (emulating GET/POST).
CGI Testing:
* CGITest.pm: a Perl module for debugging a CGI program (emulating
GET/POST).
* cgitest: A standalone program which emulates GET/POST for CGI programs
(not necessarily Perl programs).
Generating:
Just for fun, some programs for generating CGI programs.
* html2pl.pl: given a HTML file with <FORM> tag, it generates a simple
CGI program to use. It also generates a cgitest test file (see above).
* def2html.pl: given a test definition file, it generates a simple HTML
file, and a (very) simple CGI program. (Just to complete the circle:-)
More info and download of the package: http://www.netch.se/~hakank/CGITest2
[Note: This module/scripts don't use CGI.pm, which - by the way - have its
own testing capability.]
#!/netch/hakank/
Hakan Kjellerstrand
hakank@netch.se http://www.netch.se/~hakank/
Software Developer/CGI Programmer Netch Technologies AB, Lund, Sweden
------------------------------
Date: Wed, 29 Oct 1997 18:42:00 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Package for testing (and generating) CGI programs
Message-Id: <comdog-ya02408000R2910971842000001@news.panix.com>
In article <Pine.LNX.3.95.971029215711.14063A-100000@mother.kajen.com>, Hakan Kjellerstrand <hakank@kajen.com> wrote:
>I've written some scripts for testing CGI programs, which may be of some
>interest or use. They makes it possible to run the CGI programs without
>been connected to a webserver (emulating GET/POST).
your code is very badly broken. for example:
* does not allow the | character in input
* POST ignores the QUERY_STRING
and so on and so on. it's the same broken code that's been around
since at least 1994.
you might want to look into the documentation for writing modules
which will help you design and package your next release. see the
h2xs manual page and associated references for more details :)
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: 29 Oct 1997 14:55:35 -0500
From: men2@auto.med.ohio-state.edu (Mark Nielsen)
Subject: Re: Perl for NT and ARGV parameters
Message-Id: <6384bn$r56$1@auto.med.ohio-state.edu>
I usually Execute a perl script in a batch file or command like
perl MyPerlScripts.pl $Argv1 $Argv2
It always works for me.
Mark
In article <877544023.24897@dejanews.com>,
<wilson.sinclair@dial.pipex.com> wrote:
>I have installed 5.0003_07 of Perl for Win32 on my NT4.0 machine. My Perl
>scripts use command line arguments that can be extracted from ARGV[0-x].
>My problem is that using the normal perl.exe "%s" "%s" association (what
>does the %s mean ?) I cannot seem to read the ARGV elements correctly. My
>current workaround is to use perl.exe "%1" "%2".... which seems to work.
>
>Any idea how I can get this to work correctly ?
>
>Wilson
>
>-------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
--
---------------------------------------------------------------------------
Mark Nielsen men2@auto.med.ohio-state.edu or gytres+@osu.edu
Systems Specialist
The Ohio State University
------------------------------
Date: 30 Oct 1997 00:31:05 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl Suffix (Was: Can perl be maken to Compiler instead of interpreter?)
Message-Id: <slrn65fle2.fa0.abigail@betelgeuse.wayne.fnx.com>
Randal Schwartz (merlyn@stonehenge.com) wrote on 1520 September 1993 in
<URL: news:8c3elkbsa3.fsf@gadget.cscaper.com>:
++ >>>>> "Andrew" == Andrew Johnson <ajohnson@gpu.srv.ualberta.ca> writes:
++
++ Andrew> I generally use a .pl extension on my perl scripts so my editor
++ Andrew> (which recognizes extensions) is in perl-mode when I open them.
++
++ If you're editor is Emacs, you can train it to notice the #! line as
++ well. If your editor *isn't* Emacs, why not? :-)
I hate using an editor to give me a directory listing.
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^(11+?)\1+$/'
------------------------------
Date: Wed, 29 Oct 1997 14:24:57 -0500
From: "Robert Garcia" <@rgarcia@leading.net@>
Subject: Sockets.....
Message-Id: <6383a1$rvs@news.southeast.net>
I am in need of some assistance in reference to building a socket connection
using Perl. My intent is to connect to a web server and download a HTML
file. If anyone can help or lead me in the right direction, I would
appreciate it... =)
Rob
------------------------------
Date: Wed, 29 Oct 1997 19:00:13 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Sockets.....
Message-Id: <comdog-ya02408000R2910971900130001@news.panix.com>
In article <6383a1$rvs@news.southeast.net>, "Robert Garcia" <@rgarcia@leading.net@> wrote:
>I am in need of some assistance in reference to building a socket connection
>using Perl. My intent is to connect to a web server and download a HTML
>file. If anyone can help or lead me in the right direction, I would
>appreciate it... =)
have you looked at the LWP modules? they reduce this to one
line (of less than 100 characters, say) of code, like:
use LWP::Simple;
$data = get('http://www.perl.com');
if you still want to use modules, look at IO::Socket or Socket, along
with the appropriate docuemntation.
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 29 Oct 1997 14:29:22 -0500
From: Rick Osborne <osborri@mail.northgrum.com>
Subject: Re: String Manipulation Help Required
Message-Id: <34578E92.516D7B97@mail.northgrum.com>
Hugh wrote:
> I am trying to read data from a web page form using post
Use CGI.pm or cgi-lib.pl, it's what they're there for. Or, if you
insist on doing it yourself, at least use them for reference. Get thee
to a CPAN!
-- Rick Osborne
"After years of superhero training, you start to notice that a lot of
these villains kinda have a motif going. In fact, I bet my bottom
dollar that the four story tall light bulb there has got something to do
with the Deadly Bulb."
------------------------------
Date: Wed, 29 Oct 1997 13:31:05 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: jfryan@vincius.nhgri.nih.gov
Subject: Re: Useless use of sort in void context
Message-Id: <Pine.GSO.3.96.971029132957.1187G-100000@usertest.teleport.com>
On Wed, 29 Oct 1997, Joseph Ryan wrote:
> Useless use of sort in void context at ./web-blast.plx line 179
> 179> sort numerically @score;
> Anybody seen this one before, or know why I'm getting it.
You're getting that message because it's useless to use sort in void
context at ./web-blast.plx line 179. :-) (Check the docs for sort to see
why.) Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 29 Oct 1997 13:29:38 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: SHAILKUMAR <shailkumar@aol.com>
Subject: Re: Userid and passwords
Message-Id: <Pine.GSO.3.96.971029132728.1187F-100000@usertest.teleport.com>
On 29 Oct 1997, SHAILKUMAR wrote:
> When going to certain webpages, a window pops up and prompts the user to
> enter his id and password. If the id and password is correct, another
> web page is loaded or else a server message is displayed.
>
> How do you implement this in perl ?
You either read the HTTP specification and do what it says, or you read
your webserver's docs and do what they say. :-) If you have questions
about these things and you can't find the answers in the relevant docs and
FAQs, check with a newsgroup about them. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 29 Oct 1997 21:21:53 GMT
From: joydivisin@aol.com (JoyDivisin)
Subject: Re: using -s to get file size
Message-Id: <19971029212100.QAA16303@ladder02.news.aol.com>
Ok, in followup, here's my code:
$currdir = "/usr/web/docs/";
opendir(DOT, $currdir) || die "Cannot open current dir";
print "Content-type: text/html\n\n";
print "<html><head><title>Directory of currdir</title></head>\n";
print "<body bgcolor=#ffffff>\n";
print "<table border=0>\n";
print "<tr><th>Name</th><th>Size</th></tr>\n";
while ($name = readdir(DOT)) {
open(EP, $name);
if (($pos = index($name,".")) >0) {
@info = stat $name;
$size = @info[7];
$uid = @info[4];
$total += $size;
print "<tr><td>$name</td><td>$size</td><td>$uid</td></tr>\n";
}
}
print "<tr><td></td><td>$total</td></tr>\n";
closedir(DOT);
print "</table></body></html>";
In response to some of the "crackpot" responses, I wasn't using -s to get the
filename, but the size. In this example, I've switched to stat.
Anyway, it has a hard time seeing the file size (or uid) of other directories
(not the one it's in). And in a bizarre twist, if I run the program while I'm
in the directory I want it to look in, it'll see the size and uid. Oh, and I
am logged in as nobody.
And finally, the file owner is nobody on all these files with rwx set for
owner.
Any clues?
David
------------------------------
Date: 29 Oct 1997 21:57:11 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: using -s to get file size
Message-Id: <638bfn$231$1@daily.bbnplanet.com>
JoyDivisin (joydivisin@aol.com) wrote:
: Ok, in followup, here's my code:
: $currdir = "/usr/web/docs/";
: opendir(DOT, $currdir) || die "Cannot open current dir";
: while ($name = readdir(DOT)) {
: open(EP, $name);
: if (($pos = index($name,".")) >0) {
: @info = stat $name;
: In response to some of the "crackpot" responses, I wasn't using -s to get the
: filename, but the size. In this example, I've switched to stat.
: Anyway, it has a hard time seeing the file size (or uid) of other directories
: (not the one it's in). And in a bizarre twist, if I run the program while I'm
: in the directory I want it to look in, it'll see the size and uid. Oh, and I
: am logged in as nobody.
I'll leave it as an exercise to the poster to determine what manpage this
came from.
readdir DIRHANDLE
Returns the next directory entry for a directory
opened by opendir(). If used in a list context,
returns all the rest of the entries in the
directory. If there are no more entries, returns an
undefined value in a scalar context or a null list
in a list context.
If you're planning to filetest the return values out
of a readdir(), you'd better prepend the directory
in question. Otherwise, because we didn't chdir()
there, it would have been testing the wrong file.
Jason Gloudon
------------------------------
Date: 30 Oct 1997 00:27:47 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Year2000 problem with localtime();
Message-Id: <slrn65fl7r.fa0.abigail@betelgeuse.wayne.fnx.com>
Eric Bohlman (ebohlman@netcom.com) wrote on 1520 September 1993 in
<URL: news:ebohlmanEIt6AC.7CB@netcom.com>:
++ Abigail (abigail@fnx.com) wrote:
++ : Uhm, if I have my application read and write dates, using
++ : sizeof (time_t) space, I get a problem when sizeof (time_t)
++ : isn't constant over time.
++
++ : One of the subproblems of Y2K is that going from 2 to more bytes to
++ : store the year gives problems when reading old data, or writing new data.
++ : That same problem will hit machines when their time_t type goes from 32
++ : to 64 bits.
++
++ With a 40-year head start, I would hope that programmers would start
++ storing dates as long integers and casting their time_t's to them (with
++ appropriate sign extension for pre-1970 dates). Of course, *that* code
++ will have to be changed before dates start overflowing a 64-bit word :).
You mean, you're gonna wait 40 years before using 64 bit machines?
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^(11+?)\1+$/'
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 1246
**************************************