[8667] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2284 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 9 17:07:17 1998

Date: Thu, 9 Apr 98 14:00:27 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 9 Apr 1998     Volume: 8 Number: 2284

Today's topics:
    Re: @INC and avoiding -I <bldadmin@esd.sgi.com>
    Re: arrays in Format <ludlow@us.ibm.com>
    Re: Bill Gates should be invited to O'Reilly's "Free So <quentin.fennessy@amd.com>
    Re: Bill Gates should be invited to O'Reilly's "Free So ben@hayamasa.demon.co.uk
    Re: Can I execute Perl scripts with Front Page 98 ? <colin@ip63.net24722.cr.sk.ca>
        Detect broken links? <ben@wallroyds.demon.co.uk>
    Re: Explicit Variable Declarations <ludlow@us.ibm.com>
    Re: Generating Password from Username in Perl ? <ludlow@us.ibm.com>
    Re: getgrent and reading /etc/group (Andy Squires)
    Re: getgrent and reading /etc/group <rootbeer@teleport.com>
    Re: greediness problem matching date expressions? help <nagare@emrtc.nmt.edu>
    Re: greediness problem matching date expressions? help <dcameron@nospam.bcs.org.uk>
    Re: looking for a web login script <dschwab@wolfe.net>
    Re: Looking for Polling/Voting CGI/java Script <rootbeer@teleport.com>
    Re: Looking for Polling/Voting CGI/java Script <ptimmins@netserv.unmc.edu>
    Re: Looking for Polling/Voting CGI/java Script (Abigail)
    Re: LWP that works with SLL <aas@sn.no>
    Re: Need a web login script (brian d foy)
    Re: Optimization regexp/list for string search <jdf@pobox.com>
        Perl state machine strategies (Phil Ptkwt Kristin)
        problem with output <sharwood@cs.uiowa.edu>
    Re: Problems with "use integer" in combination of CGI.p (Bert Tijhuis)
    Re: s///e  eval difficulty (Mark-Jason Dominus)
    Re: s/PATTERN/<how to concat here>/g (Mark-Jason Dominus)
        substituting text in a var (beginner question) jf@medianook.com
        system command <sharwood@cs.uiowa.edu>
        URL-Encoding: is + unsafe? <gumblem@pecc.co.uk>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 09 Apr 1998 11:36:30 -0700
From: Build Administrator <bldadmin@esd.sgi.com>
To: Build Administrator <bldadmin@esd.sgi.com>
Subject: Re: @INC and avoiding -I
Message-Id: <352D152E.526EDEBC@esd.sgi.com>

Thanks much for those responded.  I went from zero to 3 ways
to skin that cat with all the assistance.

The root of the problem I was experiencing was that there was
a previous installation of perl on my system that had bogus drive
specifier entries in the registry.  I went and changed all the drive
entries and the default @INC array is working as expected.

JR


Build Administrator wrote:

> On an NT4 system, how/where does @INC get initialized?
>
> I'm unable to use modules and INC is pointing to the wrong directories.
> If I attempt to append to it at run time (prior to a use directive),
> the use directive is flagged and the script won't run.
>
> The command line -I works, but this is a pain.
>
> Thanks.
>
> JR





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

Date: Thu, 09 Apr 1998 14:18:01 -0500
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: arrays in Format
Message-Id: <352D1EE9.966601E2@us.ibm.com>

Kevin B Cohen wrote:
> 
> hi,
> 
> i am much enamored of perl's Format facility (data type??), which lets
> you easily be very specific about what printed output will look like.
> it's possible to get a format to print out a variable, or to print out
> the return value of a subroutine.  my question: is it possible to get
> a format to print out an array?

Sure.  You just have to create the format at runtime, since you don't
know what size the array might be.  For example:

#!/usr/bin/perl -w

@array = (1,2,3,4,5);

$format .= "format FOO =\n";
for (@array) {
    $format .= "@>> ";  # Or whatever you want to use as a picture
}
$format .= "\n\@array\n";
$format .= ".\n";

eval $format;
$~ = "FOO";
write;


-- 
James Ludlow (ludlow@us.ibm.com)
This isn't tech support, and all opinions are my own.


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

Date: 09 Apr 1998 13:17:12 -0500
From: Quentin  Fennessy <quentin.fennessy@amd.com>
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <ximhg423lnb.fsf@shaddam.tx.amd>

