[9173] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2791 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 2 18:08:00 1998

Date: Tue, 2 Jun 98 15:00:31 -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           Tue, 2 Jun 1998     Volume: 8 Number: 2791

Today's topics:
    Re: "! Appending" to a file using Perl <zenin@bawdycaste.org>
        "1" Question <jt2@cs.buffalo.edu>
        A problem with [\d]+ <e78199@ceng.metu.edu.tr>
    Re: A problem with [\d]+ (Larry Rosler)
        dead program processes?? <opx1@rocketmail.com>
    Re: Dividing and type casting to an int ! (Mike Stok)
    Re: Free Documentation (was: Re: GNU attacks on the ope <celtschk@physik.tu-muenchen.de>
        Handling ClearCaser revision numbers <mgregory@asc.sps.mot.com>
        How can I get the userID to open certain pages <aladin@berlin.snafu.de>
    Re: How do I pass multiple parameters to a cgi script f <rootbeer@teleport.com>
        How do you kill a Windows NT process using Perl? ffinstad@globalsight.com
    Re: looking for DROP DOWN CATEGORY MENU <perlguy@inlink.com>
    Re: map in void context regarded as evil - suggestion (Jonathan Stowe)
    Re: map in void context regarded as evil - suggestion (James B. Crigler)
    Re: map in void context regarded as evil - suggestion <dfan@harmonixmusic.com>
        Newbe needs help with scripts... (.)
    Re: Newbe needs help with scripts... (Larry Rosler)
    Re: Newbe needs help... <_larryf@micron.net_>
    Re: perl for windows 3.1? (Jonathan Stowe)
    Re: perl modules <zenin@bawdycaste.org>
    Re: please help!! <perlguy@inlink.com>
    Re: Please Help: How do you make a vote/polling script? <matt@att.net>
    Re: Something like "Visual Perl"? <PROCURA_BV@CompuServe.com>
    Re: STDIN on IIS <rootbeer@teleport.com>
        Submitting html form to Perl script. <p_wilver@gsvms2.cc.gasou.edu>
    Re: Suggestions? <perlguy@inlink.com>
    Re: Suggestions? <perlguy@inlink.com>
        Taking data out of strings <rayr@accessus.net>
    Re: Taking data out of strings (Robert Watkins)
    Re: The RPC server is unavailable Tom_Howland@notes.pw.com
    Re: User System Info. (Larry Rosler)
    Re: very quick s/// question (Alex Barilo)
    Re: very quick s/// question ptimmins@netserv.unmc.edu
    Re: very quick s/// question (Matt Knecht)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 2 Jun 1998 21:03:54 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: "! Appending" to a file using Perl
Message-Id: <896821942.42714@thrush.omix.com>

Satish Gopalkrishnan <webmaster@yogi.net> wrote:
: This is to improve the readability of the log files which are used by a
: CGI application I created (http://www.yogi.net/WordGame).

	I'd *really* advise appending your entries, not prepending them.
	If you wish to view recent entries, just use tail(1).  If you want
	a continuous display, use "tail -f log_file".  If you want to see
	it from perl, use seek to get close to the end and read, or see the
	FAQ about implementing tail -f in perl.

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: Tue, 2 Jun 1998 15:50:46 -0400
From: John Timotheou <jt2@cs.buffalo.edu>
Subject: "1" Question
Message-Id: <Pine.GSO.3.96.980602151804.4655A-100000@armstrong.cs.Buffalo.EDU>


	I'm not too sure how to ask this but here goes anyway:

I've written this bit of code which opens a file and reads from it. It
reads into an array a certain number of elements. 

EXAMPLE:  
file contains:
Char          Name
Int           Idnum

  (the array now contains two elements)



Now, the purpose of this is to compare it to standard input provided by
the user so as to make sure the user enters the same number of arguments.

EXAMPLE (building off above example)
User enters:

John 2345       -Would be vaild seeing as though there are two elements in
		 the array and the user entered 2 values.

John		-Would be too few
	-AND-
John 2345 Perl	-Would be too many



NOW THE QUESTION (finally):
	I've got it all working just fine exept for the fact that if the
	user enters a "1" in the input; it is interperted as one too many
	arguments and it bails. 


THE CODE:

	$count=0;
	$countB=0;

        if (-e $totalTB)
        {
            open (TOTAL, "<$totalTB");
            while (read TOTAL, $stuff, 20000)
            {
                @lines = split(/\n/,$stuff);

                @NUMdataTP = split("          ",$a);
                for ($i=0; $i<=$#NUMdataTP; $i++)
                {
                    $count++;
                }

            }
            close (TOTAL);
        }




        @ATTRIBnum = split("          ",$string);
        for ($i=0; $i<=$#ATTRIBnum; $i++)
        {
            $countB++;
        }

        if ($countB > $count)
        {
            print "\nERROR: Too many arguments.";
            print "\n       You MUST enter ONLY $count arguments.\n";
            print "       Record was NOT added\n";
            last;
        }
        elsif ($countB < $count)
            print "\nERROR: Not enough arguments.";
            print "\n       You MUST enter $count arguments.\n";
            print "       Record was NOT added\n";
            last;
        }



	Well that's basically it. Any info would be MUCH appreciated.

	                                                   ,,,
John        	                                          (O O)
                	                 +---------oOO-----(_)-----------+
                        	         |         John Timotheou        |
					 |  Computer Science Consultant  |
					 |          Web Developer        |
					 | Web Site:			 |
					 |    www.cs.buffalo.edu/~jt2    |
                               	  	 +----------------------oOO------+
                                        	         |__|__|
                                               	  	  || ||
                                                	 ooO Ooo



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

Date: Tue, 02 Jun 1998 23:29:36 +0300
From: Walid ALSAQAF <e78199@ceng.metu.edu.tr>
Subject: A problem with [\d]+
Message-Id: <357460B0.9EB888A9@ceng.metu.edu.tr>

Greetings,

I have a Perl script that has the following line of code:

@LINES=grep(/^([\d]+) / &&
address[$1-1]=~/^$FORM{'site'}[\d]+/i,@LINES); 

But surprisingly, the expression does not work properly until I modified
it to:

@LINES=grep(/^([\d]+) / && $address[$1-1]=~/^$FORM{'site'}\d+/i,@LINES);
}

Is there a difference between [\d] and \d. I have many occurrences of
[\d] in my code, and I am worried that they might have to change all of
them to \d .

	Thanks for your help; I would appreciate it if you can can email me
your reply (besides posting it to the newsgroup).

	Regards.
-- 
/*********************************************/
Walid ALSAQAF

METU 
Computer Engineering Department
mailto:e78199@ceng.metu.edu.tr
http://www.ceng.metu.edu.tr/~e78199/Walid
ICQ # : (9762042)
/*********************************************/


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

Date: Tue, 2 Jun 1998 14:22:00 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: A problem with [\d]+
Message-Id: <MPG.fde0cd079db9acc98968e@hplntx.hpl.hp.com>

In article <357460B0.9EB888A9@ceng.metu.edu.tr>, e78199@ceng.metu.edu.tr 
says...
 ... 
> @LINES=grep(/^([\d]+) / &&
> address[$1-1]=~/^$FORM{'site'}[\d]+/i,@LINES); 

Ho, ho.  The Perl compiler is interpreting this as the array element 
offset by d (!) in the array which is referred to by $FORM{'site'}.  A 
clear failure of the DWIMmer.

But the -w flag would have warned you about this.  You *are* using that, 
aren't you?  If not, why not?

-- 
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com


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

Date: Tue, 2 Jun 1998 23:32:18 +0200
From: "Maurits" <opx1@rocketmail.com>
Subject: dead program processes??
Message-Id: <6l1r90$2lb4@reader3.wxs.nl>

my server's helpdesk :
=========
There were 3 programs that were constantly running killing your server
resources,

aaaa.pl
bbbb.pl
cccc.pl

Once we isolated the problem, and removed the dead program processes,
your server was back to normal.
========
damn, I screwed up!!

The scripts worked "fine" , how can it be than that the perl scripts are
constantly running?
I've used the exit; command, and doesn't a script terminates when finished?

each of these scripts connect to a msql database, but that's not the
problem, i hope....because the output is correct.....

pls advice
thnx
maurits




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

Date: 2 Jun 1998 21:16:18 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Dividing and type casting to an int !
Message-Id: <6l1q32$370@news-central.tiac.net>

In article <35744261.A4B0CB67@cat.com>,
Vincent M. Probasco <probavm@cat.com> wrote:

>I have a script that needs to find a percentage .
>Example -
>
> $percent = int ($first_num / $sec_num * 100)
>
>
>The numbers I'm coming up with are often off by a little. I was
>wondering if this could
>be because of the int typecasting or should I look elsewhere in the
>script ?

The int isn't a type cast, it truncates a value to an integer, you might
consider (assuming that possibe divide by zeros have been avoided
earlier...) something like this:

  $percent = $first / $second * 100;
  $percent = int ($percent + 0.5 * ($percent <=> 0));

as a place to start, or you can use sprintf which is mentioned in
section 4 of the FAQ (list of frequently asked questions & answers) e.g.

  $percent = sprintf '%.0f', $first / $second * 100;

If you have a recent perl installation then 

  perldoc perlfaq4

will get you section 4 of the FAQ, if your perl is old or the docs aren't
on line then visit http://www.perl.com and follow the FAQs link.

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Tue, 02 Jun 1998 10:22:14 +0200
From: Christopher Eltschka <celtschk@physik.tu-muenchen.de>
Subject: Re: Free Documentation (was: Re: GNU attacks on the open software community)
Message-Id: <3573B636.60688C00@physik.tu-muenchen.de>

Greg Lindahl wrote:
> 
> Christopher Eltschka <celtschk@physik.tu-muenchen.de> writes:
> 
> > > I know that's very anti-FSF of me to give something away so freely without
> > > strings, but it's what I want to do.  I think that's what Perl wants to do.
> >
> > No, it's very anti-FSF that you attach certain strings to the
> > rest of the document, namely denying the right to change it, and
> > denying the right to make profit from it. (Note that they don't
> > have any problem with your right to be identified as author of it).
> 
> Woah. Don't let Tom talk you into thinking that the world is either
> pro or anti-FSF. Who cares if Tom does or doesn't do what the FSF
> likes? I sure don't. Nor do I care about Tom's complaint that the FSF
> doesn't think Tom's documentation is perfect for FSF purposes.

Oh no, another ambiguity lurking around! ;-)

"anti-FSF" as I meant it (and as I think Tom meant it, too) does *not*
mean the personal attitude here, but just "opposed to what the FSF
would like to see", "against the spirit of the FSF". Especially, there's
nothing emotional in this usage of "anti-". Indeed, since the subject
was licensing, I don't see how a license could have an attitude
towards the FSF - you can just say if it conforms to the goals of
the FSF (= not "anti-"), and if it encourages the goals (= "pro-").

If one goal is in opposition to another, it's "anti-". This does
not mean that the person having that goal has negative attitude
towards the other goal. The same person can have "pro-" and "anti-"
goals at the same time (although not for the same object). Perl
is a good example: The Perl license is "pro-FSF", but the perlfaq
license is "anti-FSF". Therefore is Tom pro- or anti-FSF? Possibly
neither nor. At least from the licensing alone you can't say.

However, I'm not a native English speaker, so I might miss something
important about the usage of "anti"...

[...]


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

Date: 02 Jun 1998 13:59:16 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Handling ClearCaser revision numbers
Message-Id: <r87m30qvdv.fsf@asc.sps.mot.com>


A few days ago Tom posted the bit out of perlmod that tells you how to
set the $VERSION from your revision control system's idea of version
number - something like:

$VERSION = do{my@r=(q$Revision: 1.29 $=~/\d+/g);sprintf"%d."."%03d"x$#r,@r}; 

Here is a version of this that works with ClearCase as well.  In this
case, the clearcase version number becomes the minor revision number
(the bit after the '.') and you have to manually change the major
revision number in this hack if you want to:

$VERSION=do{my@r=(q$Revision: /main/3 $=~m|[ \./](\d+)(?=[\.])|g);$#r||unshift(@r,'1');sprintf("%d."."%03d"x$#r,@r)};


Cheers,

Martin.


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

Date: Tue, 02 Jun 1998 21:57:33 +0200
From: Andreas <aladin@berlin.snafu.de>
Subject: How can I get the userID to open certain pages
Message-Id: <3574592D.4FF41A72@berlin.snafu.de>

Hi,
I4m just new here.
Does anyone know how I can get the userID, without using REMOTE_USER,
because this doesn4t work. I have a restricted area ( htaccess), but
after a user has logged in, I still can4t get the userID with it.
I have one hyperlink, which should only open a page in the browser,
depending on the username, so that the different registered users are
only able to see their pages.

Thanks in advance

Andreas



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

Date: Tue, 02 Jun 1998 21:26:00 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: How do I pass multiple parameters to a cgi script from the browser?
Message-Id: <Pine.GSO.3.96.980602142224.15370u-100000@user2.teleport.com>

On Tue, 2 Jun 1998, John Chambers wrote:

> I'd like to add the observation that the other comment from Tom Phoenix: 
> 
> >You pass parameters to a CGI script in the same way no matter what
> >language it's written in.
> 
> is also not, strictly speaking, correct either.  Consider both of:
> 
> http://www.silly.com/cgi/numb.pl?philosopher=plato&dictator=castro
> http://www.silly.com/cgi/numb.pl/philosopher=plato/dictator=castro
> 
> These URLs will both "work" for sending two paramters to the script.
> The script will get the data in different environment variables. 

The choice of programming language has no effect upon how the data are
passed to it. I stand by that statement. The CGI protocol specification
doesn't say to do one thing if the program is written in Perl, another
when it's a shell script, and still another when you've used C. The
_protocol_ is independent of the language used. You pass parameters to a
CGI script in the same way no matter what language it's written in.

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



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

Date: Tue, 02 Jun 1998 21:05:37 GMT
From: ffinstad@globalsight.com
Subject: How do you kill a Windows NT process using Perl?
Message-Id: <6l1pf0$oei$1@nnrp1.dejanews.com>



To restart Apache on UNIX I'm doing:

echo "killing the web server..."
echo
kill `cat /usr/local/apache/conf/httpd.pid`
echo "restarting the web server..."
echo
/usr/sbin/httpd -f /usr/local/apache/conf/httpd.conf

How can I do the same thing on Windows NT?

I'm using NT 4.0, Perl for Win32, and Apache 1.3b6.

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


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

Date: Tue, 2 Jun 1998 11:29:41 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: looking for DROP DOWN CATEGORY MENU
Message-Id: <3573E225.BDC674B9@inlink.com>

Try 

www.gamelan.com

HTH,
Brent


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

Date: Tue, 02 Jun 1998 20:24:04 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <35744c92.18732061@news.btinternet.com>

On 2 Jun 1998 16:35:49 GMT, Tom Christiansen wrote :

> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, Gellyfish@btinternet.com (Jonathan Stowe) writes:
>:Just a thought but shouldnt POD markup be deprecated in usenet
>:postings just as HTML is ?
>
>You've *got* to be kidding.  Whyever would you think that we should
>deprecate *simple* text markups?  It's not like we have _Elements
>of Typography_ breathing down our necks.
>
Eh,oh

Elements of Typography ?

Does C<scalar keys %hash> carry any more or any less typographical
information  than <CODE>scalar keys %hash</CODE> ?  It is left to an
interpreting application to place its own typographical interpretation
on either according to its requirements.

In plain text neither markup adds anything to the text that could not
be achieved without such a meta-textual device and can only serve to
obfuscate the meaning of the text thus treated.

Oh I *was* kidding,  but this week is turning out strange already.

/J\ 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: 02 Jun 1998 17:08:28 -0400
From: crigler@seo.com (James B. Crigler)
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <lz1zt78qb7.fsf@jim.seo.com>

>>>>> "jdp" == <jdporter@min.net> writes:

 Tom> So, you're fundamentally opposed to the ST?

[ST == Schwartzian Transform]  (sp?)

>>>>> "Tom" == Tom Christiansen <tchrist@mox.perl.com> replies:

 Tom> That has a return value, which is used.  It's clear when you say

 Tom>     @foo = map {} sort {} map {} @bar;

 Tom> That that map is used for its return value is clear and obvious.

 Tom> Using map to hide changing the contents of the target list
 Tom> because you're too divinely functional to use a stone-age loop
 Tom> the way we dumb old procedural-programmers do is just going to
 Tom> get you talked about.

Which agrees completely with the Scheme way of doing things: In
Scheme, looping through a list for side effects should be done by the
(R4RS-required; I don't know about IEEE) for-each procedure.

 Tom> Side effects suck.

WRT "map", absolutely true.

-- 
Jim Crigler <crigler@seo.com>
Schwartz Electro-Optics, Inc.   Voice:  (407)298-1802 x200
3404 N. Orange Blossom Trl.       Fax:  (407)290-9666
Orlando FL 32804-3498 USA


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

Date: 02 Jun 1998 17:33:49 -0400
From: Dan Schmidt <dfan@harmonixmusic.com>
Subject: Re: map in void context regarded as evil - suggestion
Message-Id: <wk3edno5du.fsf@turangalila.harmonixmusic.com>

Tom Christiansen <tchrist@mox.perl.com> writes:

| I can't see why people use
| 
|     map  { s/foo/bar/ } @list;
|     grep { s/foo/bar/ } @list;
| 
| when they could more clearly write:
| 
|     for (@list) { s/foo/bar/ } 
| 
| Put the important thing first.

Sometimes it is more convenient or idiomatic to phrase your statement
in the form "perform this action on these objects" rather than "take
these objects, and perform this action on them."  It's a matter of
taste to me.

(Please don't Cc: a copy to me if you reply in the newsgroup - thanks)

-- 
                 Dan Schmidt -> dfan@harmonixmusic.com, dfan@alum.mit.edu
Honest Bob & the                http://www2.thecia.net/users/dfan/
Factory-to-Dealer Incentives -> http://www2.thecia.net/users/dfan/hbob/
          Gamelan Galak Tika -> http://web.mit.edu/galak-tika/www/


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

Date: Tue, 2 Jun 1998 23:24:29 +0300
From: softhome98@softhome.net (.)
Subject: Newbe needs help with scripts...
Message-Id: <MPG.fde8bab28c42aa989683@news.netvision.net.il>

I am a newbie just building my first site. I need a javascript (1.0) or a 
perl (for windows NT) script that will be able to insert a certain META 
tag in the HEAD of an HTML document, ONLY if the document is beeing read 
by Microsoft Internet Explorer (any version...). While other browsers are 
accessing this document nothing should happen. I know this is supposed to 
be a simple and short script, but I have just started learning and 
couldn't make it work.

Thanks in advance AVi M

Please e-mail me any response. 


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

Date: Tue, 2 Jun 1998 14:13:58 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Newbe needs help with scripts...
Message-Id: <MPG.fde0af4ae1ba9fb98968d@hplntx.hpl.hp.com>

In article <MPG.fde8bab28c42aa989683@news.netvision.net.il>, 
softhome98@softhome.net says...
> I am a newbie just building my first site. I need a javascript (1.0) or a 
> perl (for windows NT) script that will be able to insert a certain META 
> tag in the HEAD of an HTML document, ONLY if the document is beeing read 
> by Microsoft Internet Explorer (any version...). While other browsers are 
> accessing this document nothing should happen. I know this is supposed to 
> be a simple and short script, but I have just started learning and 
> couldn't make it work.
> 
> Thanks in advance AVi M
> 
> Please e-mail me any response. 

The test you want is:

if ($ENV{HTTP_USER_AGENT} =~ /\bMSIE\b/i) { do your dirty work }

If you don't have the Perl skills to write the rest of the script, buy 
'Learning Perl on Win32 Systems' from O'Reilly & Associates.

-- 
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com


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

Date: Tue, 02 Jun 1998 15:33:35 -0600
From: Steve Fullmer <_larryf@micron.net_>
Subject: Re: Newbe needs help...
Message-Id: <35746FAE.DE561215@micron.net_>

    I know you wanted this emailed, but I think other users might even use
some of this information at some point down the road themselves.

if ((navigator.appName=="Microsoft Internet Explorer") &&
(parseInt(navigator.appVersion)>=4))
{
    document.write("<META Name='Keywords' Content='PROMOTION!'")
    document.write("<META Name='Description' Content='Free Download!'")
    document.write("<META Name='Copyright' Content='Ask before using,
please.'">
}

    You can document.write to most any part of the page, but be sure to use
single quotes (the apostraphe) for all the things you want to appear in
double-quotes in the page.

------------ ------------ ------------
  __                           __
 (  \  /                      (  \__)    /  /
  \ --/--           __         __/__    /  /  _  _        __
   \ /  /> /| / /> / /       __ / /  / /  /  / \/ \  />  /  '
\__)(_/(__/ |/ (__/  (_      \_/ /__/ (_ (_ /     / (__ /

*Before there were newbies, were there problems?*
 (meant in both a mean way AND a think-about-this way)



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

Date: Tue, 02 Jun 1998 21:07:30 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: perl for windows 3.1?
Message-Id: <3574689f.25875167@news.btinternet.com>

On Tue, 2 Jun 1998 16:18:39 GMT, Klaus Kettner wrote :

>On Mon, 01 Jun 1998 22:09:48 GMT, (Jonathan Stowe) Gellyfish@btinternet.com wrote:
>
>
>>c:/develop> perl -v
>>This is perl, version 5.004_02
>
>Is that one the version found on CPAN? If not, do you have an URL?
>
>
You can find it at :

http://www.delorie.com/djgpp/dl/ofc/simtel/v2gnu/perl54b.zip

However lets have a look ...

Yeah it is on CPAN in:

/ports/msdos/LMOLNAR/perl542b.zip

Hope this helps.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: 2 Jun 1998 20:58:40 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: perl modules
Message-Id: <896821627.587268@thrush.omix.com>

John Chambers <jc@ral1.zko.dec.com> wrote:
: I had to spend a most of a day watching installs bomb because
: they needed some other package that I hadn't yet installed (for
: the simple reason that I'd never heard of it).  And that package
: in turn needed something not mentioned in the README file, to a depth
: of about 4 as I recall.
	>snip<

	The Makefile.PL file should know the required modules.  If you
	use the CPAN module (and have an active internet connection) you
	can use it to install with full dependency checks and auto-installs
	of the dependencies.

		perl -MCPAN -e 'install Bundle::libnet'

	This will install libnet, and everything else libnet requires to
	run, without any user intervention.

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: Tue, 2 Jun 1998 11:52:06 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: please help!!
Message-Id: <3573E766.492571BE@inlink.com>

YOU DON'T!

*perl* should be in the /usr/bin/perl subdir, your perl script should go
in your cgi-bin subdir.  Check your web servers documentation on how to
set up the web server to run CGI programs too!

HTH,

Brent


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

Date: 2 Jun 1998 21:24:39 GMT
From: "Matt L." <matt@att.net>
Subject: Re: Please Help: How do you make a vote/polling script???
Message-Id: <6l1qin$8ju@bgtnsc02.worldnet.att.net>

Thanks a lot for the tip!  I'll check it out.  I'm just getting started
with PERL, you know, reading the books and writing scripts.

>Matt

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

Vincent M. Probasco <probavm@cat.com> wrote in article 
> Matt,
>     I asume you know some PERL. You'll need to have a file seperate from
> your cgi script that keeps
> track of the voting results. The file might start out looking like
> this...
 
> 0
> 0
> 0
> 0

>         Each zero would be a different field that you want to keep track
> of. You can then parse this data
> and add to it as necesary. I know this is brief , but I hope it helps.
> You'll need to use the open() and
> close() functions to get to the data inside the file.


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

Date: Tue, 02 Jun 1998 23:15:09 +0200
From: "H.Merijn Brand" <PROCURA_BV@CompuServe.com>
To: Heribert Wettels <wettels@respublica.de>
Subject: Re: Something like "Visual Perl"?
Message-Id: <35746B5D.97B344D4@CompuServe.com>

ftp://ftp.cs.pdx.edu/pub/elvis/unreleased

is the location of the latest sources of elvis. The nice thing for
me is that it runs on NT4 as well as on *ALL* my unix boxes.

BTW I'm a vi type of guy, I do NOT like emacs. Don't blame me,
    I'm born that way.

Heribert Wettels wrote:
> 
> Has anybody heard about a programming environment for Perl similar to
> Visual Basic? Or at least an editor that creates indents and does some
> highlighting?
> 
> Heribert
> 
> --
> PGP fingerprint:  4B 68 BF FA B0 81 59 F7  E2 86 5C D2 78 B9 37 28
> Public key at: http://www.respublica.de/pgp/wettels-pubkey.txt


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

Date: Tue, 02 Jun 1998 21:20:36 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: STDIN on IIS
Message-Id: <Pine.GSO.3.96.980602141823.15370t-100000@user2.teleport.com>

On Tue, 2 Jun 1998, Alee Ali wrote:

> When I run my script without any <STDIN> command in the code the script
> works fine, but as soon as I enter something on my web page and the
> script checks for STDIN I keep getting the message Waiting for reply.

It sounds as if you're not following the CGI protocol specification. Or
perhaps your webserver isn't. If you're not sure, the docs, FAQs, and
newsgroups about CGI and other web-related issues may be able to help. 
Good luck! 

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



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

Date: Tue, 02 Jun 1998 17:38:39 -0400
From: Paul Wilver <p_wilver@gsvms2.cc.gasou.edu>
Subject: Submitting html form to Perl script.
Message-Id: <357470DF.CCD0D3ED@gsvms2.cc.gasou.edu>

   I have Perl Win32 installed on Windows 95 using Personal Web Server
(from the NT 4.0 option pack). I can't figure out the perl code to
accept the input of an html form. The closest I have come is :
#!/usr/local/bin/perl
print "content-type: text/html\n\n";
use cgi qw(param);
$a=param("field1");
$b=param("field2");
$c=param("field3");
print "$a\n$b\n$c";
The output of this is document contains no data. When I was running Perl
on UNIX,  I used $form=<STDIN> and then used code to break $form into
individual fields. That doesn't work with the Windows 95 setup. I have
also tried $form=<> and $form=$_. Neither worked. Can anyone tell me how
to input form data as a string and parse it myself as I was doing with
UNIX. I'm worried about using the cgi.pm because the latest version of
Perl Win32 is 5.00307 and the cgi.pm has the line require 5.004; which I
commented out to get it to run. I do have perl scripts working with this
setup - I just can't figure out how to do html form input. I will be
grateful for any help offered.



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

Date: Tue, 2 Jun 1998 11:43:27 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: Suggestions?
Message-Id: <3573E55F.30E107A2@inlink.com>

This article may help get you started:


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

Date: Tue, 2 Jun 1998 11:43:37 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: Suggestions?
Message-Id: <3573E569.7623A75@inlink.com>

This article may help get you started:

http://www.webresource.net/cgi/articles/searching/index.html

Good luck,

Brent


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

Date: Tue, 02 Jun 1998 15:01:47 -0500
From: Ray Rarey <rayr@accessus.net>
Subject: Taking data out of strings
Message-Id: <35745A2B.64E3FFB6@accessus.net>

Can anyone help me with this one? I've been trying different approaches,
but nothing works. This is what i'm trying to do:
For our school, we have a website that lists all the people that made
the honor roll (about 1,600, so I want to make the pages with perl) and
each line of data in the files is written like this:
LAST NAME, FIRST NAME             GRAD. YEAR           GPA
I want to get perl to read the files, take out each line one at a time,
and  print the person's names in a table cell, their grad year in a
cell, and their gpa in a cell.
Is there some function like in BASIC and JavaScript that starts from the
right or left of a string and reads a certain number of characters?
I want to be able to read 3 characters from the right side and store
them as the GPA,then repeat the process for the names and grad year,
eventually ending up with all those things in it's own variable. Then I
can print out a row in the table and do the next line.
I have no trouble with reading lines and printing them in files, but I
can't figure out how to break up the data.
If anyone can help me with this, please e-mail me at rayr@accessus.net.

        Thanks in advance,

                Ray Rarey



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

Date: Tue, 02 Jun 1998 21:05:11 GMT
From: r-watkinsNOSPAM@worldnet.att.net (Robert Watkins)
Subject: Re: Taking data out of strings
Message-Id: <6l1pmb$8n@bgtnsc03.worldnet.att.net>

In article <35745A2B.64E3FFB6@accessus.net>, Ray Rarey <rayr@accessus.net> wrote:
>Can anyone help me with this one? I've been trying different approaches,
>but nothing works. This is what i'm trying to do:
>For our school, we have a website that lists all the people that made
>the honor roll (about 1,600, so I want to make the pages with perl) and
>each line of data in the files is written like this:
>LAST NAME, FIRST NAME             GRAD. YEAR           GPA
>I want to get perl to read the files, take out each line one at a time,
>and  print the person's names in a table cell, their grad year in a
>cell, and their gpa in a cell.
>Is there some function like in BASIC and JavaScript that starts from the
>right or left of a string and reads a certain number of characters?
>I want to be able to read 3 characters from the right side and store
>them as the GPA,then repeat the process for the names and grad year,
>eventually ending up with all those things in it's own variable. Then I
>can print out a row in the table and do the next line.
>I have no trouble with reading lines and printing them in files, but I
>can't figure out how to break up the data.
>If anyone can help me with this, please e-mail me at rayr@accessus.net.
>
>        Thanks in advance,
>
>                Ray Rarey
>

Open the file with a filehandle (lets say, FILEHANDLE), then use substr() to 
read a certain number of characters.

For example, if
$string = "Where there's Perl, there's a way.";
$newstring = substr($string, 14, 4);
then $newstring eq "Perl"

Although, if your lines are tab-delimited, I would do a pattern match on
$_ =~ /(.*)\t(.*)\t(.*)/, where: $1 eq LAST NAME, FIRST NAME
                                         $2 eq GRAD. YEAR
                                         $3 eq GPA

so that:
$filename = '/path/filename';
open (FILEHANDLE, "$filename");
while (<FILEHANDLE>) {
        if ($_ =~ /(.*)\t(.*)\t(.*)/) {
                push(@names, $1);
                push(@grad_year, $2);
                push(@gpa, $3);
        }
}
close FILEHANDLE;

This will give you arrays with each bit of data you want (assuming I 
understand you correctly).


Robert Watkins
Supervising Web Developer
Springer-Verlag New York, Inc.
rwatkins@springer-ny.com


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

Date: Tue, 02 Jun 1998 21:18:33 GMT
From: Tom_Howland@notes.pw.com
Subject: Re: The RPC server is unavailable
Message-Id: <6l1q78$pa5$1@nnrp1.dejanews.com>

In article
<yfzlnroohcf.fsf@bamboo.i-did-not-set--mail-host-address--so-shoot-me>,
  Tom Howland <Tom_Howland@notes.pw.com> wrote:
>
> I'm doing ole programming from Perl. Its great! I'm using it to generate
> Excel charts.
>
> One thing that has me puzzled is the following error message:
>
> OLE error 0x800706ba: "The RPC server is unavailable"
>     in methodcall/getproperty "Workbooks" at
D:\tom\perl\5.00402\lib/perl5db.pl line 65535
> 	Win32::OLE::AUTOLOAD('Win32::OLE=HASH(0xb7d6b0)') called at
excel_client.pl line 171
> 	Carp::carp('OLE error 0x800706ba: "The RPC server is unavailable"^J
in met...') called at D:\tom\perl\5.00402\lib/perl5db.pl line 65535
> 	Win32::OLE::AUTOLOAD('Win32::OLE=HASH(0xb7d6b0)') called at
> 	excel_client.pl line 171
>
> The statement that starts all this in my source is
>
>   my $workbook = $application->Workbooks->Add() || die "couldn't create a
workbook: $!";
>
> where $application is created with
>
>   my $application = Win32::OLE->new('Excel.Application', 'Quit') || die
"couldn't connect to Excel: $!";
>
> I observe that I do not get this error when I always Quit my application
> instance after closing my workbook. In other words, the error goes away
> if I constantly create and destroy application instances instead of just
> keeping on application open and creating and destroying workbooks within
> it. This has a very serious performance penalty. If I keep the
> application open, chart generation is about half a second. But if I
> don't, marshaling causes a several second delay.
>
> Any ideas what is going on?
>
> I'm using windows nt 4 service pack 3, MS Excel 97, perl 5.00402
> (prebuilt), and libwin32-0.12 (prebuilt).
>

This problem vanished when I went from the prebuilt perl5_004_02 to
my own build of perl5_004_04 using vc++ 5. Thanks to all who replied.

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


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

Date: Tue, 2 Jun 1998 13:27:45 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: User System Info.
Message-Id: <MPG.fde0019f56aebc898968c@hplntx.hpl.hp.com>

In article <6l052o$eb3$1@nnrp1.dejanews.com>, bobbybooby@my-dejanews.com 
says...
> I'm sure that I have the totally wrong group, but I'll go for it anyway. 

You do, but as a simple Perl script will help you, here goes...

> I've seen a couple of postings related to using JavaScript and Java to obtain
> Screen Size information from the user's system.  However, none of these is
> working with what I want.
> 
> If you check out www.anonymizer.com and click on the "What we know about you"
> link.  You'll see information presented that typically isn't anything new. 
> However, the screen size baffled me as well as the processor.
> 
> They are NOT using JavaScript.	It seems to be something with a SSI or CSI. 

It is simply CGI.

 ...
> Any help out there, this has been killing me today trying to come up with a
> script that works.  I'm being adamant because I'm using IE3.02 (client uses
> this) and none of the Java/JavaScript examples work.  The one on anonymizer
> is the only one that does!
 ...

That's your answer.  The IE browsers send back a load of gratuitous 
information about the client, including screen size, color depth, 
processor type and operating system.  Try the following trivial script, 
both from IE and Navigator (or whatever):

#!/usr/local/bin/perl -w

print "Content-Type: text/plain\n\n",
    map "$_\t= $ENV{$_}\n", sort keys %ENV;

-- 
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com


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

Date: Tue, 02 Jun 1998 20:25:22 GMT
From: hash@email.infotrade.co.uk (Alex Barilo)
Subject: Re: very quick s/// question
Message-Id: <35745f33.10120745@news.force9.net>

On Tue, 02 Jun 1998 17:54:16 GMT, hex@voicenet.com (Matt Knecht)
wrote:

> On 2 Jun 1998 17:06:03 -0500, James Lawrence <lawrence@math.umass.edu> wrote:
> >$str = "a b c" ;  
> >$str =~ s/(\w)\s(\w)/$1\*$2/g ;  
> >print "$str\n" ; 
> >I want to convert "a b c" into "a*b*c" but I get "a*b c"
> >instead.

> $pattern = 'a b c d e';
> print join('*', split(/\s/, $pattern)), "\n";	# prints "a*b*c*d*e"

How about just s!\s!\*!g :)

Cheers,
Alex
---------
All you need is Perl


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

Date: Tue, 02 Jun 1998 20:21:45 GMT
From: ptimmins@netserv.unmc.edu
Subject: Re: very quick s/// question
Message-Id: <6l1mso$ku1$1@nnrp1.dejanews.com>

In article <357430fb.0@oit.umass.edu>,
  lawrence@math.umass.edu (James Lawrence) wrote:
>
> can you tell me what's wrong with this?
> --------
>
> #!/usr/bin/perl -w
>
> $str = "a b c" ;
> $str =~ s/(\w)\s(\w)/$1\*$2/g ;
> print "$str\n" ;
>
> --------
>
> I want to convert "a b c" into "a*b*c" but I get "a*b c"
> instead.
>
> -jl
>

Try replacing your substitution line with:

$str =~ s/ /*/g;

this will convert each space in $str to an astersisk.

Now if for some reason you need to save each "non-space" group of characters
for later use, you would need a more general solution. Take a look at perldoc
perlre. Buy Jeffrey Friedl's Mastering Regular Expressions if you have to do
alot of this sort of thing in the future (published by O'Reilly ... the blue
"hip owls" book).

Hope that helps.

Patrick Timmins
U. Nebraska Medical Center

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


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

Date: Tue, 02 Jun 1998 21:40:29 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: very quick s/// question
Message-Id: <hj_c1.44$m4.801288@news3.voicenet.com>

Alex Barilo <hash@email.infotrade.co.uk> wrote:
>> >$str = "a b c" ;  
>> >$str =~ s/(\w)\s(\w)/$1\*$2/g ;  
>> >print "$str\n" ; 
>> >I want to convert "a b c" into "a*b*c" but I get "a*b c"
>> >instead.
>
>> $pattern = 'a b c d e';
>> print join('*', split(/\s/, $pattern)), "\n";	# prints "a*b*c*d*e"
>
>How about just s!\s!\*!g :)

Because:

$pattern = 'a b c d e   ';
$pattern =~ s!\s!\*!g;
print "$pattern\n";		# prints "a*b*c*d*e***"

I think the original poster's intent was to join non-whitespace with a
delimiter character.  The solutions provided by just searching for
whitespace fail when there is leading and trailing whitespace.

The use of (?= text) in the regex is the most convienient way of
answering the original poster's question.  Something like another poster
suggested:

$pattern = ~s/(\w)\s(?=\w)/$1\*$2/g;

Running these two methods through Benchmark produces confusing (At least
to me) results.  Consider:

#!/usr/local/bin/perl
use Benchmark;

$pattern = "a b c d e    ";

timethese(1_000_000, {
    'regex'       =>  ' $pattern =~ s/(\w)\s(?=\w)/$1\*$2/g',
    'regex_o'     =>  ' $pattern =~ s/(\w)\s(?=\w)/$1\*$2/go',
    'procedural'  =>  ' $pattern = join('*', split(/\s/, $pattern))'
});
__END__
Benchmark: timing 1000000 iterations of procedural, regex, regex_o...
procedural:  1 secs (-0.03 usr  0.00 sys = -0.03 cpu)
            (warning: too few iterations for a reliable count)
     regex: 28 secs (28.19 usr  0.00 sys = 28.19 cpu)
   regex_o: 30 secs (28.21 usr  0.00 sys = 28.21 cpu)


I don't understand what's going on with 'procedural' here because it
takes about 15 seconds to execute (By the very rough guess of me
watching the system clock).  I can only assume that the Perl interpreter
itself is doing most of the work here, hiding it from my process (But
then, why wouldn't it show in sys time?).  Can anybody clue me in as to
what the problem is?

Also, throwing a study $pattern in before timethese() only increases the
times.

-- 
Matt Knecht + <hex@voicenet.com>


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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