[10624] in Perl-Users-Digest
Perl-Users Digest, Issue: 4216 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 13 17:08:21 1998
Date: Fri, 13 Nov 98 14: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 Fri, 13 Nov 1998 Volume: 8 Number: 4216
Today's topics:
bookpool: sale on o'reilly <uri@fastengines.com>
Re: Capture of Web Form Input >> where : 1) client G <nobody@frontiernet.net>
Capture of Web Form Input <kucerar@hhmi.org>
CGI.pm book, reviews? jbharvey@corp.home.net
Re: Clear screen? (Andrew M. Langmead)
Re: Compiling Perl <rootbeer@teleport.com>
Re: counter/logger problem <rootbeer@teleport.com>
Re: Definition of "odd characters" in -T/-B documentati (Andrew M. Langmead)
Re: Definition of "odd characters" in -T/-B documentati <uri@fastengines.com>
Re: Example of subclassing in Perl ?? (Joe McMahon)
Re: Help: HTML Form with attachment(s) <rootbeer@teleport.com>
passing variables from perl2perl <ours@casema.net>
Re: passing variables from perl2perl <baliga@synopsys.com>
Re: Perl bug? die() and DESTROY <bryan@eai.com>
PLEASE HELP Re: Capture of Web Form Input <kucerar@hhmi.org>
Positional parameter support in perl printf <nkanth@cnd.hp.com>
Re: Positional parameter support in perl printf <uri@fastengines.com>
Re: problems using tie <rootbeer@teleport.com>
Re: Q: Frustrated! Converting Cisco config files to (Jon Drukman)
Re: Q: Frustrated! Converting Cisco config files to <ludlow@us.ibm.com>
Re: Q: Frustrated! Converting Cisco config files to <uri@fastengines.com>
Re: Q: are symbolic refs really needed (was Re: Modific <jdporter@min.net>
Re: Q: are symbolic refs really needed (was Re: Modific <uri@fastengines.com>
Re: Q: are symbolic refs really needed (was Re: Modific <rootbeer@teleport.com>
Re: Q: Frustrated! Converting Cisco config files to DNS (Kathleen Applegate)
Reference returned by tie <jeromeo@atrieva.com>
Re: Running a perl/cgi program as root <rootbeer@teleport.com>
Re: Security - How to circumvent it. <rootbeer@teleport.com>
setuid scripts <caa@strata-group.com>
Re: Suidperl? <rootbeer@teleport.com>
Re: Syslog not puttting anything into the log linkr@my-dejanews.com
Re: Syslog not puttting anything into the log linkr@my-dejanews.com
Re: The Perl Institute? <mjg@oms.com>
Re: User pressing Esc or Stop after sending form... <rootbeer@teleport.com>
Re: Weird error. Can anyone help? <rootbeer@teleport.com>
Re: Weird error. Can anyone help? <john.wood@diamond.co.uk>
Win32::NetAdmin::GetServers() odinjon@my-dejanews.com
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 13 Nov 1998 15:31:19 -0500
From: Uri Guttman <uri@fastengines.com>
Subject: bookpool: sale on o'reilly
Message-Id: <sarzp9vfi7c.fsf@camel.fastserv.com>
www.bookpool.com is having a sale on o'reilly books. 41% off list! these
prices blow away anyone else i have seen. i have bought from them in the
past with good results. my only complaint is that i live in MA, their
home state so i have to pay 5% tax. but even then i do much better than
amazon or B&N.
they only do computer boks so they usually have a broader selection than
the biggies. i sometimes the big guys search engines and review info and
the go to bookpool with the isbn's to buy them.
i have no affiliation with them, i just want to save the perl community
some dough.
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: 13 Nov 1998 21:43:30 GMT
From: "Paul Flavin" <nobody@frontiernet.net>
Subject: Re: Capture of Web Form Input >> where : 1) client GUI; 2) client->host, 3); host SQL; is the problem ?
Message-Id: <01be0f4e$8e680500$25da82d1@default>
which part :
1) client GUI,
2) client->host,
3) host SQL
is the problem ?
if it is assumed ( is it ? ) that Java applets and Java servlets can be
run from the client and host respectively,
Java is a good candidate.
Your post's subject line neglects to mention SQL, no small matter,
your question is very, very broad, and you've given no indication of
where your problem is.
You can find out about servlets here ( or from here ) :
http://www.frontiernet.net/~imaging/servlets_intro.html
------------------------------------------------------------------------
"Imaging the Imagined : Modeling with Math & a Keyboard"
http://www.frontiernet.net/~imaging/contents.html
nobody@frontiernet.net ( Notice: e-mails go to _nobody_ vs. above
)
------------------------------
Date: Fri, 13 Nov 1998 15:39:34 -0500
From: Richard J Kucera <kucerar@hhmi.org>
Subject: Capture of Web Form Input
Message-Id: <364C9905.E9256695@hhmi.org>
Web/database programmers,
Is there anyone in the world out there really focused on this problem?
I don't need another $10,000 load balancing server...or another quiz
server
not serious about capture. I don't want to write it if I don't have
to.
I don't care what language it's in mod_perl or Perl CGI or servlet...has
anyone written
anything to do it? See OBJECTIVE in declaration below. TIA -R
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
* OBJECTIVE: Incremental capture unconstrained input data from web
form
* or other, put into typed & constrained RDBMS table(s)
*
* PARAMETERS:
* ROW_ID
* COLUMN
* VALUE
* COLUMN
* VALUE
* .
* .
* .
*
* This type is the base to properties of certain
* generalizable RDBMS patterns.
*
* Subclasses may include master-detail, two-table join,
* multi-table join, stored procedure interface, etc.
*
* These subclasses handle the individual update requests, e.g.
* unpacking the parameters and deciding what to do with them.
*
* The reading of the data dictionary is essential for getting
* type information to use in dynamically encoding the JDBC
* to build SQL statements. At a minimum, for SQL the program
* has to know whether or not to enclose values in 'single quotes'.
* For more advanced prepared statements, different parameter
* loading code needs to be executed depending on the value type.
*
* The key concept here is to be able to author (J)HTML with
* form parameters/input and have this class check the names
* and types that the form uses to upload data. This is a
* "small interpreter pattern."
*
* SQL ISSUES HANDLED:
* 1) data type
* 2) data width
* 3) column naming
* 4) check constraints
* 5) primary key constraints
* 6) foreign key constraints
*/
public class SimpleTableCapture {
Hashtable nameType;
Hashtable nameConstraint;
Connection conn;
String tableName;
}
------------------------------
Date: Fri, 13 Nov 1998 21:34:33 GMT
From: jbharvey@corp.home.net
Subject: CGI.pm book, reviews?
Message-Id: <JB132.118$_g.811467@news.rdc1.sfba.home.com>
Official Guide to Programming with CGI.pm: The Standard for Building Web
Scripts by Lincoln Stein, ISBN 0471247448
Anyone own it or read it? I'm interested in purchasing it but haven't
seen it in bookstores, would like some feedback on the quality of it.
I'm more interested in if it's worthwhile to get because it goes above
and beyond Lincoln's CGI.pm documentation....
j
--
Justin B. Harvey @Home Network
@Work Software Engineer 425 Broadway
jbharvey@corp.home.net Redwood City, CA 94063
Voice: (650) 569-5692 http://www.home.net
------------------------------
Date: Fri, 13 Nov 1998 21:22:46 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Clear screen?
Message-Id: <F2Dq1z.4sK@world.std.com>
Russ Allbery <rra@stanford.edu> writes:
>Andrew M Langmead <aml@world.std.com> writes:
>> Which leads into another question in my post. (Well, might not have
>> phrased it as a qustion, but it is something that I have wondered) What
>> sort of progam could become noticeably more efficient by optimizing the
>> way it clears the screen?
>Anything that displays information on a periodic basis (perhaps polling
>some service) and does a full screen refresh each time it displays data.
But if it clears the screen too often in comparison to writing the
screen, then the screen is unreadable pretty much all of the time. If
the data gathering is so compute intensive that the screen stays on
long enough to read, then the time used by by "clear" is a small
percentage of the CPU time used by the entire program.
A Pentium 166 can run the program clear 50 times a second. If the
screen is cleared every second (far too often to to be readable) thats
2% of the time. I guess a 2% speedup is worth doing. If the screen is
cleared much less than that, I can't see how it could be.
>Anything that clears the screen in response to interactive data entry,
>since immediate responsiveness to human keystrokes is a pretty major
>factor in how "fast" the program will be considered to be.
If the keystrokes frequently cause the screen to clear and be
rewritten, then the operator has a new screen of text to read,
(causing a pause in data entry. Even if they know what it says and
don't read it. Such a drastic change in the screen's appearance will
cause a "startle" and a delay.) If only a small percentage of
keystrokes cause the screen to clear, then it won't be used enough to
affect the users perceptions.
--
Andrew Langmead
------------------------------
Date: Fri, 13 Nov 1998 20:07:45 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Compiling Perl
Message-Id: <Pine.GSO.4.02A.9811131206480.5955-100000@user2.teleport.com>
On Thu, 12 Nov 1998, Randy Perryman wrote:
> I am trying to compile the stable.zip of perl and my head hurts. I am
> not too familiar with the compilers, but I keep getting a syntax error
> when I try. I am using Microsofts Visual C++ 5.0 with sp3 applied.
> Can some one help...
Sure; just download a working binary from CPAN. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 13 Nov 1998 20:48:13 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: counter/logger problem
Message-Id: <Pine.GSO.4.02A.9811131247230.5955-100000@user2.teleport.com>
On Fri, 13 Nov 1998, Fletcher Moore wrote:
> open (COUNT, "$directory$count");
Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.
http://www.perl.com/CPAN/
http://www.perl.org/CPAN/
http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.org/CPAN/doc/manual/html/pod/
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 13 Nov 1998 20:43:12 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Definition of "odd characters" in -T/-B documentation.
Message-Id: <F2Do81.KE6@world.std.com>
Uri Guttman <uri@fastengines.com> writes:
>>>>>> "AML" == Andrew M Langmead <aml@world.std.com> writes:
> AML> All Uri gave was a reinterpretation of the man page and camel text,
> AML> explaining what "funny control characters" meant to him. As you
> AML> suspected in your first post, the only real documentation is the
> AML> source code.
>i was implying the other white spacy chars but unless i looked at the
>source, i wouldn't want to state which ones.
But Uri, Lloyd posted his article because he wanted a more accurate
definition of which control characters were considered binary. Telling
him that "white spacy" characters are the "non-funny" ones wasn't
going to help much, was it. Its just as vague, only differently vague.
>there are files which are mostly text but with null byte separators. if
>the lines are short then the file might be declared binary while long
>lines in the file may cause it to be declared text. same format but data
>dependent if it is binary/text according to -T/-B.
Except for the fact that the ASCII NUL test was the part you deleted
from your quoting of my article.
> if (!*s) { /* null never allowed in text */
> odd += len;
> break;
> }
Any ASCII NUL characters immediately declares the rest of the block to
be "funny". That kind of makes sense. Since standard C library's
string handling (Cough Cough) revolves around an ASCII NUL terminator,
it couldn't be found in a text file. For a 512 byte block and a NUL
record separated file, if the *first record* has no other "funny"
characters, and is greater 170 bytes long, it is text. It doesn't
matter if "most" records are short.
(Since I've occationally put the (Cough Cough) in previous articles
when I talk about the "Windows 95 Operating System (Cough Cough)" I
figured it was appropriate to do the same for C library's string
handling.)
I was going to suggest creating bold chracters by overstriking (ie
"char^Hchar") as an example, but that doesn't work either.
"char^Hchar" is 1/3 binary, so any non-bold character in the first
block (including any spaces in the text) would classify it as "text".
--
Andrew Langmead
------------------------------
Date: 13 Nov 1998 16:18:59 -0500
From: Uri Guttman <uri@fastengines.com>
Subject: Re: Definition of "odd characters" in -T/-B documentation.
Message-Id: <sarogqbffzw.fsf@camel.fastserv.com>
>>>>> "AML" == Andrew M Langmead <aml@world.std.com> writes:
AML> Except for the fact that the ASCII NUL test was the part you deleted
AML> from your quoting of my article.
>> if (!*s) { /* null never allowed in text */
>> odd += len;
>> break;
>> }
my bad. the concept is still valid. if the text were separated by some
other funny char, the length of the strings would determine whether the
file is binary/text. in any case, the tests are heuristic and therefore
not guaranteed to do what you think.
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: Fri, 13 Nov 1998 16:26:55 -0500
From: joe.mcmahon@gsfc.nasa.gov (Joe McMahon)
Subject: Re: Example of subclassing in Perl ??
Message-Id: <joe.mcmahon-1311981626550001@prtims.stx.com>
In article <910400042.444501@thrush.omix.com>, Zenin
<zenin@bawdycaste.org> wrote:
My apologies on "use base". Modulo that, however, I think that the comments
were correct.
--- Joe M.
------------------------------
Date: Fri, 13 Nov 1998 20:35:47 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Help: HTML Form with attachment(s)
Message-Id: <Pine.GSO.4.02A.9811131235180.5955-100000@user2.teleport.com>
On Fri, 13 Nov 1998, Massimo Mercuriali wrote:
> I have urgent need for a script which could send the content of a
> HTML-Form with file attachments to a defined email address.
If you're wishing merely to _find_ (as opposed to write) programs,
this newsgroup may not be the best resource for you. There are many
freeware and shareware archives which you can find by searching Yahoo
or a similar service. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 13 Nov 1998 20:44:52 +0100
From: "Casema" <ours@casema.net>
Subject: passing variables from perl2perl
Message-Id: <72i3cn$m0d$1@sun4000.casema.net>
Hi newsgroup
in one perl proggie I have a scalar $a and the following code:
print "<A HREF=\"directory_on_host/new.pl?$a\">link</A>";
now in the new.pl I want the content of $a to be available.......
I thought: $A = $ENV{'QUERY_STRING'}; would do this...though..it does
not.
What would be the correct way to pass variables to another perl proggie?
thanks,
Michel
------------------------------
Date: Fri, 13 Nov 1998 12:04:41 -0800
From: Yogish Baliga <baliga@synopsys.com>
To: Casema <ours@casema.net>
Subject: Re: passing variables from perl2perl
Message-Id: <364C90D9.388B5AC0@synopsys.com>
You can send a variable to another perl program. You can send the content of
it.
In new.pl, it is passed as $ENV{QUERY_STRING} . You need to use
$ENV{QUERY_STRING}
instead of $a. You can use $a , if $ENV{QUERY_STRING} is assigned to $a.
-- Baliga
Casema wrote:
> Hi newsgroup
>
> in one perl proggie I have a scalar $a and the following code:
>
> print "<A HREF=\"directory_on_host/new.pl?$a\">link</A>";
>
> now in the new.pl I want the content of $a to be available.......
> I thought: $A = $ENV{'QUERY_STRING'}; would do this...though..it does
> not.
> What would be the correct way to pass variables to another perl proggie?
>
> thanks,
>
> Michel
------------------------------
Date: Thu, 12 Nov 1998 17:10:26 -0600
From: Bryan Hart <bryan@eai.com>
Subject: Re: Perl bug? die() and DESTROY
Message-Id: <364B6AE2.41C6@eai.com>
Kevin Reid wrote:
>
> I think I have found a bug in Perl: die() does not print out any message
> when called inside a DESTROY block.
>
> #!perl -w
>
> use vars qw($bb);
>
> sub X::DESTROY {
> print "Destroying ${$_[0]}\n";
> die;
> print "Destroyed ${$_[0]}\n";
> }
>
> sub X::new {
> my ($class, $str) = @_;
>
> return bless \$str, $class;
> }
>
> $aa = X->new('a');
> $bb = X->new('b');
>
> undef $aa;
>
> __END__
>
> When I run this, I get:
>
> Destroying a
> Destroying b
>
> IMHO, die() ought to print out its message in DESTROY.
>
What message are you expecting?
If you're looking for the "Destroyed a" and "Destroyed b", you aren't
getting them because die() is terminating the block before it gets to
the print after it.
Try
sub X::DESTROY {
print "Destroying ${$_[0]}\n";
die "Destroyed ${$_[0]}\n";
}
instead.
--
------------------------------------------------------------
| Bryan Hart | Phone: (515) 296-5979 |
| Network Products Engineer | Fax: (515) 296-7025 |
| Engineering Animation Inc. | Email: bryan@eai.com |
| | WWW: http://www.eai.com/
|
------------------------------------------------------------
------------------------------
Date: Fri, 13 Nov 1998 15:51:11 -0500
From: Richard J Kucera <kucerar@hhmi.org>
Subject: PLEASE HELP Re: Capture of Web Form Input
Message-Id: <364C9BBD.7D7A7B1@hhmi.org>
PLEASE
Richard J Kucera wrote:
> Web/database programmers,
>
> Is there anyone in the world out there really focused on this problem?
>
> I don't need another $10,000 load balancing server...or another quiz
> server
> not serious about capture. I don't want to write it if I don't have
> to.
>
> I don't care what language it's in mod_perl or Perl CGI or servlet...has
> anyone written
> anything to do it? See OBJECTIVE in declaration below. TIA -R
>
> import java.io.*;
> import java.sql.*;
> import java.util.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> /**
> * OBJECTIVE: Incremental capture unconstrained input data from web
> form
> * or other, put into typed & constrained RDBMS table(s)
> *
> * PARAMETERS:
> * ROW_ID
> * COLUMN
> * VALUE
> * COLUMN
> * VALUE
> * .
> * .
> * .
> *
> * This type is the base to properties of certain
> * generalizable RDBMS patterns.
> *
> * Subclasses may include master-detail, two-table join,
> * multi-table join, stored procedure interface, etc.
> *
> * These subclasses handle the individual update requests, e.g.
> * unpacking the parameters and deciding what to do with them.
> *
> * The reading of the data dictionary is essential for getting
> * type information to use in dynamically encoding the JDBC
> * to build SQL statements. At a minimum, for SQL the program
> * has to know whether or not to enclose values in 'single quotes'.
> * For more advanced prepared statements, different parameter
> * loading code needs to be executed depending on the value type.
> *
> * The key concept here is to be able to author (J)HTML with
> * form parameters/input and have this class check the names
> * and types that the form uses to upload data. This is a
> * "small interpreter pattern."
> *
> * SQL ISSUES HANDLED:
> * 1) data type
> * 2) data width
> * 3) column naming
> * 4) check constraints
> * 5) primary key constraints
> * 6) foreign key constraints
> */
> public class SimpleTableCapture {
> Hashtable nameType;
> Hashtable nameConstraint;
> Connection conn;
> String tableName;
> }
------------------------------
Date: Fri, 13 Nov 1998 14:22:54 -0700
From: Srikanth Natarajan <nkanth@cnd.hp.com>
Subject: Positional parameter support in perl printf
Message-Id: <364CA32E.BCE37E01@cnd.hp.com>
Hi
I want to know whether the printf in perl supports positional
parameters in the format string something like that in C
I mean in C printf("%2$d,%1$d\n", a, b) will print b,a
and printf("%1$d,%2$d\n", a, b) will print a,b
In perl can I do such stuff?
Srikanth
------------------------------
Date: 13 Nov 1998 16:46:30 -0500
From: Uri Guttman <uri@fastengines.com>
Subject: Re: Positional parameter support in perl printf
Message-Id: <sarlnlffeq1.fsf@camel.fastserv.com>
>>>>> "SN" == Srikanth Natarajan <nkanth@cnd.hp.com> writes:
SN> I want to know whether the printf in perl supports positional
SN> parameters in the format string something like that in C
SN> I mean in C printf("%2$d,%1$d\n", a, b) will print b,a
SN> and printf("%1$d,%2$d\n", a, b) will print a,b
SN> In perl can I do such stuff?
why do you need it? perl's printf can do many things C's can't like
interpolating field sizes in the format string (instead of using * and
another argument. it is easy to rearrange the args to printf if you need
to do so, where in C it is a pain.
a way to do that would be an array slice of the args with the positional
values extracted out of the format string used as the array indices. i
leave the coding as an exercise to the reader.
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: Fri, 13 Nov 1998 21:12:22 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: problems using tie
Message-Id: <Pine.GSO.4.02A.9811131307440.5955-100000@user2.teleport.com>
On 13 Nov 1998, Rachel J King wrote:
> Hi. I'm trying to teach myself how to use tie so I don't have to
> actually open the 10 files my script needs to access.
So, you're going to have a module open the files?
> I'm trying to write the contents of each file to a tied array and am
> having trouble figuring out exactly how the contents are stored.
Check the implementation. Or am I misunderstanding you?
> @t = tie @test, "Array", "/usr/local/etc/aliases/lists/studorg-list";
The return value from tie is not the array that was tied; it's the
underlying object which implements the tie. That is, it's the same thing
that tied(@test) would return, in this case.
> $r = 0;
> $p = (tied @test)->FETCH(50);
How about this?
$p = $test[50];
> do {
> $s= (tied @test)->FETCH($r);
> print $s;
> $r++;
> }
> while ($r<=50);
It's unusual to use a do{}while loop. Perhaps this is what you'd like?
for my $r (0..49) {
print $test[$r];
}
> The problem: there are actually a lot more than 50 lines in the file.
> How do I find the actual number of lines without explicitly opening the
> file and finding the scalar of, say, @test = <FH>;?
Maybe you want this?
my $count = @test;
> The problem: it appears that FETCH does not return the element of the
> tied array but rather everything up to and including the index passed as
> its argument. Or something like that, I can't completely figure it out.
Maybe the implementation is busted. Check the perltie manpage for what
FETCH is supposed to return. But you hardly ever need to call FETCH
directly; that's the beauty of tie.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 13 Nov 1998 19:54:43 GMT
From: jsd@hudsucker.gamespot.com (Jon Drukman)
Subject: Re: Q: Frustrated! Converting Cisco config files to DNS entries
Message-Id: <slrn74p3ng.3eb.jsd@hudsucker.gamespot.com>
In article <72i0av$s7m$1@hammer.msfc.nasa.gov>, Kathleen Applegate wrote:
>Right now, running the program gives me:
>syntax error at ios2dns line 42, near "next LINE"
>syntax error at ios2dns line 45, near "next LINE"
>Execution of ios2dns aborted due to compilation errors.
hmm, what version of perl is that? i tried your script with 5.004_04
and got:
elseif should be elsif at cisco line 40.
syntax error at cisco line 42, near "next LINE"
elseif should be elsif at cisco line 43.
syntax error at cisco line 45, near "next LINE"
Execution of cisco aborted due to compilation errors.
which seems to explain the problem quite nicely.
(of course the other problem is once you fix the elsifs, you
didn't declare any of your variables so -w complains.)
but this will at least get you started.
-jsd-
------------------------------
Date: Fri, 13 Nov 1998 13:56:32 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: Q: Frustrated! Converting Cisco config files to DNS entries
Message-Id: <364C8EF0.514C50D2@us.ibm.com>
Kathleen Applegate wrote:
>
> Mentally deadzoned, seeking help.
Fear not. It's just a really silly error.
> } elseif ($first9char eq 'no ip add') {
^^^^^^
elsif
Good luck.
--
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)
------------------------------
Date: 13 Nov 1998 16:04:00 -0500
From: Uri Guttman <uri@fastengines.com>
To: kathleen@msfc.nasa.gov (Kathleen Applegate)
Subject: Re: Q: Frustrated! Converting Cisco config files to DNS entries
Message-Id: <sarvhkjfgov.fsf@camel.fastserv.com>
>>>>> "KA" == Kathleen Applegate <kathleen@msfc.nasa.gov> writes:
KA> Yet my eyeballs see utterly nothing wrong with
KA> the syntax. Please, what am I missing?
others have fixed the syntax bug but i will comment on your program in
general. there are several areas that can be improved.
KA> #!/usr/local/bin/perl -w
good, you used -w but where is use 'strict'?
KA> # Declarations
KA> use English;
KA> # Initialize Variables
KA> $IOSfile = $ARGV[0];
KA> $nameRRa = $ARGV[1];
check if these were assigned and do a usage() type of report if no args
were found.
like this:
@ARGV = 2 || die <<USAGE ;
usage: $0 <IOSfile> <RRA>
<IOSfile> the IOS file (dumb but i don't what else to say)
<RRA> whatever that is
USAGE
now you can assign the args
( $IOSfile, $nameRRa ) = @ARGV ;
KA> # Open the file provided on the command-line.
KA> open(IOSfile, $IOSfile) || die "can not open $IOSfile\n";
if the open succeeds (for read by default) the next 2 are not needed. or
they should be BEFORE the open. in fact they all should be before the open.
KA> -e $IOSfile or die "$IOSfile does not exist\n";
KA> -r _ or die "You cannot read $IOSfile\n";
KA> -s _ or die "There is nothing in $IOSfile\n";
KA> -T _ or die "$IOSfile is a binary file\n";
no need for LINE as this is the only loop so next will do the right
thing. it does help with the readability.
KA> LINE: while(<IOSfile>)
KA> {
KA> chomp; # remove the trailing newline
KA> tr/A-Z/a-z/; # translate to lower case
just use this:
lc ;
KA> $thisline = $_;
if you are going to copy $_, then do it before the previous cleanup
lines. it is clearer.
KA> $first9char = substr($thisline,0,9);
KA> if ($first9char eq 'interface') {
KA> &hitBegin;
KA> next LINE;
KA> } elseif ($first9char eq 'no ip add') {
elsif
KA> &hitDud;
KA> next LINE; #### THIS IS LINE 42
KA> } elseif ($first9char eq 'ip addres') {
elsif
KA> &hitEnd;
KA> next LINE; #### THIS IS LINE 45
KA> } else {
KA> next LINE;
KA> }
KA> }
since you always do next LINE in all cases of the if clauses above, why
not just remove them all and the loop will do it anyway:
while(<IOSfile>) {
<snip>
if ($first9char eq 'interface') {
&hitBegin;
} elseif ($first9char eq 'no ip add') {
&hitDud;
} elseif ($first9char eq 'ip addres') {
&hitEnd;
}
}
KA> sub hitBegin {
no need to initialize these as you always assign to them right away. also
they are not declared with my so if you use strict, you will get
errors. but some of them seem to be globals so you can declare them file
globals with a my at the top of the program.
KA> $interface = "";
KA> $interfaceType = "";
KA> $slot = "";
KA> $port = "";
KA> $interface = substr($thisline, 10, 100);
KA> $interfaceType = substr($interface, 0, 3);
KA> $slash = rindex($interface,"/");
KA> if ($slash > -1) {
KA> $noslash = 0;
KA> $slot = substr($interface,0,$slash);
KA> $slot =~ s/[a-z]//g;
KA> $port = substr($interface,$slash+1);
KA> } else {
KA> $slot = $interface;
KA> $slot =~ s/[a-z]//g;
KA> $noslash = 1;
KA> }
KA> }
what is the point of this sub? none of the values are used elsewhere.
are $interface and friends global or local to the subs?
KA> sub hitDud {
KA> $gotinterface = 'no'; # This is an unnumbered interface which
KA> $interface = ""; # means it gets no DNS entry so we'll
KA> $interfaceType = ""; # initialize variables and read next line.
KA> $slot = "";
KA> $port = "";
KA> }
obviously this sub is not completed or was snipped for posting.
KA> sub hitEnd {
KA> ($scrap1, $scrap2, $ipaddress, $ipmask, $secondary) = split(' ',
KA> $thisline, 5);
KA> $revaddr = &REVERSE($ipaddress);
KA> # Within this loop, the output to the DNS files will occur.
KA> }
this sub could have just been an expression in the one place you call it.
KA> sub REVERSE {
KA> join('.', reverse(split('\.', $_[0]))) . '.IN-ADDR.ARPA.';
KA> }
here is a little optimization (both code and speed) trick:
(i let join put the IN string on with a . too)
join( '.', reverse( split( '\.', $_[0] ) ), 'IN-ADDR.ARPA.' ) ;
hth,
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: Fri, 13 Nov 1998 16:00:46 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Q: are symbolic refs really needed (was Re: Modification of a read-only??)
Message-Id: <364C9DFE.A7F03A07@min.net>
Uri Guttman wrote:
>
> it's funny, when perl5 came out i thought soft refs were very cool as i
> wished i had them in perl4 instead of typeglobs.
Are you confused?
Soft refs are what we had in perl4. What we didn't have was hard refs.
--
John Porter
Please Don't "Courtesy CC" me.
I read this newsgroup fanatically. You know that!
("Emailed only" is fine, though.)
Bill Gates claims to be developing a stable operating system;
Linus Torvalds claims to be bent on world domination.
------------------------------
Date: 13 Nov 1998 16:15:27 -0500
From: Uri Guttman <uri@fastengines.com>
Subject: Re: Q: are symbolic refs really needed (was Re: Modification of a read-only??)
Message-Id: <sarr9v7fg5s.fsf@camel.fastserv.com>
>>>>> "JP" == John Porter <jdporter@min.net> writes:
JP> Uri Guttman wrote:
>>
>> it's funny, when perl5 came out i thought soft refs were very cool as i
>> wished i had them in perl4 instead of typeglobs.
JP> Are you confused?
JP> Soft refs are what we had in perl4. What we didn't have was hard refs.
we didn't have soft refs to variables, only subs. i used typeglobs to do
soft refs in perl4. i was building hashes with dynamic names (trivial in
perl5 but a pain in perl4).
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: Fri, 13 Nov 1998 20:31:33 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Q: are symbolic refs really needed (was Re: Modification of a read-only??)
Message-Id: <Pine.GSO.4.02A.9811131230210.5955-100000@user2.teleport.com>
On Fri, 13 Nov 1998, Bart Lateur wrote:
> Can't you do that using eval?
Symbolic references are generally merely troublesome. eval (of a string)
is outright dangerous. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 13 Nov 1998 20:39:55 GMT
From: kathleen@msfc.nasa.gov (Kathleen Applegate)
Subject: Re: Q: Frustrated! Converting Cisco config files to DNS entries
Message-Id: <72i5er$858$1@hammer.msfc.nasa.gov>
In <slrn74p3ng.3eb.jsd@hudsucker.gamespot.com> jsd@hudsucker.gamespot.com (Jon Drukman) writes:
>hmm, what version of perl is that? i tried your script with 5.004_04
>and got:
>elseif should be elsif at cisco line 40.
>syntax error at cisco line 42, near "next LINE"
>elseif should be elsif at cisco line 43.
>syntax error at cisco line 45, near "next LINE"
>Execution of cisco aborted due to compilation errors.
>which seems to explain the problem quite nicely.
Yes, it does, unfortunately my version 5.001 wasn't nearly
as talkative on this particular point. This certainly
motivates me to upgrade. Many thanks for solving this
forehead-slapper for me.
--
----
Kathleen Applegate kathleen@montana.msfc.nasa.gov
NASA/Wang Government Services Tel. (256)544-7656
Marshall Space Flight Center Huntsville, AL 35812
------------------------------
Date: Fri, 13 Nov 1998 10:07:43 -0800
From: "Jerome O'Neil" <jeromeo@atrieva.com>
Subject: Reference returned by tie
Message-Id: <364C756F.AEB35D55@atrieva.com>
I am curious about the reference returned by 'tie.' The docs state that
'...the tie function returns a reference to the object.' But I am not
groking what object the reference points at. Is it a reference to the
tied data, or a 'tied object' that is something else?
Some quick tests show that is is something else. If this is the case,
are there useful things I can do with it?
The camel book says '...one normally minds one's own business and leaves
the underlying object alone...', but we can't do that, now, can we? I
mean...IT'S THERE!
Thanks!
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: Fri, 13 Nov 1998 21:19:18 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Running a perl/cgi program as root
Message-Id: <Pine.GSO.4.02A.9811131317240.5955-100000@user2.teleport.com>
On Fri, 13 Nov 1998, Frido Ferdinand wrote:
> Is it possible to run a perl/cgi program as root ?
It's not only possible, but it's a bad idea.
> I've tried cgi-wrap but when I tell it to run a program as root it
> doesn't work
Sounds as if you're having trouble with cgi-wrap. Perhaps the docs, FAQs,
and newsgroups about CGI programming and related issues could help you.
> Security is no problem because it runs in a protected directory.
That's not how security works!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 13 Nov 1998 20:24:10 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Security - How to circumvent it.
Message-Id: <Pine.GSO.4.02A.9811131219220.5955-100000@user2.teleport.com>
On 13 Nov 1998, Eric Hagen wrote:
> : Insecure $ENV{PATH} while running setuid at /ipl/ipl.pl line 14, <>
> : chunk 1
> If I remember off of the top of my head, I got this to work with
> setting the path to a very limited path. Using ksh I set it like
> this.
>
> export PATH=/bin
>
> The key here then becomes one of making sure that all commands used by
> your script have complete paths in them.
This advice doesn't fix the problem. See that message's entry in the
perldiag manpage.
> Because it took me a while from digging through the docs to figure
> out, it is there, just not spelled out clearly with big signs.
The big signs are in the perlsec manpage. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 13 Nov 1998 15:38:58 -0600
From: "Charlene Abrams" <caa@strata-group.com>
Subject: setuid scripts
Message-Id: <72i8p5$i1d$1@newsin-1.starnet.net>
Rumour has it that perl pre-004 had a security hole that allowed our setuid
script to kill a process via a call to kill -9, but that this "hole" has
since been fixed. We've been having the hardest time getting our script to
work (in perl5-004-04, and yes, we'll be moving to perl5-005-02 Real Soon
Now), and were wondering if something special needs to be done, either when
installing and building perl or when making the script, to allow us to kill
with impunity again.
All the script needs to do is setuid to the owner (who is root), untaint
anything that may need to be untainted, and kill -9 its first argument,
which is a pid. Seems like it should be simpler than rocket science, but the
best minds here (not mine, necessarily) are stumped too. Yes, the setuid bit
is set, and yes, the owner of the script is root.
What are we missing?
Charlene Abrams
mailto:caa@strata-group.com
Strata Group, St Louis, MIssouri
------------------------------
Date: Fri, 13 Nov 1998 20:40:40 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Suidperl?
Message-Id: <Pine.GSO.4.02A.9811131237460.5955-100000@user2.teleport.com>
On Fri, 13 Nov 1998, Matt Heusser wrote:
> I just needed to write a simple CGI Wrapper to change user to root in
> C (a sample of which, btw, if in the perlsec manpage) - and -sha-zam-
> call my perl process as root.
Oh, I hope you wrote your Perl code very _very_ carefully, if it's running
as root. It's too easy to get many CGI programs to do things they
shouldn't. Of course, this no longer is about Perl; the same risks apply
to all CGI programs set-id to root. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 13 Nov 1998 20:43:26 GMT
From: linkr@my-dejanews.com
Subject: Re: Syslog not puttting anything into the log
Message-Id: <72i5le$pjf$1@nnrp1.dejanews.com>
I get the following from redhat 5.2 when using "setlogsock":
[admin]$ cat syslog.test.pl
#!/usr/local/bin/perl
use Sys::Syslog::setlogsock('unix');
# use Sys::Syslog;
openlog( $program, 'cons,pid', 'user' );
syslog( 'INFO', "this is a test message" );
closelog();
[admin]$ perl syslog.test.pl
Can't locate Sys/Syslog/setlogsock.pm in @INC (@INC contains:
/usr/lib/perl5/i386-linux/5.00404 /usr/lib/perl5
/usr/lib/perl5/site_perl/i386-linux /usr/lib/perl5/site_perl .) at
syslog.test.pl line 3.
BEGIN failed--compilation aborted at syslog.test.pl line 3.
[admin]$
If I just use sys:syslog, no errors, but no messages in syslog.
In article <slrn72hvgk.eoj.fluffy@meow.org>,
fluffy@meow.org (Fluffy) wrote:
> Zrbj zrbj Richard F. Barham zrbj zrbj zrbj rfbarham@flash.net zrbj Kitty?
>
> > Hi. I'm using Sys::Syslog with the examples in the pod and in the book. But
> > it's not putting anything in the log. Everything looks ok, and I'm using the
> > perl that came with Redhat 5.1 .
>
> On perl 5.004_03 and later, you can add this to your script to make
> linux dig it:
>
> Sys::Syslog::setlogsock('unix');
>
> Some may recommend that you enable your syslogd to listen on UDP, but
> that isn't a very good security practice.
>
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 13 Nov 1998 20:48:43 GMT
From: linkr@my-dejanews.com
Subject: Re: Syslog not puttting anything into the log
Message-Id: <72i5vb$pvh$1@nnrp1.dejanews.com>
When I try "setlogsock" under redhat 5.2, I get the following:
[admin]$ cat syslog.test.pl
#!/usr/local/bin/perl
use Sys::Syslog::setlogsock('unix');
# use Sys::Syslog;
openlog( $program, 'cons,pid', 'user' );
syslog( 'INFO', "this is a test message" );
closelog();
[admin]$ perl syslog.test.pl
Can't locate Sys/Syslog/setlogsock.pm in @INC (@INC contains:
/usr/lib/perl5/i386-linux/5.00404 /usr/lib/perl5
/usr/lib/perl5/site_perl/i386-linux /usr/lib/perl5/site_perl .) at
syslog.test.pl line 3.
BEGIN failed--compilation aborted at syslog.test.pl line 3.
[admin]$
[admin@dauntless admin]$ perl -v
This is perl, version 5.004_04 built for i386-linux
(with 1 registered patch, see perl -V for more detail)
...................................
> > Hi. I'm using Sys::Syslog with the examples in the pod and in the book. But
> > it's not putting anything in the log. Everything looks ok, and I'm using the
> > perl that came with Redhat 5.1 .
>
> On perl 5.004_03 and later, you can add this to your script to make
> linux dig it:
>
> Sys::Syslog::setlogsock('unix');
>
> Some may recommend that you enable your syslogd to listen on UDP, but
> that isn't a very good security practice.
>
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 13 Nov 1998 16:01:48 -0500
From: "Mark J. Gardner" <mjg@oms.com>
Subject: Re: The Perl Institute?
Message-Id: <72i75d$mf8@netaxs.com>
Randal Schwartz wrote in message <8ciugku7ag.fsf@gadget.cscaper.com>...
>>>>>> "dave" == dave <dave@mag-sol.com> writes:
>
>dave> Has anyone been able to connect to the TPI web page
>dave> <http://www.perl.org> recently? I've not been able to for a
>dave> couple of days and I've also recieved nothing from the daily TPI
>dave> News Mailing List since Tuesday.
>
>dave> Is something wrong?
>
>The ChipMeister told me that there was some sort of Denial-of-service
>attack against the perl.org host. I'm getting intermittent
>connections to it right now.
It might just be the dreaded /. effect. See
"http://slashdot.org/articles/98/11/10/190243.shtml".
...MJG
--
Mark J. Gardner * mjg@oms.com
http://www.oms.com/ - The One-Man Site
------------------------------
Date: Fri, 13 Nov 1998 20:14:31 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: User pressing Esc or Stop after sending form...
Message-Id: <Pine.GSO.4.02A.9811131211040.5955-100000@user2.teleport.com>
On Thu, 12 Nov 1998, Bob Mariotti wrote:
> How can one tell if the client exited so the buffers can be cleared?
It sounds as if you want some information from a browser or server.
Perhaps the docs, FAQs, or newsgroups about browsers or servers could be
of some help. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 13 Nov 1998 20:55:57 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Weird error. Can anyone help?
Message-Id: <Pine.GSO.4.02A.9811131254490.5955-100000@user2.teleport.com>
On Fri, 13 Nov 1998, Paul Wood wrote:
> When running my perl program this line,
>
> if (! defined $form_results{'name'}) { &Error("no_name") }
>
> throws up this error:
>
> Bad name after name:: at member.pl line 580.
Have you seen what perldiag says about this message? You should be aware
that the line number reported may not be the actual line which has the
problem, so look at the last three (or so) lines before the one mentioned.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 13 Nov 1998 21:40:00 -0000
From: "Paul Wood" <john.wood@diamond.co.uk>
Subject: Re: Weird error. Can anyone help?
Message-Id: <72i8qk$6t6$1@nclient3-gui.server.ntli.net>
Thanks... got it.
-Paul.
Tom Phoenix wrote in message ...
>Have you seen what perldiag says about this message? You should be aware
>that the line number reported may not be the actual line which has the
>problem, so look at the last three (or so) lines before the one mentioned.
>Hope this helps!
>
>--
>Tom Phoenix Perl Training and Hacking Esperanto
>Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
>
------------------------------
Date: Fri, 13 Nov 1998 21:29:57 GMT
From: odinjon@my-dejanews.com
Subject: Win32::NetAdmin::GetServers()
Message-Id: <72i8cl$s31$1@nnrp1.dejanews.com>
Hi,
I'm looking for someone who has used the Win32::NetAdmin::GetServers()
function. I'm trying to use it, but seem to only be getting a subset
of the computers on our domain.
Have you had any success or problems with this function or module?
TIA,
Odin
--
Odin.Anderson@TDSTelecom.Com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4216
**************************************