>>>>> "Ben" == ben  <ben@hayamasa.demon.co.uk> writes:

    Ben> In article <6ggq65$b0m$1@halcyon.com>, tzs@halcyon.com (Tim
    Ben> Smith) wrote:

    Ben> What I meant to say was that they've killed off free
    Ben> development of various projects.  I don't know of an example
    Ben> of a free project being removed by its authors but I know of
    Ben> a lot where development of free documentation was killed
    Ben> after O'Reilly published a proprietory version.

Ben, can you explain this further?  What documentation project
died due to the existence of O'Reilly products?  

This claim does not make sense to me.  If free software development
can flourish in competition with commercial software, why can't free
documentation also flourish.  

Perhaps my favorite example is:

a2p.1		  perldelta.1	    perlfunc.1	      perlsyn.1
c2ph.1		  perldiag.1	    perlguts.1	      perltie.1
h2ph.1		  perldoc.1	    perlipc.1	      perltoc.1
h2xs.1		  perldsc.1	    perllocale.1      perltoot.1
lwp-download.1	  perlembed.1	    perllol.1	      perltrap.1
lwp-mirror.1	  perlfaq.1	    perlmod.1	      perlvar.1
lwp-request.1	  perlfaq1.1	    perlmodlib.1      perlxs.1
lwp-rget.1	  perlfaq2.1	    perlobj.1	      perlxstut.1
perl.1		  perlfaq3.1	    perlop.1	      pl2pm.1
perlapio.1	  perlfaq4.1	    perlpod.1	      pod2html.1
perlbook.1	  perlfaq5.1	    perlre.1	      pod2man.1
perlbot.1	  perlfaq6.1	    perlref.1	      pstruct.1
perlbug.1	  perlfaq7.1	    perlrun.1	      s2p.1
perlcall.1	  perlfaq8.1	    perlsec.1	      splain.1
perldata.1	  perlfaq9.1	    perlstyle.1	      tkweb.1
perldebug.1	  perlform.1	    perlsub.1	      xsubpp.1

About 60,000 lines of docs.  Free.  Despite the existence of
O'Reilly Perl books.  Linux has some free docs too, I understand.  :-)

Hmmm.
-- 
Quentin Fennessy			AMD, Austin Texas
Secret hacker rule #11 - hackers read manuals


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

Date: Thu, 09 Apr 1998 15:31:12 -0600
From: ben@hayamasa.demon.co.uk
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <6gjb6g$l8$1@nnrp1.dejanews.com>

In article <35317296.3189824@news.tornado.be>,
  bart.mediamind@tornado.be (Bart Lateur) wrote:

> There is not ONE MS product that is not based on products that was
> available before MS developed their own. You name it: OS (CP/M clone),
> Windows (Mac and Xerox), spreadsheet, word processor, browser, server
> software. First they imitate it, add some proprietary features, and then
> compete the original manufacturer to death. Just look at what they're
> trying to do to Netscape now.

What I was refering to was taking something such as source code
which is freely redistributable and turning it into
something proprietory, which is quite a large part
of O'Reilly's business.


> If anything, MS is the WORST possible host for such a conference, as
> they are trying to turn EVERY succesful software into something
> proprietary.

Yes, I agree - I suggested this because
I was using sarcasm in order to point out the hypocrisy of
O'Reilly having a free software conference.


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Thu, 9 Apr 1998 11:26:02 -0600
From: Colin Reid <colin@ip63.net24722.cr.sk.ca>
To: Hi <nospam@noanswer.com>
Subject: Re: Can I execute Perl scripts with Front Page 98 ?
Message-Id: <Pine.LNX.3.96.980409111927.421B-100000@ip63.net24722.cr.sk.ca>


> Is it possible to execute perl scripts with FrontPage 98 (under NT 4.0)
> before uploading to Unix system ?

What you need to do is install Perl for Win32 and then you can test your
scripts on your NT box.  The latest version of Perl for Win32 is available
at:
http://www.perl.com/latest.html

Hope this helps.

-Colin Reid



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

Date: Thu, 9 Apr 1998 20:15:52 +0100
From: "bjf" <ben@wallroyds.demon.co.uk>
Subject: Detect broken links?
Message-Id: <892149361.18864.0.nnrp-04.c2de5b4a@news.demon.co.uk>

Hello to all again!

Sorry if I didn't response to any of your responses to my questions before
as my news server was down!

