[18645] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 813 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 1 14:06:23 2001

Date: Tue, 1 May 2001 11:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <988740308-v10-i813@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 1 May 2001     Volume: 10 Number: 813

Today's topics:
    Re: Another regexp question <keesh@users.pleaseremovethisbit.sourceforge.net>
    Re: CGI/Perl scripts not readable ! (E.Chang)
        Corrupted scripts Winows to UNIX (nospam)
    Re: DBD::ODBC <cpryce@pryce.net>
    Re: Getting IP address and not a proxy one? (Chris Fedde)
    Re: Hacker Challenge. Can you break this script for me? (Rudolf Polzer)
    Re: Hacker Challenge. Can you break this script for me? (Chris Fedde)
    Re: Hacker challenge. Can you break this script for me? <jfreeman@tassie.net.au>
    Re: Hacker Challenge. Can you break this script for me? <godzilla@stomp.stomp.tokyo>
    Re: Hacker Challenge. Can you break this script for me? <jfreeman@tassie.net.au>
    Re: Hacker challenge. Can you break this script for me? <jfreeman@tassie.net.au>
    Re: Hacker Challenge. Can you break this script for me? <jfreeman@tassie.net.au>
    Re: Hacker Challenge. Can you break this script for me? (Rudolf Polzer)
    Re: How to: Create Regex which extracts N number of wor <ren@tivoli.com>
    Re: loop variable scope rasunci@qual-pro.removethis.com
    Re: Multiple errors running newspro.cgi (Tad McClellan)
    Re: one-line stderr, stdout redirection (Rudolf Polzer)
    Re: one-line stderr, stdout redirection (Tad McClellan)
        perl program suggestions <vrdoljak@uclink.berkeley.edu>
        perlcc does not work - does anyone know how to fix it? (Rudolf Polzer)
    Re: Q: Using 'rename' with CGI <andras@mortgagestats.com>
        Question about float to hex <toaster@nomail.org>
    Re: RegEx Question <ren@tivoli.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 01 May 2001 18:43:21 +0100
From: "Ciaran McCreesh" <keesh@users.pleaseremovethisbit.sourceforge.net>
Subject: Re: Another regexp question
Message-Id: <9cmsfh$9rd$1@newsg1.svr.pol.co.uk>

In article <slrn9erfbj.3fb.dha@panix2.panix.com>, "David H. Adler"
<dha@panix2.panix.com> wrote:
>> And it's regex, not regexp :)
> 
> As much as I would like to agree with you, much usage is against us.  A
> number of modules on CPAN use Regexp, and there's a rather long thread
> currently on p5p discussing this...

Jeffrey Friedl in /Mastering Regular Expressions/:

"I recommend eschewing this unpronounceable blot on English."

Well said that man. I'm seriously tempted to modify my newsreader to
s/(regex)p/\1/gi; everything to make it easier to read...

-- 
Ciaran McCreesh
mail:    keesh@users.sourceforge.net
web:     http://www.opensourcepan.com/


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

Date: Tue, 01 May 2001 15:05:14 GMT
From: echang@netstorm.net (E.Chang)
Subject: Re: CGI/Perl scripts not readable !
Message-Id: <Xns909470D659939echangnetstormnet@207.106.93.86>

tvdv@advalvas.be (Tony Van der Voort) wrote in 
<3aeeb164.13858992@news.skynet.be>:

> I'm hosting webspace and on that space there are a lot of CGI/Perl
> scripts pre-installed. But, when I download them on my harddisk and
> want to look to the code, i have only unreadable rubbish. 
> 
> What's the reason of that ? Is there a way to compile CGI/Perl code
> before uploading to the server, so that other people that comes on
> that server cannot look in the original code ?

If they are completely unreadable garbage, not just badly wrapped text, 
then they might be compiled from other languages such as C.  Perl is not 
the only language that is used to write programs that use the CGI.  You use 
of "CGI/Perl" suggests you might think them equivalent. Perl is a general 
purpose programing language; the Common Gateway Interface is a standard 
that can be implemented in many languages.

-- 
EBC


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

Date: Tue, 01 May 2001 16:35:04 GMT
From: "Nigel Taylor" <niget(nospam)@sympatico.ca>
Subject: Corrupted scripts Winows to UNIX
Message-Id: <YABH6.212$k95.33807@news20.bellglobal.com>

Hi
I am currently having problems with scripts that I upload to a Unix server.

