[7273] in Perl-Users-Digest
Perl-Users Digest, Issue: 898 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 21 01:17:21 1997
Date: Wed, 20 Aug 97 22:00:26 -0700
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, 20 Aug 1997 Volume: 8 Number: 898
Today's topics:
Re: *Really* dynamic function loading? (Dan Zerkle)
Re: *Really* dynamic function loading? (Dan Zerkle)
Re: Assign directory WRITE permission only - How? (Tad McClellan)
Re: changing perl to gibberish (T. Wheeler)
code conversion.... <rfinn@Houston-InterWeb.COM>
Re: code conversion.... <dbenhur@egames.com>
Re: Comparing Text <polone@sanasys.com>
Filtering CR & CRLF from text input (Roger Easlick)
Help!! my dbm file crash everytime I try to build it. <aung@seattleu.edu>
Re: HELP: Running Perl-CGI scripts in UNIX <yoder5@gate.net>
Re: HTML-TEXT <xuchu@iscs.nus.edu.sg>
Re: I'm looking for a perl logo... <jimsco@beorc.com>
Re: Need help! <polone@sanasys.com>
Re: New User Question on FTP <polone@sanasys.com>
Re: Perl5 & Personal Web Server <gebhart@informatics.net>
Re: Retrieving graphic dimensions through PERL w/o actu <hudsonm@bellsouth.net>
Re: Retrieving graphic dimensions through PERL w/o actu <dbenhur@egames.com>
setuid and perl <byersa@agva.com>
Sockets scottc@creativeloafing.com
Re: Special Char in "BJRN" treated as EOF by NT Perl 5 (Mike Stok)
Re: TMTOWTDI-- can you find another? (T. Wheeler)
Re: undeclared variables ??? (Tad McClellan)
Re: undeclared variables ??? <dbenhur@egames.com>
Re: Win95 + Perl back-quotes or fx(<system command>) as (Jeff Stampes)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 21 Aug 1997 00:20:14 GMT
From: zerkle@krakatoa.cs.ucdavis.edu (Dan Zerkle)
Subject: Re: *Really* dynamic function loading?
Message-Id: <5tg1ju$i28$1@mark.ucdavis.edu>
Zenin (zenin@best.com) wrote:
: http://www.perl.com/perl/CPAN/CPAN.html
Dead link (at least from my site).
: Although I knew this off hand, I still did a search to see how easy
: it was to find using only local man pages:
: man perl
: Always start here if you don't know were to look.
: On the first page I find, "perlfaq Perl frequently asked
: questions". So...
Not properly installed at my site.
: Yes, the given URL will redirect you to another site. That's
: because it's probably the best local mirror of CPAN for you based on the
: information has about you (hostname, subnet, etc). That's it's job.
I'm guessing that a problem with this mirror thing doing its job
is why I kept getting dead links.
: A search for "CPAN" on Yahoo took an entire 5 seconds to locate.
I should have done this. I suppose I'm too old-fashioned
to use new-fangled gizmos like that. Trying this brought
me to a working mirror.
: How long did it take to write your reply BTW?
Less than I had already invested in mucking around.
--
Dan Zerkle zerkle@cs.ucdavis.edu
GCS d(---)(!) p- c++ !l u++ e++(+++) m s++/-- !n h+(--) f g+++(-) w+ t+ r(-) y+
Stamp out Internet spam! See http://www.vix.com/spam/ to help.
------------------------------
Date: 21 Aug 1997 00:41:04 GMT
From: zerkle@krakatoa.cs.ucdavis.edu (Dan Zerkle)
Subject: Re: *Really* dynamic function loading?
Message-Id: <5tg2r0$i28$2@mark.ucdavis.edu>
Ok, I found a solution, which has nothing to do with
autoload. I just used eval(), and it seemed happy.
Dan Zerkle (zerkle@krakatoa.cs.ucdavis.edu) wrote:
: I want to do some very late loading and execution of subroutines,
The problem is that I don't know the names of the library
files or functions until after the program is running.
So, I use eval() to generate the proper "use" line and
function calls.
Here's an example.
The following bit of toy code is contained in
a file called "testeval.pm":
*****************************
#!/pkg/bin/perl
package testeval;
sub itworked {
print "It worked!\n";
}
sub stillworks {
print "It still works!\n";
}
1;
*****************************
This is the main program:
*****************************
#!/pkg/bin/perl
# Note: Following values could have been taken from a file
my($pkgname) = "testeval";
my($subname) = "itworked";
my($sub2name) = "stillworks";
eval("use ".$pkgname.";\n".$pkgname."::".$subname."()");
warn $@ if $@;
eval($pkgname."::".$sub2name."()");
warn $@ if $@;
*****************************
Note that the two eval()'s do not contain the names of
the packages or functions.
Here is the output from running the main code:
*****************************
It worked!
It still works!
*****************************
Note that the second eval() works without loading the package.
This means that the package loading is persistent and does not
go away after the first eval() terminates.
I'm not sure about the consequences here. Even though I'm
a Perl newbie, I'm pretty sure that the eval() is going to
have a big overhead if I call the functions like that repeatedly.
If so, does anyone know a more efficient way to do it?
--
Dan Zerkle zerkle@cs.ucdavis.edu
GCS d(---)(!) p- c++ !l u++ e++(+++) m s++/-- !n h+(--) f g+++(-) w+ t+ r(-) y+
Stamp out Internet spam! See http://www.vix.com/spam/ to help.
------------------------------
Date: Wed, 20 Aug 1997 19:41:08 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Assign directory WRITE permission only - How?
Message-Id: <4r2gt5.m82.ln@localhost>
Eric (eric@intiman.org_nospam) wrote:
: Is there a way in Perl to assign permissions for files and directories?
chmod() is documented in the perlfunc man page...
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 21 Aug 1997 02:32:54 GMT
From: twheeler@m-net.arbornet.org (T. Wheeler)
Subject: Re: changing perl to gibberish
Message-Id: <33fba7e0.281061389@news.stlnet.com>
I thought perl was already gibberish :-)
On unix machines there is often crypt command to encrypt documents.
If you do an eval 'crypt' type of system call, you might be headed in
the right direction.
If you mean can you take out whitespace and convert variable names to
something else, you can probably use a text editor's find and replace
feature (replace spaces with nothing, real variable names with
jumbles), or create a simple script to do this. Be careful -- not all
whitespace in perl is insignificant.
On Fri, 08 Aug 1997 16:09:06 -0400, Victor Magdic <vmagdic@talas.com>
wrote:
>Does anyone know if there are any programs that will take perl source
>and scramble it into gibberish, so that it is effectively unreadable
>(i.e. human readable variable names are converted to strings of
>letters+numbers, spaces compacted etc.)
>
>I've seen stuff like this for javascript code.
>
>victor
>
>--
>Victor Magdic <vmagdic@talas.com>
>Talas, I.T. Solutions
>http://www.talas.com
------------------------------
Date: Wed, 20 Aug 1997 22:06:02 -0500
From: "Richard J. Finn" <rfinn@Houston-InterWeb.COM>
Subject: code conversion....
Message-Id: <33FBB099.E5F14F4C@Houston-InterWeb.COM>
I was wondering if anyone could help me...
I'm trying to turn a string of characters into their ASCII codes seperated by
|'s. I then need code that does the reverse. I have them in TCL... but I need
to also have them in Perl. Could anyone convert the following procedures?
proc convert_string {string} {
set workstring {}
foreach char [split $string {}] {
scan $char %c scanvar
lappend workstring $scanvar
}
return [join $workstring |]
}
proc un_convert_string {string} {
set workstring {}
foreach num [split $string |] {
lappend workstring [format %c $num]
}
return [join $workstring {}]
}
--
Richard J. Finn rfinn@houston-interweb.com
------------------------------
Date: Wed, 20 Aug 1997 20:49:54 -0700
From: Devin Ben-Hur <dbenhur@egames.com>
To: "Richard J. Finn" <rfinn@Houston-InterWeb.COM>
Subject: Re: code conversion....
Message-Id: <33FBBAE2.2041@egames.com>
[mail&post]
Richard J. Finn wrote:
> I'm trying to turn a string of characters into their ASCII codes seperated by
> |'s. I then need code that does the reverse. I have them in TCL... but I need
> to also have them in Perl. Could anyone convert the following procedures?
>
> proc convert_string {string} {
[snip]
>
> proc un_convert_string {string} {
[snip]
sub convert_string {
return join( '|', map( ord, split(//,$_[0]) ) );
}
sub un_convert_string {
return pack('C*', split(/\|/,$_[0]) );
}
HTH
--
Devin Ben-Hur <dbenhur@egames.com>
eGames.com, Inc. http://www.egames.com/
Warning: Dates in Calendar are closer than they appear.
------------------------------
Date: Wed, 20 Aug 1997 21:51:39 -0500
From: Patrick O'Lone <polone@sanasys.com>
To: Kelby Cody <cody@cs.unca.edu>
Subject: Re: Comparing Text
Message-Id: <33FBAD3B.2E7F@sanasys.com>
I assume that text file you want to compare answers with is the "answer
sheet". So let's say, for example, the answers to the questions are
A,A,C. Three questions. The format of the text file answer sheet is:
A
A
C
What you would do is assign each question in the form a name for each
answer. Let's assume it is multiple choice and looks something like
this for each question:
Question?
(A) answer 1
(B) answer 2
(C) answer 3
The form's HTML would look something like this:
<P>Question?</P>
<P><INPUT TYPE="RADIO BUTTON" NAME="1" VALUE="A">(A) answer 1</P>
<P><INPUT TYPE="RADIO BUTTON" NAME="1" VALUE="B">(B) answer 2</P>
<P><INPUT TYPE="RADIO BUTTON" NAME="1" VALUE="C">(C) answer 3</P>
Now, the name of the question is the number of the question. The value
is the value of the answer for that selection of that question. So if
they choose "A", the value of question 1, "1" is "A". Next, they submit
the form and it must be parsed by the CGI program. Whenever my script s
get parsed, they are in an associative array such that:
$test_values{'1'} = value of "1" from the form.
Next, you would read in the values from the answer sheet like this:
open(ANSWERS,"answersht.txt");
while (<ANSWERS>) {
@answers = $_;
}
close(ANSWERS);
Then you would compare them and tally the result like this:
$loop = 0;
$tally = 0;
foreach(keys %test_values) {
if ($test_values{$_} eq $answers[$loop]) {
$tally++;
}
$loop++;
}
$total_answers = @answers;
You can get an average and percentile of the correct answers this way.
Then you can output the results later in the program as a dynamic
document. I hope this helps.....
--
Patrick O'Lone
Sana Systems Webmaster Administrator
polone@sanasys.com
"The edge is everything..."
------------------------------
Date: Thu, 21 Aug 1997 01:26:57 GMT
From: roger@ole-net.com (Roger Easlick)
Subject: Filtering CR & CRLF from text input
Message-Id: <33fb95a2.22874242@news.voyager.net>
Can anyone tell me how to strip CRLFs from text input fields? I'm
writing a classified ad script which features a muti-row textbox where
the user is very tempted to hit return and to format his/her entry.
This totally screws up the fields in the colon (:) delimited flat
file. I have read extensively in FAQs and and in the DEJANEWS achives,
but haven't found anything that will work. Here are some of the
suggestions that do NOT seem to work:
#** When the user clicks on the Submit button labled
#** "ADD" this CGI program is called, and the form
#** data is passed in STDIN.
read(STDIN, $save_string, $ENV{CONTENT_LENGTH});
@prompts = split(/&/,$save_string);
foreach (@prompts)
{
($tmp1, $tmp2) = split(/=/,$_);
$tmp2 =~ s/\x2b/\x20/g;
$tmp2 =~ s/%2C/\x2c/g;
$tmp2 =~ s/%28/\x28/g;
$tmp2 =~ s/%29/\x29/g;
$tmp2 =~ s/\r\n//g; #Removes CRLF
# or $tmp2 =~ s/\r\n/\n/g; # CRLF to NEWLINE
# or $tmp2 =~ s/%13//g; # Strips CR
$tmp2=~ s/%(..)/pack("C", hex($1))/ge;
$fields{$tmp1}=$tmp2;
}
Any suggestions would be GREATLY appreciated.
Roger
Roger Easlick
roger@ole-net.com
http://www.ole-net.com
------------------------------
Date: Wed, 20 Aug 1997 19:02:14 -0700
From: aung <aung@seattleu.edu>
Subject: Help!! my dbm file crash everytime I try to build it.
Message-Id: <33FBA1A6.50C7@seattleu.edu>
Hi,
I wrote a script to build a database management file for a search
routine.
- I scan each files in my account
- set each words as a key
It works fine for a smally site, but it crashes when the dbm file get
big. The error message is as follow :
- ndbm store returned -1, errno 28, key "school" at index.pl line 111,
<file> chunk 52.
Any body know what is going on, please help (aung@seattleu.edu).
Thanks
------------------------------
Date: Wed, 20 Aug 1997 19:26:45 -0400
From: Brian Yoder <yoder5@gate.net>
Subject: Re: HELP: Running Perl-CGI scripts in UNIX
Message-Id: <33FB7D35.1D65@gate.net>
James East wrote:
>
> I am using Red Hat Linux 4.1, with X Windows and the web browser that
> comes with it (Not Lynx, but I forget the name). I have made a Perl CGI
> script, and a form which submits to it using the GET method. When I try
> to test it, I get the script code when I click the submit button. I have
> set the code .cgi file to execute permission for all. I have
> #!/usr/bin/perl
> in the first line of the file (yes, it is the right path), and
> print "Content-Type: text/html\n\n"
> on the next line, yet it still will not run. What can I do?
> I THINK it is using the web server (Apache 1.x, but not the most recent
> version), because it is accessing http://abgroup/cgi-bin/test.cgi
Does it require/use any of the standard Perl modules? Are the
directories in which these modules live searchable by the owner
of the Apapche server? Are the modules readable by the owner of
the Apache server? Does the script call commands that are in a
path that is known to most users but not to the login of the
Apache server? Have you checked whatever stderr log that is
kept by the Apache server?
I've used NS server under other Unix, but these are common questions/
problems the first time one (well, me, anyway) delves into Perl and
CGI.
Brian
------------------------------
Date: 21 Aug 1997 02:59:39 GMT
From: Xu Chu <xuchu@iscs.nus.edu.sg>
Subject: Re: HTML-TEXT
Message-Id: <5tgaur$p4s@nuscc.nus.sg>
yeah, i am looking for this too. anyone who has the stuff pls send me one copy too. thx.
<b>Michael (Sandman) Sandler</b> <sandler@ren.eecis.udel.edu> wrote:
: Before I re-invent the wheel:
: Does anyone have a utility to strip the HTML stuff out of
: text (I want to use to read E-Mail that comes from stupid
: people). I can write one but will not if I someone else has.
: Mike Sandler
: sandler@eecis.udel.edu
: PS: I can read it through the HTML but...save time/effort
: --
: -------------
: Michael Sandler <sandler@eecis.udel.edu>
: If you "C:>Win" you lose.
--
wings
------
You cannot learn anything unless you almost know it already.
------------------------------
Date: 21 Aug 1997 02:13:39 GMT
From: "Jim Scofield" <jimsco@beorc.com>
Subject: Re: I'm looking for a perl logo...
Message-Id: <01bcadd7$f9ca7460$221656d1@jscofield>
Don't laugh. From what I hear, Gateway is going after companies that use
Cows for marketing.
Jim Scofield
jscofield@mindspring.com
Lasse Hillerxe Petersen <lassehp@imv.aau.dk> wrote in article
<lassehp-ya023180001908971637400001@news.daimi.aau.dk>...
> In article <MAXWELL.97Aug15194224@yoda.jpl.nasa.gov>,
> maxwell@natasha.jpl.nasa.gov (Scott Maxwell) wrote:
>
> >Duh, I should have looked a little more before posting on this topic
> >earlier. I ought to have visited
> >
> > http://www.ora.com/info/perl/republic/usage.html
> >
> >which has such a logo and sets terms for its use. Please note that
> >this site also says,
> >
> > "The use of a camel image in conjunction with Perl is a
> > trademark of O'Reilly & Associates, Inc."
> >
> >Since trademark infringement is nothing to take lightly, I suggest you
> >use this logo on your Web site and abide by their terms.
>
>
> I'm no lawyer, just another perl hacker, but I cannot see how such a
> loosely defined trademark ("a camel image in conjunction with Perl") can
be
> valid and legal. Could Apple similarly trademark any fruit with a bite
> taken of it in conjunction with computers?
>
> I do like O'Reilly & Associates and have a couple of their books (of
> course) and they have standards that I admire. However this "ownership"
of
> "a camel in conjunction with Perl" I must say that I don't like.
>
> MacPerl has a camel in front of a pyramid as an icon. That must be a
> trademark infringement then?
>
> I am not opposed to trademarks, and I do believe that infringement should
> be regarded seriously; but I also think there should be (and must be)
> limits to what can be trademarked. A camel of a particular style such as
> the one used by O'Reilly: yes that can and should be trademarked. But any
> "camel image in conjunction with Perl" -- no way. It is just as silly as
if
> O'Reilly claimed "The use of an animal image in conjunction with a
computer
> programming concept or language is a trademark of O'Reilly & Associates,
> Inc.", which would merely be a generalization from the covers of other
> books. I just don't think it can be done. Or maybe it can in the United
> States? Suddenly we can't use a spider to visualize the WWW?
>
> Has my coffee cup suddenly become a trademark of Sun or Javasoft, because
> it sits next to my computer (with Java on it)?
>
> If _that_ is the situation with trademark law, then we are living in a
sad
> world and should do something about it.
>
> I hope O'Reilly will relax and reduce their claim to cover only camel
> drawings of the particular style used by O'Reilly. Which is very neat,
BTW.
>
> -Lasse
>
------------------------------
Date: Wed, 20 Aug 1997 21:09:58 -0500
From: Patrick O'Lone <polone@sanasys.com>
To: cmartin@interware.net
Subject: Re: Need help!
Message-Id: <33FBA376.3E83@sanasys.com>
You can read input from the keyboard using <STDIN>. For example,
print "Enter a value: ";
chop($data = <STDIN>);
The "chop" statement is used to get rid of the newline character that is
entered when you press ENTER or RETURN on the keyboard. If you want the
newline character included (by the way, it is \n), don't use chop. Most
people don't want the newline character included with the data however,
so it is a common practice to chop the value as it is being read in.
(Well, actually, it chops it after reading it in, but the other idea is
spawned from the way it is coded)
--
Patrick O'Lone
Sana Systems Webmaster Administrator
polone@sanasys.com
"The edge is everything..."
------------------------------
Date: Wed, 20 Aug 1997 21:19:07 -0500
From: Patrick O'Lone <polone@sanasys.com>
To: Edward Bidinotto <edbid@cobe.com>
Subject: Re: New User Question on FTP
Message-Id: <33FBA59B.6EB4@sanasys.com>
Depending on your operating system, you need an FTP program. For
Windows95 and Windows 3.1 I would suggest CuteFTP, a shareware program
you can download off the net. For a Macintosh user, you could use
Fetch. If your on a UNIX, most standard UNIX operating systems already
have FTP program you run by typing in: ftp hostname.
The programs come with login tools, so you don't need an extra set for
that. Then just upload the file to your home directory (with FTP, you
login and it places you in your respective home directory.) I would like
to point out, though, that return characters on different computers
differ. On Windows95, the return character is ^M (ctrl-M) and on a UNIX
machine it is \n. This may have an impact on what kind of format it
will be in once uploaded (especially if it is a regular text file).
When I write programs that will execute on UNIX, I usually telnet in (or
go by console) and write them there so all carriage-return characters
are specific to that platform. Also make sure you set the permissions
correctly (chmod 755) and have the correct statement at the beginning
leading to PERL:
i.e.
#!/usr/bin/perl
To find out where PERL is on your system just type: "whereis perl"
during a telnet session. I hope that helps.
--
Patrick O'Lone
Sana Systems Webmaster Administrator
polone@sanasys.com
"The edge is everything..."
------------------------------
Date: Mon, 18 Aug 1997 19:16:34 -0500
From: "Toby Gebhart" <gebhart@informatics.net>
Subject: Re: Perl5 & Personal Web Server
Message-Id: <5taogu$cln$1@e3000.supernews.com>
Try http://activeware.com and get Perl for Win32. Associate whatever
extensions you want your Perl scripts to use (pl, cgi, etc) and you're off.
I'm not sure about PWS, as I use WebSite, but I don't think you should need
to change any server configuration;I didn't.
Toby Gebhart
http://altera.gpbteam.com/toby/
Brian Moffatt wrote in article <33F8E337.3ADA11A9@nac.net>...
>I installed PWS and I am brand new at Perl. How do I install it so I can
>test CGI's
>Thank you.
>
------------------------------
Date: Tue, 19 Aug 1997 21:03:00 -0400
From: Mike Hudson <hudsonm@bellsouth.net>
Subject: Re: Retrieving graphic dimensions through PERL w/o actually loading image?
Message-Id: <33FA4244.5ADDCEDD@bellsouth.net>
Try this, you can modify it to add the heights and widths to your HTML
output.
Good Luck
-----
#!/opt/bin/perl
$|=1;
$file = $ARGV[0];
$ext = substr($file, index("$file",".") + 1);
open(IN,"$file") || die "Can't open $file\n";
binmode(IN);
if($ext =~ /gif/io)
{
($height, $width) = gif();
}
elsif($ext =~ /jpg/io || $ext =~ /jpeg/io)
{
($height, $width) = jpeg();
}
else
{
die "Unknown file extension ($ext)\n";
}
close(IN);
print STDOUT "Height = $height\nWidth = $width\n";
sub gif
{
read(IN, $type, 6);
if($type !~ /GIF8[7,9]a/o)
{
die "$file is corrupt\n";
}
read(IN, $gifdata, 4);
($d1, $d2, $d3, $d4) = unpack("C"x4, $gifdata);
$width = $d2<<8|$d1;
$height = $d4<<8|$d3;
return ($height, $width);
}
sub jpeg
{
undef $done;
read(IN, $c1, 1);
read(IN, $c2, 1);
if( (ord($c1) != 0xFF) && (ord($c2) != 0xD8))
{
die "$file is corrupt\n";
}
while (ord($ch) != 0xDA && !$done)
{
while (ord($ch) != 0xFF && $ch != eof)
{
read(IN, $ch, 1) || die "Can't read $file\n";
}
while (ord($ch) == 0xFF)
{
read(IN, $ch, 1);
}
if ((ord($ch) >= 0xC0) && (ord($ch) <= 0xC3))
{
read(IN, $junk, 3);
read(IN, $jpgdata, 4);
($d1, $d2, $d3, $d4) = unpack("C"x4, $jpgdata);
$height = $d1<<8|$d2;
$width = $d3<<8|$d4;
$done = 1;
}
else
{
read(IN, $jpgdata, 2);
($c1, $c2) = unpack("C"x2, $jpgdata);
$length = $c1<<8|$c2;
if ($length < 2)
{
die "$file is corrupt\n";
}
else
{
read(IN, $junk, $length-2);
}
}
}
return ($height, $width);
}
------------------------------
Date: Wed, 20 Aug 1997 19:49:45 -0700
From: Devin Ben-Hur <dbenhur@egames.com>
To: Mike Hudson <hudsonm@bellsouth.net>
Subject: Re: Retrieving graphic dimensions through PERL w/o actually loading image?
Message-Id: <33FBACC9.2986@egames.com>
[mail&post]
Mike Hudson wrote:
> Try this, you can modify it to add the heights and widths to your HTML
> output.
[code snipped]
Or just go grab the Image::Size.pm module off of CPAN.
ex:
use Image::Size;
($x, $y) = imgsize("something.gif");
or (with CGI.pm):
use CGI ':all';
use Image::Size 'attr_imgsize';
print img({-SRC => '/server/images/arrow.gif',
attr_imgsize('/server_root/server/images/arrow.gif')});
Beats reinventing another wheel.
--
Devin Ben-Hur <dbenhur@egames.com>
eGames.com, Inc. http://www.egames.com/
Warning: Dates in Calendar are closer than they appear.
------------------------------
Date: Wed, 20 Aug 1997 23:51:46 -0400
From: Al Byers <byersa@agva.com>
Subject: setuid and perl
Message-Id: <33FBBB52.36@agva.com>
I cannot figure out how setuid scripts are supposed to work. I am
running OSF/1 3.2 on a DEC Alpha and I have concluded that setuid
scripts will not execute, but I was under the impression that scripts
run through a perl interpreter should work. So why doesn't the following
script show the UID as 0 instead of the real uid?
#!/usr/local/bin/perl
print `ps -O uid -p $$`;
if the permissions are:
-rwsr-sr-x 1 root users 147 Aug 13 10:20 test.pl
I could have sworn that at one time it did? Is there something I am
missing? I tried other things, such as trying to open a root-protected
file, and nothing works.
--
Al Byers Automation Group of Virginia
(540) 949-8777 P.O. Box 1091
byersa@agva.com Waynesboro, VA 22980
------------------------------
Date: Wed, 20 Aug 1997 21:59:28 -0400
From: scottc@creativeloafing.com
Subject: Sockets
Message-Id: <33FBA100.7886@cln.com>
I'd like to open a socket and retrieve the contents of an HTML document
form a particular URL using tcp/ip, could anyone point me the right
direction of how to accomplish this with perl?
Thanks, -Scott
------------------------------
Date: 21 Aug 1997 00:44:44 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Special Char in "BJRN" treated as EOF by NT Perl 5?
Message-Id: <5tg31s$1r3@news-central.tiac.net>
Ctrl-Z is the DOS end of file marker for text files. using binmode on the
filehandle should help, but you'll then have the \r\n end of line
sequences untranslated too, so beware of that.
Hope this helps,
Mike
In article <33FB1CF1.556C@ccm.jf.intel.com>,
Peter X. Wang <peter_xihong_wang@ccm.jf.intel.com> wrote:
>Trying to parse a data file which contains a special character
>as in the following line between "BJ" and "RN".
>
>796,82,BJRN JONSSON,,BJRN,,JONSSON,1476,
>
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Thu, 21 Aug 1997 02:27:30 GMT
From: twheeler@m-net.arbornet.org (T. Wheeler)
Subject: Re: TMTOWTDI-- can you find another?
Message-Id: <33fba61c.280609277@news.stlnet.com>
Thanks for the help. I did realize when I wrote this that it read the
whole file (inefficient), but as a beginner, just didn't know a better
way. Thanks for pointing me towards the dbm path.
On 16 Aug 1997 23:26:37 GMT, fox@pt0204.pto.ford.com (Ken Fox) wrote:
>twheeler@m-net.arbornet.org (T. Wheeler) writes:
>> Perl's motto is 'There's more than one way to do it,' and I am sure I
>> haven't found the best way.
>
>I'd rather do it in a way that doesn't require reading through the
>whole file just to get to the tip of the day. Probably the best way
>to do this is with a lightweight persistent hash table, i.e. one of
>the dbm modules. Another decent solution is just to store each tip
>in its own file. Something like this:
>
Snip....
>
>By the way, why so Windows-centric? Do you care that much that
>the font type is 'Arial'? Don't you know that's just a Microsoft
>ploy to keep people from realizing that they're really just using
>a poor copy of Helvetica? :-)
>
Yeah I know, corporate image though. They wanted arial throughout the
site, so I gave them arial, even in the cgi scripts. Unfortunately,
it's for an end-user computer training company (read Microsoft apps),
and we have to bend over and grease up for Gates and company
sometimes. I take some comfort in the fact that I developed most of
it on a Linux box, though, so perhaps I can show my face here again
sometime :-}
Tom
The guy with a horrible mail server.
>Hope this helps.
>
>P.S. I replied to the author a couple days back, but it bounced (twice).
>
>--
>Ken Fox (kfox@ford.com) | My opinions or statements do
> | not represent those of, nor are
>Ford Motor Company, Powertrain | endorsed by, Ford Motor Company.
>Analytical Powertrain Methods Department |
>Software Development Section | "Is this some sort of trick
> | question or what?" -- Calvin
------------------------------
Date: Wed, 20 Aug 1997 19:22:20 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: undeclared variables ???
Message-Id: <sn1gt5.i72.ln@localhost>
Jon Marshall (xkn14@dial.pipex.com) wrote:
: could someone please explain why the folllowing when run
: complains about an undeclared variable on line 28 -
Sure.
It complains the first time in encounters $all{$file}, because you
want to add the size to it, but it has not been given a value yet.
: i have been
: working on this and it's driving me mad -
: the code works but
Because perl does the Right Thing, and gives it an appropriate
initial value. But it warns you that it has done so ;-)
: i would like it to run with the -w switch - incidentally - is the find
: module for perl supposed to run faster than unix find - both run
: too slow for this job - hence the following approach
: many thanks in advance
: jon marshall
: #!/usr/bin/perl -w
[snip]
: $size = -s $file;
: $all{$file} += $size; # line 28 #
I also don't see why you bother copying it to $size before adding it...
if (defined $all{$file})
{ $all{$file} += -s $file}
else
{ $all{$file} = -s $file}
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 20 Aug 1997 20:07:45 -0700
From: Devin Ben-Hur <dbenhur@egames.com>
To: Jon Marshall <xkn14@dial.pipex.com>
Subject: Re: undeclared variables ???
Message-Id: <33FBB101.6CE4@egames.com>
[mail&post]
Jon Marshall wrote:
> could someone please explain why the folllowing when run
> complains about an undeclared variable on line 28 - i have been
> working on this and it's driving me mad - the code works but
> i would like it to run with the -w switch
>
[snip]
> %all = ();
[snip]
> $all{$file} += $size; # line 28 #
This is an oversite in pre-5.004 versions of perl.
The first increment of $hash{newkeyvalue} gets an uninitialized (not
undeclared) variable warning because it is indeed uninitialized (there
is no previous value for that hash key). However, this is fairly common
usage and it seems absurd to have to say:
if (exists($hash{$key})) { $hash{$key} += $value; }
else { $hash{$key} = $value; }
just to avoid the -w warning.
Perl 5.004 eliminates the warning for this kind of use. If you can't
upgrade to the latest perl you're going to either have to work around
the warning or turn off -w.
HTH
--
Devin Ben-Hur <dbenhur@egames.com>
eGames.com, Inc. http://www.egames.com/
Warning: Dates in Calendar are closer than they appear.
------------------------------
Date: 21 Aug 1997 00:30:37 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: Re: Win95 + Perl back-quotes or fx(<system command>) assignment not working.
Message-Id: <5tg27d$h47$1@neocad.com>
Scott McMahan (scott@lighthouse.softbase.com) wrote:
: Alten Limited (alten@dial.pipex.com) wrote:
: : I've downloaded Perl 5 (build 307) from ActiveWare and installed it on
: : the Windows 95 machine I'm using (for my sins).
Scrap it...get the latest port of 5.004 from CPAN. It's behaving
much better on win95 than previous activeware ports.
--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com
------------------------------
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 898
*************************************