I wonder, how can I detect broken links using Perl? Like many search
engines, ... How do you do it?

It's like ... Go to an URL, and see if it's out there or not.

Please do tell me where to find the info on the web if any of you aren't
happy about me asking this question.

Sorry about my bad English, do contact me if you can't understand me - I'll
try to explain.

Thanks for reading this.

BJF.




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

Date: Thu, 09 Apr 1998 14:24:29 -0500
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: Explicit Variable Declarations
Message-Id: <352D206D.BCA8383@us.ibm.com>

Faisal Karmali wrote:
> 
> Is there any way to make Perl require variables to be declared? For
> example, I recently had a problem because I misspelled a variable name.
> Rather than complaining, it creates a new variable with the misspelled
> name.

Some would even go so far as to say that...

#!/usr/bin/perl -w
use strict;

should be a default.  Personally, I always use the -w switch.  It's such
a great way to catch exactly that problem you described.  One of the
things that -w does is it warns you of every variable name that is only
used once. 

-- 
James Ludlow (ludlow@us.ibm.com)
This isn't tech support, and all opinions are my own.


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

Date: Thu, 09 Apr 1998 13:36:26 -0500
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: Generating Password from Username in Perl ?
Message-Id: <352D152A.3E83105E@us.ibm.com>

Heggie wrote:
> 
> I am trying to generate a password depending on the input on the
> username. The username consists of 6-7 numbers(integers).
> Let's say the Username is: ABCDEFG
> How can I make an algoritm so that the password generated is
> Password = 17 +83*BC ?
> As I am still new at Perl, and any help is greatly appreciated *wink*!

This isn't really a Perl question, it's more of an encryption question. 
What you're looking for is called a one-way function.  Given A you can
easily figure out B, but given B you have no idea what A is.  The
problem here is that your system will be completely insecure.  If you
calculate the password from the username, then essentially the username
_is_ the password.  The password will just be an encrypted version of
it.  So anyone who knows a username could calculate the password
themselves.  That's why usernames and passwords aren't related.  Like in
Unix, the password is secret, even on the disk.  When you originally
enter the password, it's run through a one-way function and stored on
the disk.  Then when you go to log on, you enter a password, it goes
through the same one-way function, and the result is compared to the
result that is stored on the disk.  If the results from the function are
the same, then the passwords are the same, hence you get in.  The trick
is to build a function where two passwords won't produce the same
result.  

Basically what I'm saying is that you don't want to use a username to
generate a password.  You accomplish absolutely nothing.  Now, on the
other hand, you could use the combination of a username and some random
numbers to generate the password, but then why not just use only the
random number as either the password or the input to the one-way
function.

There's plenty of books out there on the theory of Cryptography, and
what we're talking about here is really basic stuff.  Perhaps you could
just prompt the user for a password (although I realize that this is one
the least secure methods since user tend to pick really stupid
passwords, like "password".)

-- 
James Ludlow (ludlow@us.ibm.com)
This isn't tech support, and all opinions are my own.


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

Date: Thu, 9 Apr 1998 17:49:47 GMT
From: asquires@netcom.com (Andy Squires)
Subject: Re: getgrent and reading /etc/group
Message-Id: <asquiresEr5quz.78B@netcom.com>

Tom Phoenix <rootbeer@teleport.com> writes:

>On Thu, 9 Apr 1998, Andy Squires wrote:

>> Is there a way to get getgrent to recognize the fact that I have a group
>> which is carried over to two lines in the group file because there are to
>> many users listed for it to fit on one line. 

>If getgrent doesn't work right, something isn't installed (or configured) 
>properly. It's not likely to be perl's fault, though; check with your
>vendor's docs. (Is your /etc/groups file in the right format?) Good luck!

Well, it looks like its in the correct format.  Except for, as  I said, I
have a group, called ctest, which occurrs on two separate lines because all
of the users wouldn't fit on one line.  Of course, I thought that was strange
in itself.  Is that a Unix limitation, or maybe of AIX--which I'm running
on.  When my Perl script uses getgrent to read through /etc/group it will
print out the first occurrence of 'ctest' and all the users, but ignores
the second one.  

Thanks for your help.

Andy


>-- 
>Tom Phoenix       Perl Training and Hacking       Esperanto
>Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/

-- 
| Andy Squires                  "The trouble with life is
| asquires@netcom.com         there's no background music."
| Web Page is at http://www.announce.com/~asquires/andy.html



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