For example after editing formmail (Matts Archive) to my parameters, and
uploading via WS_FTP, the script will not run.

'Internal Server Error'

My hosting tech had to re-install the script from his end, he said the size
of the file should be 14k, but after upload it
is 23k.

I know it is not a path problem etc.

I use Programmers file editor or Notepad to edit, I edit in windows 98, and
upload with a DSL connection.

This is obviously a real problem if all my scripts are corrupted somehow.

Anyone have any ideas on what may be causing my problems.

Nigel




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

Date: Tue, 01 May 2001 11:29:03 -0500
From: Chris <cpryce@pryce.net>
Subject: Re: DBD::ODBC
Message-Id: <B7144E7F.3E81%cpryce@pryce.net>

in article dwilga-MUNGE-62C8AB.10572230042001@nap.mtholyoke.edu, Dan Wilga
at dwilga-MUNGE@mtholyoke.edu wrote on 04/30/2001 9:57 AM:

> In article <9cio8k01qcd@enews1.newsguy.com>,
> "Michael R. McPherson" <mrp@hafatel.com> wrote:
> 
>> I have DBD::ODBC installed using Openlink with iodbc.  Whe I run a script
>> from the shell it works as is expected.  Same script yet run via a web page
>> and it returns the following error.
>> 
>> Couldn't connect to database[OpenLink][ODBC]RPC: Unknown host (SQL-08004)
>> [OpenLink][ODBC]Connection rejected by data source (SQL-08004)(DBD:
>> db_login/SQLConnect err=-1) at /home/httpd/cgi-bin/hafa.pl line 18.
>> 
>> What could I be doing wrong ?
> 
> The Openlink driver is looking for ~/.odbcini  and/or  ~/.udbcini (depending
> on which version of the dirver you're using.) The home directory is probably
> different for the web server, since it's run as a different user.
> 
> Easiest thing is to do a symlink from that user's home to wherever you keep
> these files.

If you're running Apache, you can also use the SetEnv directive to set the
environment variables for the Web server.

See: http://httpd.apache.org/docs/env.html (or
http://httpd.apache.org/docs-2.0/env.html for version 2.0 docs)

For more information.

-----
cp



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

Date: Tue, 01 May 2001 15:28:52 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Getting IP address and not a proxy one?
Message-Id: <UCAH6.240$T3.220476928@news.frii.net>

In article <xjxH6.20696$PP3.1583072@nnrp3.clara.net>,
Paul Brown <paul.brown@ukinternetsites.com> wrote:
>Hi,
>
>Just a quick question, for a login system I have wrote it logs the IP
>address of the visitor.  At the moment I am using the env -
>$ENV{REMOTE_ADDR} works great.  However some visitors have told me it logs
>the wrong IP address for them.
>
>After some digging I found it was done to that visitor using a proxy server
>or a have a funny network setup.  So my script logs the proxy server or the
>network IP address - and not the users IP.
>
>Is there a modual or another env which returns the users actually IP address
>and not the network/proxy one?
>
>Any ideas?  Thanks,
>
>Paul
>

Of what use is the remote users IP address?  Are you using this as some
kind of user tracking token?  A more succesful technique would be to use a
cookie.  But that is a discussion for a group that has the string www
somewhere in it's name.

Good Luck
chris
-- 
    This space intentionally left blank


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

Date: Tue, 1 May 2001 19:33:01 +0200
From: eins@durchnull.de (Rudolf Polzer)
Subject: Re: Hacker Challenge. Can you break this script for me?
Message-Id: <slrn9etsqd.d8k.eins@www42.t-offline.de>

Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> Jfreeman wrote:
> 
> > It has long been axiomatic that only (the Perl parser) can parse perl.
> 
> (snipped) 
> 
> Randal sorely underestimates his abilities in his article
> relative to this thread. My belief is Randal has forgotten
> more about Perl than I have learned over a number of years.
> 
> After unzipping your file, setting up a test directory,
> it took me less than three minutes to break your script.
> 
> 
> C:\APACHE\USERS\TEST>perl stripcom.pl chahta.cgi
> 
> Compile check .\chahta.cgi
> Compile check failed!
> Sorry perl script .\chahta.cgi does not compile, Aborting!
> Can't localize lexical variable $found at (eval 1) line 1152
> 
> 
> Relative lines out of a total 3565 lines:
> 
> 1148   sub Ikbi_Himmona
> 1149
> 1150   { ## Ikbi_Himmona
> 1151
> 1152    local ($buf, $tbuf, $last_para, $found, $amount_to_read);
> 1153    local ($para_num, $ipa, $dns, $date1, $hochifo_holba, $hochifo,
> $holisso_holba,
> 1154           $takla_holisso, $special_output);

Where is the problem? I do not see anything in this that does not work. Was
it declared with 'my' before? What was the original code at this position?

-- 
#!/usr/bin/perl -W -- WARNING: This will print 22,307 bytes! <strictsafe!>
use strict;for(my$y=-1;$y<1;$y+=.1){for(my$x=-1.9;$x<.4;$x+=.03){print'+';
my$X=my$Y=0;for(0..99){($X,$Y)=($X*$X-$Y*$Y+$x,2*$X*$Y+$y);print"\b "if$X*
$X+$Y*$Y>9;}}print"\n"};print''.reverse"\nHPAJ \a!rezloP .R yb torblednaM"


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

Date: Tue, 01 May 2001 15:39:53 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Hacker Challenge. Can you break this script for me?
Message-Id: <dNAH6.242$T3.191021056@news.frii.net>

In article <slrn9etsqd.d8k.eins@www42.t-offline.de>,
Rudolf Polzer <eins@durchnull.de> wrote:
>Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
>> Jfreeman wrote:
>> 
>> > It has long been axiomatic that only (the Perl parser) can parse perl.
>> 
>> (snipped) 
>> 
>> After unzipping your file, setting up a test directory,
>> it took me less than three minutes to break your script.
>> 
>> 
>> C:\APACHE\USERS\TEST>perl stripcom.pl chahta.cgi
>> 
>> Compile check .\chahta.cgi
>> Compile check failed!
>> Sorry perl script .\chahta.cgi does not compile, Aborting!
>> Can't localize lexical variable $found at (eval 1) line 1152
>
>Where is the problem? I do not see anything in this that does not work. Was
>it declared with 'my' before? What was the original code at this position?
>

Rudolfo,

Perhaps you missed the point.  Godzilla volunteered as the original
poster asked.  She bravely ran the venerable Jfreeman's script with
her chahta.cgi script as input. The venerable Jfreeman's code barfed
on apparently valid perl code.

As has been asserted before:
    Leave perl parsing to the perl parser

chris

-- 
    This space intentionally left blank


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

Date: Wed, 02 May 2001 02:43:35 +1000
From: Jfreeman <jfreeman@tassie.net.au>
Subject: Re: Hacker challenge. Can you break this script for me?
Message-Id: <3AEEE7B7.110287CB@tassie.net.au>


"Randal L. Schwartz" wrote:

> >>>>> "Jfreeman" == Jfreeman  <jfreeman@tassie.net.au> writes:
>
> Jfreeman> Stripcomments.pl is a script that will parse a perl script
> Jfreeman> and remove all comments. It will optionally also crunch the
> Jfreeman> script down JAPH style to a user defined line length.
>
> I'm curious.  Will the resulting program, as assisted by this
> beta testing, be always free under the GPL/AL?

Yes

> Or are you planning
> on charging for your program?

No

>
> If you're planning on charging, will you also compensate financially
> the use of this public resource to make your program better?

N/A

> As in,
> pay the people who are trying to break your program

Perhaps some share options!!!!!

> (which I bet I
> could do given a spare half hour or so)?

I have absolutely no doubt that hackers will be able to break this. It is not the
perl parser. However this particular code is now at the stage that a good chunk
of regular perl does not break it. As such it might possibly be said to be
functional, if not perhaps up to Abigails standards. Yet ;-)

>
>
> So, speak out.

>
> print "Just another Perl hacker,"
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



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

Date: Tue, 01 May 2001 09:38:15 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Hacker Challenge. Can you break this script for me?
Message-Id: <3AEEE677.B78DD06@stomp.stomp.tokyo>

Rudolf Polzer wrote:
 
> Godzilla! wrote:
> > Jfreeman wrote:

> > > It has long been axiomatic that only (the Perl parser) can parse perl.

> > (snipped)

(snipped again)

> > it took me less than three minutes to break your script.

> > C:\APACHE\USERS\TEST>perl stripcom.pl chahta.cgi

> > Compile check .\chahta.cgi
> > Compile check failed!
> > Sorry perl script .\chahta.cgi does not compile, Aborting!
> > Can't localize lexical variable $found at (eval 1) line 1152

> > Relative lines out of a total 3565 lines:

> > 1148   sub Ikbi_Himmona
> > 1149
> > 1150   { ## Ikbi_Himmona
> > 1151
> > 1152    local ($buf, $tbuf, $last_para, $found, $amount_to_read);
> > 1153    local ($para_num, $ipa, $dns, $date1, $hochifo_holba, $hochifo,

(snipped)

> Where is the problem?

Within Freeman's parsing script.


> I do not see anything in this that does not work.

This is correct. My script has been in use for a few
years, by thousands of visitors sustaining well over
three million hits to date. Obviously, it compiles.


> Was it declared with 'my' before?
> What was the original code at this position?

This error in a his script is not related to
my variable $found, as other variables are
treated the same. Some are outright global
variables lacking "my" or "our" declarations.
Others are pseudo global variables created
within a seek and read function.

I haven't examined Freeman's script nor intend
to do so. My guess is his script choked on
"local" and his programming method selected
$found for his error message although I believe
his error is more broad than this single variable.

My suspicion is many of my other scripts will
break his parser, post haste. Use of CPAN
scripts, presumably all modules, is a decent
test of his parser. However, modules do not
reflect average scripts in use. CPAN authors
adhere to the most strict of guidelines for
Perl; many pragmas are used although often
not needed. Freeman tested his parser with
the most "rule perfect" scripts possible.
He has not tested his parser with realistic
everyday scripts so commonly in use, per
his stated testing method.

There is a tragic analogy to his "sterile room"
approach. Many years back, with good intent,
Egyptian engineers designed and built a new
Aswan dam across the delta area of the Nile
River. All was perfect in design. Within a
few years, this dam became useless having
been immediately equalized with millions of
tons of silt deposited by the Nile, behind
this dam. Wasn't long, a fatal disease
devastated the local farming population, a
disease spread by an indigenous water bound
snail, which was stepped upon by barefoot
farmers. This sterile room approach to dam
design, although a failure, was successful
in creating a vast natural habitat for this
specific rather deadly tiny snail.

I reckon if you intend to build a better
pitchfork, you need to be willing to step
in mule manure.


Godzilla!


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

Date: Wed, 02 May 2001 02:52:32 +1000
From: Jfreeman <jfreeman@tassie.net.au>
Subject: Re: Hacker Challenge. Can you break this script for me?
Message-Id: <3AEEE9D0.2CAF0132@tassie.net.au>



"Godzilla!" wrote:

> Jfreeman wrote:
>
> > It has long been axiomatic that only (the Perl parser) can parse perl.
>
> (snipped)
>
> Randal sorely underestimates his abilities in his article
> relative to this thread. My belief is Randal has forgotten
> more about Perl than I have learned over a number of years.
>
> After unzipping your file, setting up a test directory,
> it took me less than three minutes to break your script.

You have not broken the script at all. As stated in the pod only scripts which
compile as a string under eval are processed. Clearly this script does not pass
the eval., so never gets processed. If you can show me how to capture the output
of perl -c this would not be an issue but that's another thread - see  thread
Capturing the output of perl -c myfile.pl

James

>
>
> C:\APACHE\USERS\TEST>perl stripcom.pl chahta.cgi
>
> Compile check .\chahta.cgi
> Compile check failed!
> Sorry perl script .\chahta.cgi does not compile, Aborting!
> Can't localize lexical variable $found at (eval 1) line 1152
>
> Relative lines out of a total 3565 lines:
>
> 1148   sub Ikbi_Himmona
> 1149
> 1150   { ## Ikbi_Himmona
> 1151
> 1152    local ($buf, $tbuf, $last_para, $found, $amount_to_read);
> 1153    local ($para_num, $ipa, $dns, $date1, $hochifo_holba, $hochifo,
> $holisso_holba,
> 1154           $takla_holisso, $special_output);
>
> Godzilla! Turnip Truck Driver



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

Date: Wed, 02 May 2001 02:58:53 +1000
From: Jfreeman <jfreeman@tassie.net.au>
Subject: Re: Hacker challenge. Can you break this script for me?
Message-Id: <3AEEEB4D.8657D1E4@tassie.net.au>



"Godzilla!" wrote:

> Jfreeman wrote:
>
> (snipped)
>
> > The code, with online pod, is available here:
>
> > http://www.dynamicflight.com.au/Perl/stripcomments.pl
>
>
> 404 File not Found
>
> The document that you requested
> (http://www.dynamicflight.com.au/Perl/stripcomments.pl)
> does not exist on this server. Please check the spelling
> of the document, and make sure there are no spaces in the
> address. If there is still a problem, please contact the
> Webmaster.
>
> This type of inane mistake is indicative of very sloppy work
> and is quite inexcusable. There is not a chance I personally
> would trust your coding. My mistrust is further resolved by
> your making duplicate postings of your article, failing to
> subject line note your second article is an address correction.
>
> My presumption is you fell off the Turnip Truck, yesterday.

Yes, and it hurt too. Clearly you ripped this down off the server between my
cancelling it and posting one with the correct address. Had .pl on the brain
not  html. For the record if anyone else hits this post not the proper, real,
intended one the address is:

http://www.dynamicflight.com.au/Perl/stripcomments_pl.htm

I agree. Sloppy. To much coffee and not enough sleep.

sleep 28800;

James

>
>
> Godzilla!



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

Date: Wed, 02 May 2001 03:06:19 +1000
From: Jfreeman <jfreeman@tassie.net.au>
Subject: Re: Hacker Challenge. Can you break this script for me?
Message-Id: <3AEEED0B.F740658F@tassie.net.au>



Chris Fedde wrote:

> In article <slrn9etsqd.d8k.eins@www42.t-offline.de>,
> Rudolf Polzer <eins@durchnull.de> wrote:
> >Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> >> Jfreeman wrote:
> >>
> >> > It has long been axiomatic that only (the Perl parser) can parse perl.
> >>
> >> (snipped)
> >>
> >> After unzipping your file, setting up a test directory,
> >> it took me less than three minutes to break your script.
> >>
> >>
> >> C:\APACHE\USERS\TEST>perl stripcom.pl chahta.cgi
> >>
> >> Compile check .\chahta.cgi
> >> Compile check failed!
> >> Sorry perl script .\chahta.cgi does not compile, Aborting!
> >> Can't localize lexical variable $found at (eval 1) line 1152
> >
> >Where is the problem? I do not see anything in this that does not work. Was
> >it declared with 'my' before? What was the original code at this position?
> >
>
> Rudolfo,
>
> Perhaps you missed the point.  Godzilla volunteered as the original
> poster asked.  She bravely ran the venerable Jfreeman's script with
> her chahta.cgi script as input. The venerable Jfreeman's code barfed
> on apparently valid perl code.

Actually eval ' $string'; where $string is the code barfed,  for full details
see the the thread 'Capturing the output of perl -c myfile.pl'

James

>
>
> As has been asserted before:
>     Leave perl parsing to the perl parser
>
> chris
>
> --
>     This space intentionally left blank



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

Date: Tue, 1 May 2001 21:25:40 +0200
From: eins@durchnull.de (Rudolf Polzer)
Subject: Re: Hacker Challenge. Can you break this script for me?
Message-Id: <slrn9eu3dj.phl.eins@www42.t-offline.de>

Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> Rudolf Polzer wrote:
>  
> > Godzilla! wrote:
> > > Jfreeman wrote:
> 
> > > > It has long been axiomatic that only (the Perl parser) can parse perl.
> 
> > > (snipped)
> 
> (snipped again)
> 
> > > it took me less than three minutes to break your script.
> 
> > > C:\APACHE\USERS\TEST>perl stripcom.pl chahta.cgi
> 
> > > Compile check .\chahta.cgi
> > > Compile check failed!
> > > Sorry perl script .\chahta.cgi does not compile, Aborting!
> > > Can't localize lexical variable $found at (eval 1) line 1152
> 
> > > Relative lines out of a total 3565 lines:
> 
> > > 1148   sub Ikbi_Himmona
> > > 1149
> > > 1150   { ## Ikbi_Himmona
> > > 1151
> > > 1152    local ($buf, $tbuf, $last_para, $found, $amount_to_read);
> > > 1153    local ($para_num, $ipa, $dns, $date1, $hochifo_holba, $hochifo,
> 
> (snipped)
> 
> > Where is the problem?
> 
> Within Freeman's parsing script.
> 
> 
> > I do not see anything in this that does not work.
> 
> This is correct. My script has been in use for a few
> years, by thousands of visitors sustaining well over
> three million hits to date. Obviously, it compiles.

I wanted to know which code was generated by his script and which code was
the original one, since the error message looks like a perl syntax error and
not a die() from his script. I just wanted to see what the error is!

-- 
#!/usr/bin/perl -- Random sig generator. Editor command in slrn => ~/siggs
$F=shift;open H,"+<$F";$_=join"",<H>;$s=index$_,"\n\n-- \n";$s<0||truncate
H,$s;close H;system"$ENV{EDITOR} $F</dev/tty>/dev/tty";$s=$n=0;for#sichtig
(<~/siggs/*>){++$n;int rand$n or$s=$_};`(echo "\n\n-- ")|cat - $s>>$F`+nan


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

Date: 01 May 2001 09:48:46 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: How to: Create Regex which extracts N number of words before target word
Message-Id: <m3wv81m8fl.fsf@dhcp9-172.support.tivoli.com>

On Tue, 01 May 2001, notmyrealemail@example.com wrote:

> I tried to extend this to also include 2 words after the word, but
> this mucks up the elegant code
> 
> ===
> 
> $_ = "word1 word2 word3 word4 cat word5 word6 word7";
> 
> s/(\w+\W+){2}cat(\w+\W+){2}/Z/xg;
> 
> print $_;

The "\w+\W+" bit matches, in this case, a word and the space(s) after
it.  But for after "cat" you want to reverse that and match the
space(s) before the word and then the word:

s/(\s+\W+){2}cat(\W+\w+){2}/Z/g; # no x needed since no spaces in regex

-- 
Ren Maddox
ren@tivoli.com


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

Date: 1 May 2001 15:13:01 GMT
From: rasunci@qual-pro.removethis.com
Subject: Re: loop variable scope
Message-Id: <9cmjpt$48q$1@news.netmar.com>

In article <3ae89be9.56194474@news.erols.com>, Jay Tilton <tiltonj@erols.com>
writes:
>On 26 Apr 2001 20:50:25 GMT, rasunci@qual-pro.no-spam.com wrote:
[snip, snip]

>This behavior is documented in perlsyn.

Just want to thank all who replied. I've been using the camel
book all along and I've yet to learn all the perlvar, perlfunc,
perlsyn, etc.


--
RA


 -----  Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web  -----
  http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
   NewsOne.Net prohibits users from posting spam.  If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net


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

Date: Tue, 1 May 2001 10:17:29 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Multiple errors running newspro.cgi
Message-Id: <slrn9ethbp.ius.tadmc@tadmc26.august.net>

RonB <r.borkent@123chello.nl> wrote:

>I get these errors 


None of those are errors. They are warnings.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 1 May 2001 19:29:00 +0200
From: eins@durchnull.de (Rudolf Polzer)
Subject: Re: one-line stderr, stdout redirection
Message-Id: <slrn9etsis.d8k.eins@www42.t-offline.de>

Villy Kruse <vek@pharmnl.ohout.pharmapartners.nl> wrote:
> On Tue, 1 May 2001 13:49:10 +0200, Rudolf Polzer <eins@durchnull.de> wrote:
> 
> >
> >Can you still use IO::Select when you have >30 open sockets? select() does
> >not work because the bit vector can only hold fileno()s in 0..31.
> >
> 
> 
> That would depend on the unix version, many of those can go considerably 
> higher than 31 in the select bitmap.

vector(), too?

-- 
#!/usr/bin/perl -- Random sig generator. Editor command in slrn => ~/siggs
$F=shift;open H,"+<$F";$_=join"",<H>;$s=index$_,"\n\n-- \n";$s<0||truncate
H,$s;close H;system"$ENV{EDITOR} $F</dev/tty>/dev/tty";$s=$n=0;for#sichtig
(<~/siggs/*>){++$n;int rand$n or$s=$_};`(echo "\n\n-- ")|cat - $s>>$F`+nan


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

Date: Tue, 1 May 2001 10:19:15 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: one-line stderr, stdout redirection
Message-Id: <slrn9ethf3.ius.tadmc@tadmc26.august.net>

Dennis Kowalski <dennis.kowalsk@daytonoh.ncr.com> wrote:

>OK, I conceed the top-posting error. I hit the wrong button.


You did it again.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 01 May 2001 09:31:36 -0700
From: Gordon Vrdoljak <vrdoljak@uclink.berkeley.edu>
Subject: perl program suggestions
Message-Id: <3AEEE4E8.708A5F39@uclink.berkeley.edu>

Hello,
I'm trying to write a ledger program in Perl for people getting material and
services from our lab.  I have a nice form where they can input their name,
material they use, and the amount.  I'd like each item they input, to be
displayed as a list at the bottom of the screen.  When they finish adding items,
they click on a checkout or submit button.

I'm trying to think of how to code this in.  Any suggestions?  Should I have the
items they add to their purchase list be stored as a temporary file and that
file is read in with each addition to the list, and then a link to another CGI
file is used for the final 'checkout'?  I've written simple programs in Perl,
but this is a bit more complex for me.  Any comments greatly appreciated.
Thanks.
--------------------------------
Here is the form/general idea:
LastName:______
FirstName:________
Material:________
Quantity:________

--->add item to list button
===========================
Current list
ie - items they added, say
glutaraldehyde 5 mL
OsO4		10mL
Film		5 sheets

---->Submit purchases
---->erase all purchases
---->remove last item
----------------------------------


-- 
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Gordon Ante Vrdoljak                                  Electron Microscope Lab
ICQ 23243541   http://nature.berkeley.edu/~gvrdolja   26 Giannini Hall
vrdoljak@uclink.berkeley.edu                          UC Berkeley
phone (510) 642-2085                                  Berkeley CA 94720-3330
fax   (510) 643-6207 cell (510) 290-6793


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

Date: Tue, 1 May 2001 21:14:28 +0200
From: eins@durchnull.de (Rudolf Polzer)
Subject: perlcc does not work - does anyone know how to fix it?
Message-Id: <slrn9eu2oj.kcr.eins@www42.t-offline.de>

After updating my Linux system, perlcc does not work anymore. Even
when compiling this simple script:

#!/usr/bin/perl
# nothing!

I get a linker error at the end:

--------------------------------------------------------------------------------
Compiling x.pl:
--------------------------------------------------------------------------------
Making C(x.pl.c) for x.pl!
perl -I/usr/lib/perl5/5.6.0/i586-linux -I/usr/lib/perl5/5.6.0
  -I/usr/lib/perl5/site_perl/5.6.0/i586-linux -I/usr/lib/perl5/site_perl/5.6.0
  -I/usr/lib/perl5/site_perl -I. -MB::Stash -c  x.pl
perl -I/usr/lib/perl5/5.6.0/i586-linux -I/usr/lib/perl5/5.6.0
  -I/usr/lib/perl5/site_perl/5.6.0/i586-linux -I/usr/lib/perl5/site_perl/5.6.0
  -I/usr/lib/perl5/site_perl -I. -MO=C,-umain,-uattributes,-uDB x.pl
Starting compile
Walking tree
NULL::save for sv = 0 called from B::C::save_main
Prescan
Saving methods
Bootstrap attributes x.pl
Writing output
Loaded B
Loaded IO
Loaded Fcntl
x.pl syntax OK
Compiling C(x) for x.pl!
perl -I/usr/lib/perl5/5.6.0/i586-linux -I/usr/lib/perl5/5.6.0
  -I/usr/lib/perl5/site_perl/5.6.0/i586-linux -I/usr/lib/perl5/site_perl/5.6.0
  -I/usr/lib/perl5/site_perl -I. /tmp/x.pl.tst
cc -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE
  -D_FILE_OFFSET_BITS=64  -I/usr/lib/perl5/5.6.0/i586-linux/CORE -o x x.pl.c
  -L/usr/local/lib -L/usr/lib/perl5/5.6.0/i586-linux/CORE -lperl -lnsl -ldl -lm
  -lc -lcrypt /usr/lib/perl5/5.6.0/i586-linux/auto/IO/IO.so
  /usr/lib/perl5/5.6.0/i586-linux/auto/Fcntl/Fcntl.so
x.pl.c: In function `perl_init':
x.pl.c:874: warning: assignment from incompatible pointer type
x.pl.c:875: warning: assignment from incompatible pointer type
/tmp/ccmqU0DK.o: In function `xs_init':
/tmp/ccmqU0DK.o(.text+0x338c): undefined reference to `boot_DynaLoader'
collect2: ld returned 1 exit status
ERROR: In compiling code for x.pl.c !


How can I fix it? What do I have to download and install to fix this? gcc
complains about a library that is missing, and doing a grepn showed that the
symbol lives in /usr/lib/perl5/5.6.0/i586-linux/auto/DynaLoader/DynaLoader.a.
This made me trying

use DynaLoader;

at the begin of the program, and perlcc worked. How can I make perlcc do
this automatically for me?

PS: This ugly hack does, but isn't there a better solution?

        # FIX by Rudolf Polzer
        use POSIX;
	open FH, "+<$file";
	my $c = join "", <FH>;
	seek FH, 0, 0;
	print FH "use DynaLoader;\n", $c;
	close FH;

        _doit($file);

	open FH, "+<$file";
	<FH>;
	my $c = join "", <FH>;
	seek FH, 0, 0;
	print FH $c;
	truncate FH, tell FH;
	close FH;


-- 
#!/usr/bin/perl -- Random sig generator. Editor command in slrn => ~/siggs
$F=shift;open H,"+<$F";$_=join"",<H>;$s=index$_,"\n\n-- \n";$s<0||truncate
H,$s;close H;system"$ENV{EDITOR} $F</dev/tty>/dev/tty";$s=$n=0;for#sichtig
(<~/siggs/*>){++$n;int rand$n or$s=$_};`(echo "\n\n-- ")|cat - $s>>$F`+nan


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

Date: Tue, 01 May 2001 11:12:08 -0400
From: Andras Malatinszky <andras@mortgagestats.com>
Subject: Re: Q: Using 'rename' with CGI
Message-Id: <3AEED248.A433D5F0@mortgagestats.com>



Shannon Brown wrote:

> Persistent but odd issue ....
>
> Perl 5.003
> Linux 2.2
> Apache 1.3
>
> I have a log file that records banner click-throughs on a private
> dog-related web site.  The log file is executed using CGI.  The logging
> capability has been functioning for close to two years and seems to work
> fine.
>
> A log report analysis tool is available on the server to create short
> reports on banner activity -- usually once per month.  The report seems to
> be creating problems because the log file is randomly deleted after running
> the report.
>
> Here is the structure of the system:
> -- banner logging CGI scipt is running
> -- report (separate script) runs and does
>     -- renames the production log file to a temporary file
>         (banner logging script regenerates a new log file if needed)
>     -- opens the temporary log file
>     -- locks temporary log file
>     -- reads temporary log file
>     -- unlocks temporary log file
>     -- renames the tempoary log file to the production file
>         (data is lost while the report runs and this is OK)
>

Why do you do this in the first place? Why don't you have your program simply
read the actual logfile?



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

Date: Tue, 1 May 2001 16:31:02 +0000 (UTC)
From: toaster <toaster@nomail.org>
Subject: Question about float to hex
Message-Id: <9cmoc6$1qlf$1@ccreader.nctu.edu.tw>


I have a question about casting floating point value
to hex value.In C we can declare a union like:
union{
float a;
unsign long b;
} tmp;

And print tmp.b by using:printf("%x",tmp.b); then
we get the a hex value of this floating value in 
IEEE 754 format. But in perl , I can't use the same
way to get a hex IEEE754 value. I have tried to use
the pack&unpack function, but it seems that the pack&
unpack function can only handle int value. 
And I have tried to use the ">>" operator, it failed,too.

Is there any way to do this job in perl? Thanks for your
answer.

 


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

Date: 01 May 2001 10:15:22 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: RegEx Question
Message-Id: <m3snipm779.fsf@dhcp9-172.support.tivoli.com>

Please put your comments below the text.  It's just easier to read
that way.

[Jeopardectomy]

On Tue, 01 May 2001, nospam@newsranger.com wrote:

> In article <slrn9es0ik.59s.abigail@tsathoggua.rlyeh.net>, Abigail
> says...
>>
>>my ($text) = $data =~ /SERVICE(.*)/s;
>>
>>
> Thank you...  But, how can I get all the data before the $$?

The same way, with the caveat that you need to escape the dollar
signs.

my ($text) = $data =~ /(.*)\$\$/s;

Or, use the substr/index method I already mentioned:

my $text = substr($data, 0, index($data, '$$'));

> --- WIDELY SCATTERED STRONG THUNDERSTORMS WILL CONTINUE ACROSS THE
> BISTATE REGION THROUGH 800 PM CDT.
> 
> $$
> RP 
> ---

-- 
Ren Maddox
ren@tivoli.com


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 813
**************************************


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