[11608] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5208 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 23 16:07:25 1999

Date: Tue, 23 Mar 99 13:00:19 -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           Tue, 23 Mar 1999     Volume: 8 Number: 5208

Today's topics:
    Re: "small" problem (Abigail)
    Re: "small" problem <aqumsieh@matrox.com>
    Re: << string definer (Abigail)
    Re: << string definer <cassell@mail.cor.epa.gov>
    Re: << string definer <aqumsieh@matrox.com>
    Re: << string definer <upsetter@ziplink.net>
        A few regular expressions for C source code <D4At@vendian.org>
    Re: CGI.pm questions (brian d foy)
        cookie help <webmaster@macdaddyusa.com>
    Re: cookie help <jglascoe@giss.nasa.gov>
    Re: cookie help (Abigail)
        Environment Vars not exported to shared libraries (Sola (Chris Chubb)
    Re: How do variable substitution on a string twice? <cassell@mail.cor.epa.gov>
    Re: MS Access and Perl -- help! <vince@oxxfordinfo.com>
    Re: Need username in Perl script (Abigail)
        NT: The amount of DASD users own per server via Win32 e mirak@mindspring.com
    Re: Odd/Even (brian d foy)
        Passing parameters (CGI) <wmwilson1@go.com>
    Re: Passing parameters (CGI) (Jason)
    Re: PERl and Server Side Includes SOLUTION <sme@planetpod.com>
        Perl Books (was Re: << string definer) <upsetter@ziplink.net>
    Re: Perl WIN32 - How to return a DOS ErrorLevel? (Alexander F. Gutfeldt)
        Request: Sample Multi Threaded Perl TCP Server/ <henkslaaf@dikkelul.com>
    Re: Role for Developer / Admin upto ??40k <upsetter@ziplink.net>
    Re: scripts to organize Radius files (Chris Chubb)
    Re: Sending HTTP Referer field using perl (brian d foy)
    Re: Weird Perl problem <kavian@americasm01.nt.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 23 Mar 1999 18:14:19 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: "small" problem
Message-Id: <7d8llr$m9r$2@client2.news.psi.net>

Ronald J Kimball (rjk@linguist.dartmouth.edu) wrote on MMXXX September
MCMXCIII in <URL:news:1dp3doy.dri7gzvbnm9iN@p57.block2.tc3.state.ma.tiac.com>:
%% 
%%     push, @{$products{$prodcat}}, [$prodname, $prodprice];
           ^
           |
           ?


Abigail
-- 
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


------------------------------

Date: Tue, 23 Mar 1999 12:58:49 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
To: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: "small" problem
Message-Id: <x3ypv606qau.fsf@tigre.matrox.com>


[posted and CCed]

rjk@linguist.dartmouth.edu (Ronald J Kimball) writes:

>     push, @{$products{$prodcat}}, [$prodname, $prodprice];
         ^^^

No comma there.

>     foreach $prod_ref ($products{$category}) {

That should be:

	foreach $prod_ref (@{$products{$category}}) {


Ala



------------------------------

Date: 23 Mar 1999 18:04:00 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: << string definer
Message-Id: <7d8l2g$m9r$1@client2.news.psi.net>

Timothy Larson (larsot2@krypton.mankato.msus.edu) wrote on MMXXX
September MCMXCIII in <URL:news:7d8blh$dv8$1@nitrogen.mankato.msus.edu>:
[] In _Teach Yourself Perl in 21 Days_ I found a neat use of << to define
[] multiline strings.  I tried it with Perl 5.004 on linux and it doesn't
[] work.  OK, the book is an old one, so I was thinking maybe this use of
[] << has been dropped.  Does anyone know?  I haven't found a mention of it
[] so far.  I just thought it would be a convenient way to make my comment
[] block into a string that could be shown to the user if something goes
[] wrong.


It doesn't work? Perhaps you should feed it more.



Abigail
-- 
What's the point in asking such question without telling us what you
did, what you expected it to do, and what it actually did?


------------------------------

Date: Tue, 23 Mar 1999 10:09:15 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: << string definer
Message-Id: <36F7D8CB.E3B0A557@mail.cor.epa.gov>

Timothy Larson wrote:
> In _Teach Yourself Perl in 21 Days_ I found a neat use of << to define
> multiline strings.  I tried it with Perl 5.004 on linux and it doesn't
> work.  OK, the book is an old one, so I was thinking maybe this use of
> << has been dropped.  Does anyone know?  I haven't found a mention of it
> so far.  I just thought it would be a convenient way to make my comment
> block into a string that could be shown to the user if something goes
> wrong.
> Tim

This is usually called a 'here document'.  It comes from unix shell
programming.  It works on all Perls (as far as I know) and is not going
to be dropped.  Too many people use it in too many places.  The most
common problem people hit with here docs is not getting that last line 
quite right.  If you say:

print<<ENDOFJUNK
Top of the world ma!
ENDOFJUNK

 ..then you have to make sure that you have no whitespace or invisible
characters on either side of that third line.  The second most common
problem is accidentally putting a space between '<<' and 'ENDOFJUNK',
in which case you just told Perl to print until the first blank line.
Oops.

You might want to call perl using the -w flag too.  It will catch a
lot of your errors.  I *always* use it in any code longer than a
line, and even in a lot of my one-liners.

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Tue, 23 Mar 1999 13:22:01 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: << string definer
Message-Id: <x3yn2146p86.fsf@tigre.matrox.com>


Donny Widjaja <donny@impulsesoftware.com> writes:

> When you use <<, you must not put extra space in front of the word
> 'END'.  It might work for some people (I don't know), but it does not
> work when I put extra space.

Anyone thought about reading some documentation? maybe?

>From perldata:

A line-oriented form of quoting is based on the shell "here-doc"
syntax.  Following a C<E<lt>E<lt>> you specify a string to terminate
the quoted material, and all lines following the current line down to
the terminating string are the value of the item.  The terminating
string may be either an identifier (a word), or some quoted text.  If
quoted, the type of quotes you use determines the treatment of the
text, just as in regular quoting.  An unquoted identifier works like
double quotes.  There must be no space between the C<E<lt>E<lt>> and
the identifier.  (If you put a space it will be treated as a null
identifier, which is valid, and matches the first empty line.)  The
terminating string must appear by itself (unquoted and with no
surrounding whitespace) on the terminating line.



Why assume things when answers are just a couple of keyboard strokes away?

HTH,
Ala



------------------------------

Date: Tue, 23 Mar 1999 20:46:02 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: << string definer
Message-Id: <e4TJ2.545$Yk5.96485@news.shore.net>

David L. Cassell <cassell@mail.cor.epa.gov> wrote:
: quite right.  If you say:

: print<<ENDOFJUNK
: Top of the world ma!
: ENDOFJUNK

: ..then you have to make sure that you have no whitespace or invisible
: characters on either side of that third line. 

This construction seems to confuse a lot of beginning perl programmers,
especially those without much unix experience. 

It might be worth pointing out in the docs (I just discovered this fairly
recently) that you can do multi-line strings using normal quote operators
as well. I often use
	print qq|
Some multi-line text
Some more of the same
|;

to accomplish nearly the same thing, and I just discovered (when I tried
it) that you can even do the same thing with regular old double-quotation
marks.

There are, of course, differences in the two approaches (e.g. the ; goes
at the end of the string, rather than after the <<TAG; the string itself
starts immediately after the quote character and not on the first line
after) but the more I use it, the more the qq construct seems more
"perlish" and intuitive, not least of all because it doesn't matter where
on the line you place the closing quote character.

--Art

-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


------------------------------

Date: Tue, 23 Mar 1999 15:04:12 -0500
From: Mitchell Charity <D4At@vendian.org>
Subject: A few regular expressions for C source code
Message-Id: <36F7F3BC.110DA14F@vendian.org>

Here are a few regular expressions to aid in the parsing of
C source code.  As there is a regexp for C comments included
in the Perl FAQ, I though there might be some slight interest.

This is small hack.  You probably want to use the module
"C::Scan - scan C language files for easily recognized constructs"
instead.

Fyi,
Mitchell Charity
D4At@vendian.org

# Here are some PERL regular expressions to aid preprocessor-phase
# parsing of C source code.
#   ** QUALITY IS PRE-ALPHA, AS-IS, DEVELOPMENT CODE **.
# Comments welcome.  Perl5 or later required.
#
# Version 1999.Mar.23
# http://www.vendian.org/mncharity/ccode/
#
# 1999.Mar.23
# This is from a C code understanding project of mine, at the moment
# on indefinite hold.  Originally intended to evolve into a real package,
# I make it available now, as is, rather than waiting indefinitely for
# further maturation.  Just in case someone else finds it of use.
#
# Please let me know if you do find it useful.
# I've several other fragments lying about which might be added.
#
# Mitchell Charity <mcharity@lcs.mit.edu>
# Distributable/modifiable under the same terms as perl itself.

package C_Regexps;

# phase linewraps  comments
# p0     yes        yes
# p1      no        yes     s/$linewrap//g
# p2      no         no     s/$comment/ /g; (not really!)
#
# no_foo_start does not treat positions in linewrap as part of any
# following foo.

$nevermatch        = qr/(?=A)(?!A)/;

$linewrap_p2       = $nevermatch;
$linewrap_p1       = $nevermatch;
$linewrap_p0       = qr/\\\n/;
my $linewrap = $linewrap_p0;  # beware, not idempotent

$adjacency_p2      = qr//;
$adjacency_p1      = qr//;
$adjacency_p0      = qr/|$linewrap_p0/;
my $o = $adjacency_p0;

$comment2_p2       = $nevermatch;
$comment2_p1       = qr!\/\/(?>.*)!;
$comment2_p0       = qr!\/$o\/(?>(?:$linewrap_p0|.)*)!;

$comment1_p2       = $nevermatch;
$comment1_p1       = qr!\/\*(?>(?:[^*]+|\*[^\/])*)\*\/!;
$comment1_p0       = qr!\/$o\*(?>(?:$linewrap_p0|[^*]|\*$o[^\/])*)\*$o\/!;

$comment_p2        = qr/$comment1_p2|$comment2_p2/;
$comment_p1        = qr/$comment1_p1|$comment2_p1/;
$comment_p0        = qr/$comment1_p0|$comment2_p0/;
my $comment = $comment_p0;

$not_comment_start_p2 = qr//;
$not_comment_start_p1 = qr/(?![^\/]|\/[^\/\*])/;
$not_comment_start_p2 = qr/(?![^\/]|\/$o[^\/\*])/;

$dot_p2            = qr/./;
$dot_p1            = qr/$comment_p1|(?!$comment_p1)./;
$dot_p0            = qr/(?>$linewrap*)(?:$comment_p0|(?!$comment_p0).)/;

$s_p2              = qr/\s/;
$s_p1              = qr/\s|$comment_p1/;
$s_p0              = qr/(?>$linewrap*)(?:\s|$comment_p0)/;

$sh_p2             = qr/[ \t]/;
$sh_p1             = qr/[ \t]|$comment_ph0/;
$sh_p0             = qr/(?>$linewrap*)(?:[ \t]|$comment_ph0)/;

$string            = qr/\"(?>(?:[^\\\"]+|\\.)*)\"/;
$quote             = qr/\'(?>(?:[^\\\']+|\\.)*)\'/;

$container_p2      = qr/$comment_p2|$string|$quote/;
$container_p1      = qr/$comment_p1|$string|$quote/;
$container_p0      = qr/$comment_p0|$string|$quote/;

$not_container_start_p2 = qr/[^\"\'\/]|\/[^\/\*]/;
$not_container_start_p1 = qr/[^\"\'\/]|\/[^\/\*]/;
$not_container_start_p0 = qr/[^\"\'\/]|\/$o[^\/\*]/;


# $csq_or_rest_p2
$stuff_p2          = qr/$comment_p2|$string|$quote|$not_container_start_p2+/;
$stuff_p1          = qr/$comment_p1|$string|$quote|$not_container_start_p1+/;
$stuff_p0          = qr/$comment_p0|$string|$quote|$not_container_start_p0+/;

$stuff_p1_unpacked = qr/($comment_p1)|($string)|($quote)|($not_container_start_p1+)/;

$bol_p2            = qr/(?m)^/;
$bol_p1            = qr/(?m)^/;
$bol_p0            = qr/(?m)^(?<!$linewrap_p0)/;

$cpp_line_p2       = qr/$bol_p2$sh_p2*\#(?>$dot_p2*)/;
$cpp_line_p1       = qr/$bol_p1$sh_p1*\#(?>$dot_p1*)/;
$cpp_line_p0       = qr/$bol_p0$sh_p0*\#(?>$dot_p0*)/;

$cpp_line_p2_command = qr/$bol_p2$sh_p2*\#$sh_p2*([a-z_][a-z_0-9]*)(?>$dot_p2*)/i;

# End of file


------------------------------

Date: Tue, 23 Mar 1999 13:17:18 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: CGI.pm questions
Message-Id: <comdog-ya02408000R2303991317180001@news.panix.com>

In article <36f7b2a2.52574254@news.west.net>, melLA@west.net posted:

> Randall, you're wrong. If you had not snipped my original post beyond
> comprehension, it would have shown that my specific questions were
> germaine to the CGI.pm module, which is written in Perl. My questions
> were not CGI related in any specific sense -- they were definitely

yes they were.  calm down.  i've answered your question and posted
it to the appropriate newsgroup, comp.infosystems.www.authoring.cgi.
we talk about language specific stuff in there quite frequently.

> Perl related. comp.infosystems.www.authoring.cgi threads are not
> language specific. Please try again with worthwhile advice if you have
> any.

why have such a short-sighted approach?  this sort of answer only 
gets you kill filed, and less likely to get good advice later.  some
of the people reading c.p.l.m are trying to maintain a little civility,
and one of the facets of that is off-loading the huge CGI burden onto
comp.infosystems.www.authoring.cgi, where it's more on-topic and is of
interest to more of the readership.

but then maybe you are just a 14 year old asshole.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


------------------------------

Date: Tue, 23 Mar 1999 11:04:35 -0800
From: dan <webmaster@macdaddyusa.com>
Subject: cookie help
Message-Id: <36F7E5C3.E2EBF950@macdaddyusa.com>

i want to save $user to a cookie, can anyone help me out? thanks a lot




------------------------------

Date: Tue, 23 Mar 1999 14:30:18 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: dan <webmaster@macdaddyusa.com>
Subject: Re: cookie help
Message-Id: <36F7EBCA.1D235E56@giss.nasa.gov>

[courtesy copy of post sent to cited author]

dan wrote:
> 
> i want to save $user to a cookie, can anyone help me out? thanks a lot

perldoc CGI::Cookie

	Jay Glascoe
-- 
Narf!


------------------------------

Date: 23 Mar 1999 20:29:37 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: cookie help
Message-Id: <7d8tjh$nnp$1@client2.news.psi.net>

dan (webmaster@macdaddyusa.com) wrote on MMXXX September MCMXCIII in
<URL:news:36F7E5C3.E2EBF950@macdaddyusa.com>:
@@ i want to save $user to a cookie, can anyone help me out? thanks a lot



Take 70 kg of butter and mix that with 70 kg of sugar and a cup of vanilla
extract. Chop the $user into small parts and mix it in with the butter
and sugar. Add 24 dozens of eggs. Mix till you have a uniform, airy
substance. Quickly add 70 kg of flour and mix till no flour is visible.
Add a pinch of salt.

Have you oven preheated to 225 degrees. Oil or flour a baking tray.
Make small to medium (1-2 cm across) balls of dough, and flatten them
on the tray. Bake for 15 minutes.

Do not serve to vegetarians.



Abigail
-- 
perl -wleprint -eqq-@{[ -eqw\\\\- -eJust -eanother -ePerl -eHacker -e\\\\-]}-


------------------------------

Date: Tue, 23 Mar 1999 20:34:52 GMT
From: chris@codegurus.com (Chris Chubb)
Subject: Environment Vars not exported to shared libraries (Solaris)
Message-Id: <7d8tlq$nrn$1@clarknet.clark.net>

I am running a DBD driver that requires a couple of 
set environment variables on Solaris. When I set the
environment variables, then run the perl script, the 
database drivers run normally. If I set the environment
variables inside the perl script, via $ENV{}='' then 
the script does not work, returning error codes in the 
shared libraries.

This is perl, version 5.004_04 built for sun4-solaris

I am using the DBD::Fulcrum module. Like I said, it
works fine if I do a
setenv ENV_VAR thevalue
perl test.pl

But, if in test.pl, the first statement is:
$ENV{'ENV_VAR'}='thevalue';
then it does not work. 

I know the man pages say that setting ENV will work
for any shelled processes, but do shared libraries
count as forked processed? Or, might they be taking the 
environment that existed when Perl was started?

Has anyone else seen this behavior?



------------------------------

Date: Tue, 23 Mar 1999 10:15:31 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: How do variable substitution on a string twice?
Message-Id: <36F7DA43.8F4E6252@mail.cor.epa.gov>

Mikael Uvebrandt wrote:
> Is there any way to make perl do variable substitution on a string
> twice ("$a" = '$b' and "$b" = 'b_value', so "$a" = {insert magic
> here} = 'b_value')?
> 
> I have a line like this:
> s/$searchstr/$replstr/g
> 
> Now, Perl will treat $replstr as double-quoted and do variable
> substitution on it. But suppose $replstr="$1" because I want to do
> something with the regex in $searchstr. What I want is for Perl to
> recognize $1 as a reference to the regex in $searchstr, instead of
> using '$1' literally as the replace string. Is there any way of
> tricking Perl into doing this?
> I must have the search and replace strings in variables, because I
> don't know beforehand what they will be when the actual
> substitution is made.
> 
> Thankful for any ideas,
> Micke

s/$searchstr/$replstr/gee

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Tue, 23 Mar 1999 18:47:28 GMT
From: "Vincent P. Mautone" <vince@oxxfordinfo.com>
Subject: Re: MS Access and Perl -- help!
Message-Id: <4lRJ2.62056$rs2.17629179@client.news.psi.net>

hi,

i'm not familiar with the linux world but odbc under windows requires an
odbc driver (which you seem to have) and a defined odbc resource (a
database, a table  or a file). It seems that you need to use the
iODBCManager to configure a resource for your database . For example, you
need to define an odbc resource called 'myodbc' which points to your Access
database('pete.mdb'). Perhaps, linux has a system utility for defining odbc
resources (nt/9X do).  In short, odbc requires the driver for your app plus
a system resource which contains the connection information into your
database.

i cannot offer any insight into your compiler problem but seems like you are
missing the header files or your include directive for compling needs to
point to the directory containing windows.h.

good luck.

vince


Pete <psalzman@landau.ucdavis.edu> wrote in message
news:7d7dn1$ce7$1@mark.ucdavis.edu...
>Dear all,
>
>I'm having trouble understanding all the steps necessary to get perl to
>'talk' with a MS Access database.   Here's what I've done so far:
>
>1- I installed DBI ver 1.06
>2- At this point, I tried installing DBD-ODBC-0.20
>3- When I ran perl Makefile.pl it told me that I need an ODBC Driver
>     Manager.
>
>I'm confused because I thought that DBD-ODBC *was* the driver.  If it's
>not, what exactly is it?  Anyhow, it said:
>
>   If you do not have an ODBC Driver Manager you can try building
>   the free iODBC Driver Manager in the iodbcsrc directory.
>
>OK.  so i cd to iodbcsrc and follow the instructions to the letter.  This
>is what I get:
>
># ./build linux-elf
>autoconfig linux-elf
>make
>gcc -O -fPIC -ansi -I. -DDLDAPI_SVR4_DLFCN  -DVERSION=\"2.12.0\"    -c
>dlf.c -o dlf.o
>In file included from dlf.c:16:
>dlf.h:4: windows.h: No such file or directory
>
>I'm having a rough time here.  Can some kind soul please help me get this
>running?
>
>Much thanks!
>Peter
>
>--
>---------------------------------------------------------------
>http://landau.ucdavis.edu/psalzman
>psalzman@landau.ucdavis.edu
>One world, one web, one program. -- Microsoft Ad Campaign
>Ein Volk, ein Reich, ein Fuhrer. -- Nazi Ad Campaign
>Prevent world domination, Install Linux today!
>---------------------------------------------------------------
>  The best way to accelerate a win95 system is at 9.81 m/s^2
>




------------------------------

Date: 23 Mar 1999 18:24:09 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Need username in Perl script
Message-Id: <7d8m89$m9r$3@client2.news.psi.net>

John Dilley (john@deletethisdilley.com) wrote on MMXXX September MCMXCIII
in <URL:news:36f830d7.90195566@news.jps.net>:
__ Hoping this is possible, I'm sure I'm not the first but a scan FAQs and Deja
__ News did not help, must not know the secret word...
__ 
__ I have a PERL script inside a private directory protected with a .htaccess
__ file. I would like the script to use the login name of the user accessing that
__ directory. A test sample of all $env didn't show anything of real use. One web
__ page I found mentioned REMOTE_USER, but this does not appear in my list. Is
__ there a way to get the htaccess login name from within my script?


No. All you get is what the browser sends to the server, and that the
server puts in the environment. Browsers stopped sending user names
about 5 years ago, after many reports of abuse.

If you want to set up some kind of authentication scheme, go ask in an
appropriate group.


Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


------------------------------

Date: Tue, 23 Mar 1999 18:52:21 GMT
From: mirak@mindspring.com
Subject: NT: The amount of DASD users own per server via Win32 extentions
Message-Id: <36f7e1e5.4424125@news.mindspring.com>

Hello,

Is there a way to use the PERL Win32 extentions (or anything else for
that matter) to determine users assigned to a particular server and
the amount of DASD assigned to them?

Can you regulate the space assigned to them? By share or total/server?

Thanks,
Karim


------------------------------

Date: Tue, 23 Mar 1999 13:40:21 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Odd/Even
Message-Id: <comdog-ya02408000R2303991340210001@news.panix.com>

In article <MPG.1160eac437e94b479897ab@nntp.hpl.hp.com>, lr@hpl.hp.com (Larry Rosler) posted:

> In article <1dp3gkr.na65rqq8sztsN@p57.block2.tc3.state.ma.tiac.com> on 
> Tue, 23 Mar 1999 01:18:52 -0500, Ronald J Kimball 
> <rjk@linguist.dartmouth.edu >says...
> > Gabriel Richards <grichard@uci.edu> wrote:
> > 
> > > if ($counter = [an odd number]) {do x}
> > 
> > if ($counter & 1) {do x}
> 
> That may be 'high-school' level (because it deals with binary 
> representations).
> 
>   if ($counter % 2) {do x}
> 
> is 'elementary-school' level (because it deals with arithmetic).
> 
> The '&' is perhaps 5% faster, though.

i don't know if i like that characterization.  i don't think that
knowing the number's native representation represents a more
advanced thinking.  the % operator should work despite the 
underlying representation, and as such is a more abstract way of
thinking, which puts it at the "university" level, perhaps ;)

i don't think a 5% speed improvement on a single op that represents
an insignificantly small portion of the overall program is worth
the loss of clarity.  in machine langauge, they would look the same,
so why not be more expressive in the higher level langauge, which
is higher level by design ;)

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


------------------------------

Date: Tue, 23 Mar 1999 19:37:34 GMT
From: Mike Wilson <wmwilson1@go.com>
Subject: Passing parameters (CGI)
Message-Id: <7d8qhu$ch3$1@nnrp1.dejanews.com>

I've posted this to alt.www.webmaster as well, with no decent answers.

I was wondering if someone could help me with a little perl problem I'm
having. I currently have a perl script which creates a form and takes the
parameter table=tablename.  When I pass this form to the perl script which
parses the info and submits it to the database it seems as if it doesn't like
my table reference and therefore fails.  I'm doing something like

in the form script..
<FORM METHOD="POST" ACTION="/cgi-bin/script.pl?table=this_table">

my query = new CGI;
my $table = query->param("table")

if($table eq 'this_table') {
     do_this;
} elsif($table eq 'other_table') {
     do_that;
}

my $dbh.....

my $name = $dbh->quote($query->param("name"));
 ..etc.

unless ($name and $this...) {
                 Failed, try again...   ##This is where I end up
}

Getting the table (and sometimes thread) value seems to work fine every other
time I try, it's just in this form to parser transfer that it doesn't work.
Can anyone tell me what I'm doing wrong?  Thanks in Advance,  Mike


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: 23 Mar 1999 19:57:46 GMT
From: robobob@blech.mindwell.com (Jason)
Subject: Re: Passing parameters (CGI)
Message-Id: <slrn7ffshr.243.robobob@blech.mindwell.com>

On Tue, 23 Mar 1999 19:37:34 GMT, Mike Wilson <wmwilson1@go.com> wrote:
>I've posted this to alt.www.webmaster as well, with no decent answers.
>
>I was wondering if someone could help me with a little perl problem I'm
>having. I currently have a perl script which creates a form and takes the
>parameter table=tablename.  When I pass this form to the perl script which
>parses the info and submits it to the database it seems as if it doesn't like
>my table reference and therefore fails.  I'm doing something like
>
I've seen this problem on a variety of different servers, some of them
dont correctly parse the arguments when you supply GET and POST data at
the same time (and from what I can see in the RFC, I dont think they are
required too.  Try changing your form to pass table as a hidden element
instead, i.e.:

Change:
><FORM METHOD="POST" ACTION="/cgi-bin/script.pl?table=this_table">

To:
<FORM METHOD="POST" ACTION="/cgi-bin/script.pl">
<INPUT TYPE=HIDDEN NAME="table" VALUE="this_table">

This has always solved the problem when I have run into it...

-- 
        Jason Kohles -- jason@mediabang.com
        http://www.mediabang.com/

          "This is as bad as it can get, but don't bet on it."


------------------------------

Date: Tue, 23 Mar 1999 10:14:05 -0800
From: Stewart Eastham <sme@planetpod.com>
Subject: Re: PERl and Server Side Includes SOLUTION
Message-Id: <36F7D9ED.D76E6E96@planetpod.com>

Thanks for all the help, everyone.  After trying all the different methods,
the only method that ended up working was:

<!--#include virtual="/cgi-bin/helloworld.cgi?parameters" -->

Thanks again

stewart



------------------------------

Date: Tue, 23 Mar 1999 20:28:42 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Perl Books (was Re: << string definer)
Message-Id: <_PSJ2.544$Yk5.96485@news.shore.net>

Timothy Larson <larsot2@krypton.mankato.msus.edu> wrote:
: In _Teach Yourself Perl in 21 Days_ I found a neat use of << to define
: multiline strings.

This is the second time I've seen this book mentioned today. Is it getting
remaindered somewhere?

Here is a critical review of the book in question:
http://xenu.phys.uit.no/~tom/TYP21D.html

While I can't vouch for the accuracy of this review (I haven't read this
book), if it's half as bad as "Teach Yourself CGI Programming with Perl 5
in 7 Days" (same publisher) it should be avoided at all (or any) cost. The
latter book seemed to have been written by someone who didn't really
understand the subject matter, and who was just cutting and pasting
information (and code examples) that he found on the web. Aspiring perl
programmers would be much better off sticking to the O'Reilly & Associates
offerings.

--Art
-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


------------------------------

Date: Tue, 23 Mar 1999 20:27:34 GMT
From: lexuNOSPAM@compuserve.com (Alexander F. Gutfeldt)
Subject: Re: Perl WIN32 - How to return a DOS ErrorLevel?
Message-Id: <36f7f3fe.20102153@news.compuserve.com>

"Brian Moore" <bmoore3@standard.com> wrote:

>I know it seems simple, but having gone through the PERL for Win32 docs, I
>find nothing about returning the most basic of Windows cmd values, the
>ERRORLEVEL.

Brian, I don't know how set the error level either, but do you really
need to? Would it be so hard to do in Perl, what you can do in
Dos-Batch... nicely circumventing (not solving) the dos-errorlevel.

'lexu
to reply please remove the capital characters (NOSPAM)  from the  email-address.


------------------------------

Date: Tue, 23 Mar 1999 21:50:11 +0100
From: "Willem" <henkslaaf@dikkelul.com>
Subject: Request: Sample Multi Threaded Perl TCP Server/
Message-Id: <7d8v2s$63c$1@dinkel.civ.utwente.nl>

Could someone post a sample multi threaded perl tcp server (I gues this
would use the perl 'fork' function?), because some sample things would help
me through!

Thanks




------------------------------

Date: Tue, 23 Mar 1999 20:47:46 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Role for Developer / Admin upto ??40k
Message-Id: <S5TJ2.546$Yk5.96485@news.shore.net>


Robert Griffiths <rgriffiths@homedirectory.com> wrote:
: Role for Developer / Admin

: Salary: upto 40k
: Situated: Islington, London N1
: The primary role is the developer:

Two points:

1) This isn't a jobs newsgroup.

: The work for this role will not start in earnest for a couple of months:

: o7 Maintenance of current set-up b

2) I don't think many perl folks would be interested in this job anyway.

:)

--Art
-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


------------------------------

Date: Tue, 23 Mar 1999 20:23:54 GMT
From: chris@codegurus.com (Chris Chubb)
Subject: Re: scripts to organize Radius files
Message-Id: <7d8t18$lo1$1@clarknet.clark.net>

Why cant you just read the whole file into a single variable then 
do a replace:
$wholefile =~ s/(\n\s*)/\;\ /go; #Replace any CR followed by optional
white space with a semicolon and a space.

Chris.

In article <36f00126.5258661@news.tor.sfl.net>, hannu@ils.net.no.spam (Hannu) 
wrote:
>This wheel has propably been already invented:
>I am trying to find a Perl script that would re-write Radius
>(Livingston) detail files into a more computable one-line format.
>
>This is how the records in the detail file look like now:
>Mon Mar 15 00:04:03 1999
>        NAS-IP-Address = 309.134.121.6
>        NAS-Port = 81
>        NAS-Port-Type = Async
>        User-Name = "username"
>        Called-Station-Id = "9758213508"
>        Calling-Station-Id = "9754789496"
>        Acct-Status-Type = Start
>        Acct-Authentic = RADIUS
>        Service-Type = Framed-User
>        Acct-Session-Id = "0000644D"
>        Framed-Protocol = PPP
>        Acct-Delay-Time = 0
>        Timestamp = 921474243
>
>I'd like to have something like this:
>
>Mon Mar 15 00:04:03 1999: User-Name = "username";  Acct-Status-Type; 
>and so on, all in one line.
>
>Any help appreciated!
>Hannu
>
>


------------------------------

Date: Tue, 23 Mar 1999 13:19:03 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Sending HTTP Referer field using perl
Message-Id: <comdog-ya02408000R2303991319030001@news.panix.com>

In article <36F7C8E4.3E8C4AD4@arkitekt-maa.dk>, Henrik Hansen <henrik@arkitekt-maa.dk> posted:

> PERL:
> print "Referer: http://www.my-website.dk";
> print "Location: http://www.new-website.com";
> 

Referer is a request header.  it's meaningless in responses.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


------------------------------

Date: Tue, 23 Mar 1999 14:19:36 -0500
From: "Moradhassel, Kavian [SKY:1P12:EXCH]" <kavian@americasm01.nt.com>
Subject: Re: Weird Perl problem
Message-Id: <7d8pg9$4bs$1@bmerhc5e.ca.nortel.com>



Abigail <abigail@fnx.com> wrote in message
news:<7d48bc$nou$3@client2.news.psi.net>...
> Kavian Moradhassel (kavian@nortelnetworks.com) wrote on MMXXVIII
> September MCMXCIII in <URL:news:7d3r26$eu2$1@bmerhc5e.ca.nortel.com>:
> __
> __ The details:  The script is a five-line driver script using a Perl
module
> __ (which subsequently 'use's three or four other modules) with 'use
strict'
> __ and the '-w' switch on.  It's running as a CGI executing with Perl
5.00502
> __ on an Apache server on an HPUX 10.20 machine (a Merlin, I believe).
>
>
> Those are the "details"? A pretty vague description? 4 lines of text,
> describing 5 lines of code? How about being a bit more detailed, and
> at least displaying the second and fourth line of code?


The actual code where the problem happens covers about 4000 lines...I'm
assuming not everyone wants to read through this.  The 'details' section was
really intended to let you folks know in what environment my code is
running.

Thanks,
Kav





------------------------------

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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 5208
**************************************

home help back first fref pref prev next nref lref last post