Date: Thu, 9 Apr 1998 12:36:38 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Andy Squires <asquires@netcom.com>
Subject: Re: getgrent and reading /etc/group
Message-Id: <Pine.GSO.3.96.980409122930.9100U-100000@user2.teleport.com>

On Thu, 9 Apr 1998, Andy Squires wrote, quoting me:

> > Is your /etc/groups file in the right format?
> 
> Well, it looks like its in the correct format.  Except for, as  I said, I
> have a group, called ctest, which occurrs on two separate lines because all
> of the users wouldn't fit on one line.  

Well, that file wouldn't be valid on some systems - but without looking at
the group(4) manpage (or equivalent) for your system, I don't know if that
file is valid there. (BTW, you do know that there's no intrinsic limit to
the length of a line in Unix text files?) 

If that file is in the right format, and if the system calls themselves
are working properly, then this would be a bug in Perl. But, first, let's
check the manpage to ensure that the file is proper. Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 09 Apr 1998 12:21:14 -0600
From: Josh England <nagare@emrtc.nmt.edu>
To: Greg Bacon <gbacon@cs.uah.edu>
Subject: Re: greediness problem matching date expressions? help
Message-Id: <352D119A.D78B938D@emrtc.nmt.edu>



Greg Bacon wrote:

>
>
> Is there a particular reason you're using a regular expression?
> The Date::Parse module (part of Graham Barr's TimeDate distribution)
> will take a date and return it in Unix time (seconds since the epoch)
> which you can hand to localtime and test the appropriate elements of
> the resulting list to see whether it's in your desired range.
>

I dont know if this would work.  What I am trying to do is parse out logs
from a logfile by date.  The dates in the logfile are of the form:  Tue Apr
3 07:27:55 2018
The input search form takes a date input of the form 5/12/98-3/20/12 and
builds a regular expression to match the corresponding dates.  Can the
Date::Parse module take input in the above form?  This would make life very
easy.
    -Josh England



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

Date: 9 Apr 1998 19:04:37 GMT
From: "Duncan Cameron" <dcameron@nospam.bcs.org.uk>
Subject: Re: greediness problem matching date expressions? help
Message-Id: <01bd63ea$53baf3a0$493463c3@dns.btinternet.com>

Josh

May I suggest a slightly different approach?
Can you split each line on white space so that you isolate the day month
date time and year into separate variables.  Then you can validate whether
any of those variables has a value which you want.

HTH

Duncan Cameron
-- 
Remove 'nospam.' to get my return address.

Josh England <nagare@emrtc.nmt.edu> wrote in article
<352D119A.D78B938D@emrtc.nmt.edu>...
> 
> 
> Greg Bacon wrote:
> 
> >
> >
> > Is there a particular reason you're using a regular expression?
> > The Date::Parse module (part of Graham Barr's TimeDate distribution)
> > will take a date and return it in Unix time (seconds since the epoch)
> > which you can hand to localtime and test the appropriate elements of
> > the resulting list to see whether it's in your desired range.
> >
> 
> I dont know if this would work.  What I am trying to do is parse out logs
> from a logfile by date.  The dates in the logfile are of the form:  Tue
Apr
> 3 07:27:55 2018
> The input search form takes a date input of the form 5/12/98-3/20/12 and
> builds a regular expression to match the corresponding dates.  Can the
> Date::Parse module take input in the above form?  This would make life
very
> easy.
>     -Josh England
> 
> 


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

Date: Thu, 09 Apr 1998 13:36:55 +0100
From: David Schwab <dschwab@wolfe.net>
Subject: Re: looking for a web login script
Message-Id: <352CC0E7.56934791@wolfe.net>



David Schwab wrote:

> Yes I need a weblogin script that allows people to pass a login and
> password thru a prompt and then have another way for an admin to add
> users and remove something like .Htaccess please help if you can.
> Thanks





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

Date: Thu, 9 Apr 1998 11:16:13 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: ateika@bellsouth.net
Subject: Re: Looking for Polling/Voting CGI/java Script
Message-Id: <Pine.GSO.3.96.980409101044.9100S-100000@user2.teleport.com>

On Thu, 9 Apr 1998 ateika@bellsouth.net wrote:

> Newsgroups: comp.lang.perl.misc
> Subject: Looking for Polling/Voting CGI/java Script

[ This is not a flame; I'm trying to be helpful. But since you can't see
my smiling face over Usenet, I'll ask you to take my word for it! :-) ]

First, this is not a CGI or JavaScript newsgroup, it's a Perl newsgroup.
If you have non-Perl questions, you shouldn't ask them in a Perl
newsgroup.

Second, If you're looking for software in general, there are good ways to
do that which don't involve Usenet. See news.announce.newusers or your
local expert.

> I am looking for a script that will enable polling but disallow users
> from voting more than once from the same PC. A cgi Script/Java/Java
> Script Will do. 

There is no generally good way to allow voting on the Internet which
allows everyone exactly one vote. With most systems, I might use one of
the various anonymizers to vote more than once. If you disallow one
machine from registering more than one vote, services like AOL which use
proxies will mostly be blocked from voting. And, since I have five wives,
seventeen concubines, and forty-eight children using my computer, can't we
each get a vote? :-)

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 09 Apr 1998 14:04:36 -0500
From: Patrick Timmins <ptimmins@netserv.unmc.edu>
Subject: Re: Looking for Polling/Voting CGI/java Script
Message-Id: <352D1BC4.262C@netserv.unmc.edu>

Just "fix" your elections and don't worry about it. You could also try
to find another news group or do a search with infoseek, yahoo!, etc.

Hope that helps.

Patrick Timmins
U. Nebraska Medical Center

ateika@bellsouth.net wrote:
> 
> Looking for Polling/Voting CGI/java Script
> 
> I am looking for a script that will enable polling but disallow users from
> voting more than once from the same PC. A cgi Script/Java/Java Script Will do.
> Any assistance will be very much appreciated.
> 
> Ateika
> <<ateika@bellsouth.net>>
>


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

Date: 9 Apr 1998 20:34:06 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Looking for Polling/Voting CGI/java Script
Message-Id: <6gjbbu$od7$1@client3.news.psi.net>

ateika@bellsouth.net (ateika@bellsouth.net) wrote on MDCLXXXII September
MCMXCIII in <URL: news:6gitg3$fah$1@nnrp1.dejanews.com>:
++ Looking for Polling/Voting CGI/java Script
++ 
++ I am looking for a script that will enable polling but disallow users from
++ voting more than once from the same PC. A cgi Script/Java/Java Script Will do.
++ Any assistance will be very much appreciated.


1) That is not a Perl question.
2) Gimme gimme gimme questions are not done.
3) There's no way to make a one user/one vote connection on the net.



Abigail
-- 
perl -wle\$_=\<\<EOT\;y/\\n/\ /\;print\; -eJust -eanother -ePerl -eHacker -eEOT


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

Date: 09 Apr 1998 09:15:19 +0200
From: Gisle Aas <aas@sn.no>
Subject: Re: LWP that works with SLL
Message-Id: <m3sonnqxdk.fsf@furu.g.aas.no>

stvhoof@netvision.net.il writes:

> Is there something like LWP that will work with an SLL server (https instead
> of http)?

LWP works with https-servers.  Did you read the README files that
comes with LWP?

-- 
Gisle Aas


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

Date: Thu, 09 Apr 1998 14:41:21 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Need a web login script
Message-Id: <comdog-ya02408000R0904981441210001@news.panix.com>
Keywords: from just another new york perl hacker

In article <352C9571.FD3BAB78@wolfe.net>, David Schwab <dschwab@wolfe.net> posted:

>Yes I need a weblogin script that allows people to pass a login and
>password thru a prompt and then have another way for an admin to add
>users and remove something like .Htaccess please help if you can.

see the CGI Meta FAQ for a pointer to Nick Kew's excellent tutorial
on web logins.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: 09 Apr 1998 16:35:36 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Optimization regexp/list for string search
Message-Id: <hg42he53.fsf@mailhost.panix.com>

herve_debar@hotmail.com writes:

> I have the following problem. I receive strings, and i keep them only if i
> haven't seen them previously. Right now, i'm storing the strings in an array
> and look iteratively for an exact match on all strings in the array.

Sounds tailor-made for a hash.

   %strings = ();
   $strings{$string}++ while defined ($string = get_next_string());
   my @array_of_unique_strings = keys %strings;

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: 9 Apr 1998 13:09:00 -0700
From: ptkwt@user1.teleport.com (Phil Ptkwt Kristin)
Subject: Perl state machine strategies
Message-Id: <6gj9ss$m1d$1@user1.teleport.com>

I'm kind of playing around with a FSM based parser in Perl.  
In C you can define the states of the machine in an enum, like:
enum states {start, skip, found_x, found_y };

and then declare a variable of type states:

states state = start;

then as the parser enters different states based on the input you change
the value of state, for example:

if(state == start) {
   if(input = 'x'){
	state = found_x;
	//do something...
   }
   elsif(input == 'y'){
        state = found_y;
        //do something...
   }
}.....

Has anyone out there done state machines in perl, and if so what kind of
strategies have been developed?

Obviously there is no enum in perl, but you could just define a set of
strings that define the states of the machine and then assign the state
varible from the set of values.

Nothing real urgent here, just doing some brainstorming.

Phil


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

Date: Thu, 09 Apr 1998 15:25:56 -0500
From: shane michael harwood <sharwood@cs.uiowa.edu>
Subject: problem with output
Message-Id: <352D2ED4.167E@cs.uiowa.edu>

hello,
i have written a script that takes input from a form, and prints it to a
file..the problem i am having is that one of the fields is a text box
and can spread for many lines....when the script prints it to the file
it prints it as one long line...is there anyway to format this so it
goes over multiple lines.


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

Date: Thu, 09 Apr 98 19:00:52 GMT
From: B.Tijhuis@inter.nl.net (Bert Tijhuis)
Subject: Re: Problems with "use integer" in combination of CGI.pm
Message-Id: <6gj9cg$rhd$1@news.NL.net>

In article <Pine.GSO.3.96.980408162829.20192b-100000@user2.teleport.com>, Tom Phoenix <rootbeer@teleport.com> wrote:
>On Wed, 8 Apr 1998, Bert Tijhuis wrote:
>
>> When inserting after the line
>> 
>> use CGI;                # the line
>> use integer;
>> 
>> some strange things happens to my CGI script.
>
>Well, some strange things are supposed to happen. :-)  But if you think
>you've found a bug, boil it down to a short test case and post it here.
>Thanks!
>
Here is the code:
=============
#!/usr/local/bin/perl

use CGI;
#use integer;

$query = new CGI;

print $query->header;

print $query->start_html();

$number=$query->param('number');

$result = (length($number) > 0) ? &subfun($number) : "";

&show_it();

print $query->end_html;

sub show_it
{

        print $query->startform(
                        -method=>'GET',
                        -encoding=>'multipart/formdata');
        
        print "xid ";
        print $query->textfield(
                        -name=>'number');
        print "<P>";
        print "$result = $number / 3";
        print "<P>";
        
        print $query->submit;
        print $query->reset;
        print $query->endform;
}

sub subfun 
{
        use integer;
        shift() / 3;    
}

===========
End of code

When remove the # from the #use integer line! The cgi is behaving very strange 
and doesn't work anymore.
By the way I've tested with perl5.004 on AIX4.1.4 with Netscape version 4.0?

Good luck



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

Date: 9 Apr 1998 15:18:14 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: s///e  eval difficulty
Message-Id: <6gj6tm$820$1@monet.op.net>

In article <01bd63c7$caf4e250$326d5cc0@kevan>,
Kevan Granat <kevan@nol.net> wrote:
>I'd like to have the string:
>
>X = ${Xdisp, %6.2f}, Y = ${Ydisp, %6.2f}
>
>evaluate to:
>
>X = 104.22, Y = 511.33
>
>assuming that $Xdisp and $Ydisp were set to their values earlier.
>
>I've got a kludged method working, but it's SLOW.  

Amazingly, the Interpolation.pm module available at

	http://www.plover.com/~mjd/perl/Interpolation/

does almost precisely what you want already, and it is not slow.

You say something like

	use Interpolation S => 'sprintf1';

And thenceforward, in any double-quoted string, regex, here-document,
or similar construction, you can say

	"X = $S{'%6.2f', $Xdisp}, Y = $S{'%6.2f', $Ydisp}"

and you'll get the string you wanted:

	X = 104.22, Y = 511.33

If you don't exactly like the syntax, it's somewhat flexible.  For
example, if you use 

	use Interpolation '-' => 'sprintf';

instead, then you say

	"X = $-{'%6.2f'}{$Xdisp}, Y = $-{'%6.2f'}{$Ydisp}"

You could easily write a custom formatter that would let you leave out
the $ on $Xdisp and $Ydisp, and would let you write the arguments in
opposite order, if you felt that that was important:

	use Interpolation S => \&my_formatter;

	"X = $S{Xdisp, '%6.2f'}, Y = $S{Ydisp, '%6.2f'}"

You probably can't get away with leaving out the '' on the %-formats,
because if you did Perl would probably mistake the % signs for modulus
operators.




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

Date: 9 Apr 1998 15:55:12 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: s/PATTERN/<how to concat here>/g
Message-Id: <6gj930$89f$1@monet.op.net>

In article <6ghru1$frl$1@solaris.cc.vt.edu>,
Michael Barnes  <mibarnes@mail.vth.vt.edu> wrote:
>Use this instead:
>
>s/(STT,\d\d*\-\w\w*\-)(\d\d)/${1}19${2}/g;

That'll work great for....hmmm... about another 600 days or so.
After that, bang.  01-Jan-1900.

Come on, folks.  When programmers in 1970 write COBOL programs that
will break in the year 2000, it's not too hard to excuse their
shortsightedness.  

It's the middle of 1998.   Who can excuse a failure to see ahead now?
Is there a competition to see how short we can make our
shortsightedness?   Will we still be doing this in Novermber 1999?



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

Date: Thu, 09 Apr 1998 14:11:32 -0600
From: jf@medianook.com
Subject: substituting text in a var (beginner question)
Message-Id: <6gj6h3$qk1$1@nnrp1.dejanews.com>

Hi,

I'm new to Perl and have one quick problem with a program. In the program, I
am establishing the following variables:

###
$referer=$ENV{"HTTP_REFERER"};
$hiddenreferrer="<INPUT TYPE=\"hidden\" NAME=\"myreferrer\" VALUE=\
"$myreferer\">";
###

Then, in my template file, I place:

   $hiddenreferrer

When I view the HTML source it writes:

   <INPUT TYPE="hidden" NAME=myreferrer" VALUE="$myreferrer">

What it should read is:

   <INPUT TYPE="hidden" NAME=myreferrer" VALUE="http://domain.com/file.html">

It looks like Perl is resolving it almost correctly. Am I not escaping it
correctly to write the full referrer?

Thank you.

Jay
jf@medianook.com




---
Look, if it weren't for the massive firewall here, I wouldn't have to use this
service. Please, ignore the following unnecessary advertising...

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Thu, 09 Apr 1998 15:11:13 -0500
From: shane michael harwood <sharwood@cs.uiowa.edu>
Subject: system command
Message-Id: <352D2B61.41C6@cs.uiowa.edu>

hello,
i have a perl script to read a form and then print it to a file.. my
problem is that one of the fields in the form is a text box and can span
for many lines.  is there anyway to get the script to format this field
so that when it prints to the file that it spans many lines and not just
long line???  
There is the the fold system command which does basically what i want to
happen..so is there anyway to call fold?


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

Date: Thu, 09 Apr 1998 17:23:06 +0100
From: "Matt J. Gumbley" <gumblem@pecc.co.uk>
Subject: URL-Encoding: is + unsafe?
Message-Id: <352CF5EA.F16F83ED@pecc.co.uk>

Is '+' an unsafe character - should it be escaped?
URI::uri_escape
doesn't escape it, and section 2.2 of RFC 1738 states that:

        "Thus, only alphanumerics, the special characters "$-_.+!*'(),",
and
reserved characters used for their reserved purposes may be used
unencoded within a URL."

        If I send a name-value pair such as name=Eric+Bob to a CGI
script from
a form, Apache's cgi-bin/printenv will show a QUERY_STRING containing an
escaped + (Eric%2BBob). However, using uri_escape to escape all unsafe
data will
result in the string being sent as Eric+Bob, which will be interpreted
(by ReadParse) as "Eric Bob" - which is not what I want.

        It seems that uri_escape and ReadParse are not symmetrical in
their
escaping.. or am I missing something?


-- 
Matt J. Gumbley, Software Engineer: gumblem [at] pecc [dot] co [dot] uk
CGG-PECC Ltd.
Medway House, Lower Road, Forest Row, East Sussex. RH18 5HE England.
Tel  +44 (0) 1342 824066  Fax  +44 (0) 1342 822662


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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


------------------------------
End of Perl-Users Digest V8 Issue 2284
**************************************

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