[9931] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3524 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 24 12:07:20 1998

Date: Mon, 24 Aug 98 09:00:21 -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           Mon, 24 Aug 1998     Volume: 8 Number: 3524

Today's topics:
        access database in perl <nigell@nigellboulton.webfusion.net>
    Re: Code Style (Was: How to sort this associative array (Matt Knecht)
        Counting dots in a string <shahada@icky.pc.my.NOSPAM>
        Error Installing Perl on Digital UnixD <issam@qtel.com.qa>
        File creation (Hooman Salamat)
    Re: filehandle in CGI.pm (I.J. Garlick)
        Forwarding mail spool file tyuhas@neurobio.arizona.edu
        How I write the perl invocation line and deal with @INC <ben.pavon@hsc.hac.com>
    Re: Pattern match for filename extensions huntersean@hotmail.com
        Perl 5 and HP-UX 11 <bob.hannaford@adc.metrica.co.uk>
    Re: Perl Bots! [Chatterbots, FAQbots, InfoBots] (Mark-Jason Dominus)
    Re: Perl documentation (Mark-Jason Dominus)
    Re: Perl documentation <flavell@mail.cern.ch>
    Re: Perl documentation <strat@pacifier.com>
    Re: Perl FAR version 1.1.1 MAKE SURE YOU READ THIS BEFO (Snowhare)
    Re: perl in Win95 (Louie)
    Re: Perl on linux (I.J. Garlick)
    Re: Q: Sliding Window Sort With Perl? <gnat@frii.com>
    Re: Reading From File (I.J. Garlick)
    Re: Reading from files (I.J. Garlick)
    Re: regex question: striphtml and misformed tags (Mark-Jason Dominus)
    Re: Why dont people read the FAQs (I R A Aggie)
    Re: Why dont people read the FAQs (I R A Aggie)
        Writing a moduleless Web client <simon@new-mediacom.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Mon, 24 Aug 1998 16:09:16 +0100
From: "Nigell Boulton" <nigell@nigellboulton.webfusion.net>
Subject: access database in perl
Message-Id: <6rs0it$pst$1@mendelevium.btinternet.com>

I have an access database that I want to allow people to search on my web
site.

This would be similar to the http://www.schoolsearch.co.uk website

Any ideas, code would be appreacted.

Many thanks

Nigell Boulton




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

Date: Mon, 24 Aug 1998 15:44:59 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: Code Style (Was: How to sort this associative array?)
Message-Id: <%TfE1.626$pY1.3589241@news2.voicenet.com>

Abigail <abigail@fnx.com> wrote:
>++     for (sort
>++             {
>++                 $spool->{0}->{ng}->{$b}->{count}
>++                 <=>
>++                 $spool->{0}->{ng}->{$a}->{count}
>++             }
>++             keys %{$spool->{0}->{ng}}) {
>++ 
>++         printf "\t    %-5s : %s\n",
>++                 commify($spool->{0}->{ng}->{$_}->{count}),
>++                 $_;
>++     }
>++ }
>++ 
>++ Which also sucks.  Opinions on how to format these constructs, anyone?
>
>
>Well, if it sucks, it sucks for a certain reason. Find out why you
>think it sucks, and avoid it. :)

Good advice.  After seeing all the replies to this message, I think I've
figured out why this isn't such good practice.  In fact, Zenin said it
best with:

    I admit the above isn't too clean either, but with a sort
    that big maybe it would be better in a named sub anyway?

The problem (As I see it, of course) is that looping constructs and
control flow statements should be reasonably clean looking, and easy to
pick out.  It's too easy to abuse the perk of being able to specify code
inline to a sub that take a code ref.  Something like:

for (sort { $a <=> $b } @array)

Is easily readable and encapsulated nicely.  But, when the argument to a
sub in a for becomes complicated enough to warrant it's own formatting,
you've already gone too far.  It's mixing two completely seperate types
of logic in the same small space, which just obfuscates both.

>    my $ng = $spool -> {0} -> {ng};
> [snip use of ST]
>Using '$ng = $spool -> {0} -> {ng}' not only makes it more readable,
>it saves a lot of hash lookups as well.

More good advice.  So, in my taste with respect to all the opinions 
here, I think this is how I'd rewrite that:

{
    my $ng = $spool->{0}->{ng};

    for (sort cancel_sort keys %$ng) {
	## printf ...
    }
}

## Somewhere else, most likely in a section where all sort subs are
## buried:

sub cancel_sort
{
    ## ...
}

So, I think I can add a new rule to my own nebulous formatting rules.

Once a code ref argument requires it's own formatting, it requires it's
own sub (Don't inline it!).  Simple, and easy to remember.  Of course,
it's just a rule, and easy to break when you need to. :)

Thanks for the great advice, everyone.

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


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

Date: Mon, 24 Aug 1998 23:35:04 +0800
From: shahada abubakar <shahada@icky.pc.my.NOSPAM>
Subject: Counting dots in a string
Message-Id: <35E18828.A6409E13@icky.pc.my.NOSPAM>

I'm looking for an efficient way to count the number of ocurrences of a
particular character in a string. For example:

    &countch ('comp.lang.perl.announce', '.') == 3
    &countch ('comp.unix.admin', '.') == 2
    &countch ('alt.romance','.') == 1

Is there a better way to implement this other than a for loop over the
length of the string, and a substr to test and increment a counter?

Regards,

 .sha



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

Date: Mon, 24 Aug 1998 18:07:23 +0300
From: "Issam W. Alameh" <issam@qtel.com.qa>
Subject: Error Installing Perl on Digital UnixD
Message-Id: <6rskei$6t0@ns1.qatar.net.qa>

I Tried to install perl on DU 4.od, but it is keep giving this error,
Use which C compiler? [cc]

Checking for GNU cc in disguise and/or its version number...
Configure: DEC: not found

*** WHOA THERE!!! ***
    Your C compiler "cc" doesn't seem to be working!
    You'd better start hunting for one and let me know about it.

I am not benefiting from my machine since it is meant to be used as a web
server and run on it perl, can any body help in this

Regards
Issam Alameh




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

Date: Mon, 24 Aug 1998 11:57:37 EDT
From: salamat@cs.concordia.ca (Hooman Salamat)
Subject: File creation
Message-Id: <1998Aug24.115737@orchid>


I have a question.
How we can create a file using perl when you write CGI program.
For example: open(FH,"+>filename"); although it works for perl,
but it doesn't work, if you use it in a CGI program and that file 
doesn't exist.

Hooman
-- 
Hooman


==================================================================
Homepage: http://www.cs.concordia.ca/~grad/salamat

Address(office) : Concordia university 
Sir George Williams Campus
1455 De Maisonneuve Blvd. West
Office location: S LB 1041-1


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

Date: Mon, 24 Aug 1998 08:29:46 GMT
From: ijg@csc.liv.ac.uk (I.J. Garlick)
Subject: Re: filehandle in CGI.pm
Message-Id: <Ey6q9M.428@csc.liv.ac.uk>

In article <6robmr$5qt$1@artemis.it.luc.edu>,
"John E. Bigane" <jbigane@luc.edu> writes:
> I had a similar problem because I wasn't closing the filehandle being
> printed to.
> 
> John Bigane

As far as I understand things the file should be closed automatically as soon
as the filehandle goes out of scope, I could be wrong however as I always
try to remember to close the filehandle.

To get back to my original hypothesis, this means if you open the file in
a sub the file will auto close when you return from the sub routine. Even if
it is not in a sub if the script finishes normally then this is the same as
realistically the main body of the script is treated almost like a sub called
main. The only way therefore for your file to give a zero byte file is if it
dies before it gets chance to close the file automatically.

So doing a quick test..... Hmmm. It always closes, even if I force a die!!

Hold on... Ahhh. If I force it to die before it prints anything you get a
zero byte file. Now this is not a rigorous test and I am sure some of the
gurus here can give us some situations where it will give a zero byte file
as you describe.

A thought does occur to me though, if you are using open2 or open3 then 
probably none of the above will apply.  Perhaps someone can fill what would
happen with open2/3 in, as I have terrible fun with them.

--
Ian J. Garlick
ijg@csc.liv.ac.uk

Democracy is a form of government in which it is permitted to wonder
aloud what the country could do under first-class management.
                -- Senator Soaper


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

Date: Mon, 24 Aug 1998 15:32:06 GMT
From: tyuhas@neurobio.arizona.edu
Subject: Forwarding mail spool file
Message-Id: <35e18614.1182019804@news.arizona.edu>

We have a situation here where people move on to bigger and better
things without notifying those of us administering accounts.  So a
week or so after they're gone, they want their mail forwarded and any
old mail sent to them.  Fortunately, most spool files have been small
so I just send the whole thing as an attachment.  I'm looking for a
way to get a perl script to walk through the spool file and forward
each message individually.  Is there a particular module with
functions well suited for this?

Also,  anyone know offhand what's the official message separator for a
sendmail spool file?

Thanks!

Terrill


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

Date: Mon, 24 Aug 1998 08:02:46 -0700
From: Ben Pavon <ben.pavon@hsc.hac.com>
Subject: How I write the perl invocation line and deal with @INC
Message-Id: <35E18095.6EDFA5E3@hsc.hac.com>

I tried to post a response the other day to an article titled
"Trouble with perl invocation line (from Camel)". Since that was the
first
time I had posted anything (I use emacs gnus), I must have messed it up.

So here it goes again.

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

Hi,

The following article was posted back in May by Paul D. Smith:

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

OK, so I have a perl script.  But I don't know where perl will actually
be located on the system running the script.  I want to make the script
"self-starting".

So, I look in the docs and it says I can use this oh-so-clever bit:

  #!/bin/sh                                            # perl
  eval 'exec perl -S $0 ${1:"$@"}'
    if 0;

So, fine.  That seems to work... on most systems.  However, on some
systems sh doesn't like the "# perl" on the end of the first line, such
as OSF (where the interpreter line can be >32 chars long, I guess).

So, I tried adding "--" as suggested by the docs:

  #!/bin/sh --                      # perl
  eval 'exec perl -S $0 ${1:"$@"}'
    if 0;

That works on OSF and others, but doesn't work everywhere: for example,
bash doesn't seem to accept -- as a valid shell option on an interpreter

line, so on any system where bash is being used as /bin/sh the above
script won't work.

So, I decide to just take "# perl" out of there altogether:

  #!/bin/sh
  eval 'exec perl -S $0 ${1:"$@"}'
    if 0;

Now, of course, the silly thing goes into an infinite loop, because of
this bit from the docs:

     If the #! line does not contain the word "perl", the program named
     after the #! is executed instead of the Perl interpreter.  This is
     slightly bizarre, but it helps people on machines that don't do #!,

     because they can tell a program that their SHELL is /usr/bin/perl,
     and Perl will then dispatch the program to the correct interpreter
     for them.

So, the only way I was actually able to get this working reliably on all

my systems was this:

  #!/bin/sh
  #! perl
  eval 'exec perl -x -S $0 ${1:"$@"}'
    if 0;

Or, if you're an Emacs user, this works well:

  #!/bin/sh
  #! -*-perl-*-
  eval 'exec perl -x -S $0 ${1:"$@"}'
    if 0;

So far, this seems to work correctly for me on all the above types of
systems.  Just thought someone else might find this useful... or am I
missing something obvious?

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

 Paul D. Smith <psmith@baynetworks.com>         Network Management
Development
 "Please remain calm...I may be mad, but I am a professional." --Mad
Scientist
-------------------------------------------------------------------------------

     These are my opinions--Bay Networks takes no responsibility for
them.

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

I took his idea and redefined our standard perl script header to look
like this:

#!/bin/sh
#! -*-perl-*-
eval 'exec ${GNULOCAL}/bin/perl${PERLVERSION} -x -S $0 ${1+"$@"}'
    if 0;
#/----------------------------------------------------------------------------//

#/ Module: <MyModule>.pl
#/
#/ Purpose:
#/
#/   Blah blah
#/
#/ Author: <MyName>                  Date: <Month> <Day>, <Year>.
#/
#/ History:
#/  dd-mmm-yy - <Author>
#/              <Modification>
#/----------------------------------------------------------------------------//

#/----------------------------------------------------------------------------//

#/ Insure that @INC only has the default paths (no $PERLLIB,$PERL5LIB
paths).
#/ Redefine non-existent paths with the current values of $GNUSHARE,
$GNULOCAL.
#/ Define/prepend the @PERLPATH directories which contains our custom
packages.
#/----------------------------------------------------------------------------//

BEGIN
{
    @INC = splice(@INC, ($#INC - (($INC[-1] eq '.') ? 4 : 3)));
    my $path; foreach $path (@INC)
    {
        next if (-e $path);
        next if ($path =~ s|^.*/GNU/share/|$ENV{GNUSHARE}/|);
        next if ($path =~ s|^.*/GNU/local/|$ENV{GNULOCAL}/|);
    }
    @PERLPATH = ();
    foreach $path (split(':', ($ENV{PERLPATH} || join(':', map({ $_ .
'/lib/site_perl' }
        $ENV{HSCSHARE})))))
    {
        push(@PERLPATH, $path) if (-d $path);
    }
}

if (@PERLPATH) { use lib(@PERLPATH); }

#/----------------------------------------------------------------------------//

I have included the entire part of the header in case someone else might

find it useful.

Here is an explanation of what I am trying to do.

I am in charge of maintaining the GNU directories at Hughes Space &
Comm.
I currently support 4 UNIX operating systems.

  SunOS 4.1.X
  SunOS 5.X   (Solaris 2.X)
  HP-UX 9.X
  HP-UX 10.X

We have a client/server setup in which client workstations automount
software on a 'as needed' basis from 'application servers'. I defined a
schema for laying out our software in a directory structure that has
platform-dependent (designated as SHARE) as well as platform-independent

(designated as LOCAL) branches.

  /opt/GNU/share
  /opt/GNU/local

  /opt/hsc/share
  /opt/hsc/local

When I build perl or any other free software package I make sure to
split
the installation into the above two parts. For most GNU stuff this is
simply
a matter of specifying -prefix to be the SHARE directory and
-exec-prefix to
be the LOCAL directory. By doing all this I insure that space on the
application servers is conserved. For example, having only one set of
20Mb+
platform-independent emacs code.

This is our standard @INC:

  /opt/GNU/local/lib/perl5.004
  /opt/GNU/share/lib/perl5.004
  /opt/GNU/local/lib/site_perl
  /opt/GNU/share/lib/site_perl

I was responsible for defining our standard set of 'dotfiles'. These
files
define the $GNUSHARE and $GNULOCAL environment variables as well as the
$HSCSHARE and $HSCLOCAL environment variables that point to our custom
software. We keep our extensive perl module library in
$HSCSHARE/lib/site_perl.

Thus the BEGIN block above serves two purposes. It insures that if
running
on a workstation where the GNU directories are not installed properly,
the
current values of $GNUSHARE,$GNULOCAL can be used to correctly define
@INC.
It also prepends $HSCSHARE/lib/site_perl to @INC. The $PERLPATH
environment
variable is a mechanism that may be used to override this. For example,
when I am updating a module that resides in the current directory, I can

test it by defining $PERLPATH to be ${PWD}:$HSCSHARE/lib_site before I
invoke
a script that uses the module.

By the way, as a default condition, we have /bin/perl as a symbolic link
to
/opt/GNU/local/bin/perl.

One last thing. The $PERLVERSION environment variable is undefined by
default. Whenever I want to see the effect of using different versions
of
perl to run a script, I just set $PERLVERSION to the appropriate value
(e.g. 5.00404).

Hope this is helpful.

--
__END__
------------------------------------------------------------------------
  Ben Pavon 310.364.9827                         ben.pavon@hsc.hac.com
------------------------------------------------------------------------
Benny says "Do it right, do it once!"





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

Date: Mon, 24 Aug 1998 15:30:20 GMT
From: huntersean@hotmail.com
Subject: Re: Pattern match for filename extensions
Message-Id: <6rs0ud$uq9$1@nnrp1.dejanews.com>

In article <346B48D4AE18D11181FB00609762664D600DF4@atlantis.stnc.co.uk>,
  "Ryan Cook" <rcook@stnc.com> wrote:
> I am trying to work out a pattern match expression to recognise a range of
> filename extensions given filenames that are passed into the variable
> $File::Find::name from a
>
>     find(\&wanted, $directory);
>
> function call. The pattern match will reside inside the
> "wanted{ }" subroutine and needs to be able to simuultaneously match a range
> of filename extensions stored in an array such as:
>
>     @ftypes = (".txt", ".exe", ".doc", ".pl", ".bat");
>
> so that I can go something like:
>
>     if (matched) {
>             doSomethingUseful;
>             blaBlaBla;
>     }
>
>     else {
>             doSomethingElse;
>             blaBlaBla;
>     }
>
> If you know what pattern matching expression would achieve the end result
> I'm looking for then please reply to this message or Email me at
> rcook@stnc.com .
>
> Thanks,
> RYAN
>
>
If the list of filenames is going to change, you probably want something that
will build your regex on the fly, like the following:

@ftypes = qw(.txt .exe .doc .pl .bat);

#quote the metachars in @ftypes
@quoted_types = map {quotemeta $_} @ftypes;

#build the regex
for (@quoted_types) {
    $regex .= $_ . "|"
}
chop $regex;
$regex = "(?:".$regex.")";

For the list above $regex will finish as '(?:\.txt|\.exe|\.doc|\.pl|\.bat)'

You can then do

if /$regex/ {
    ...etc etc ...
}

 ... to match against $_ in the normal way.  If this is inside a loop of
filenames, you will probably want to do...

if /$regex/o {
    ...etc etc ...
}

 ...for speed purposes (otherwise perl will recompile $regex each time through
the loop.  You can use Benchmark to time the two options and confirm the
speedup.

Regards

Sean H

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Mon, 24 Aug 1998 16:10:30 +0100
From: "Bob Hannaford" <bob.hannaford@adc.metrica.co.uk>
Subject: Perl 5 and HP-UX 11
Message-Id: <903971179.18903.0.nnrp-09.c246a76e@news.demon.co.uk>

Can anybody tell me if the current version of Perl works on HP-UX 11?

If not is there any plans to port Perl to HP-UX 11?

Thanks in advance for your answers.

Bob

PS: Would you copy all replies to my personal email bobh@adc.mertica.co.uk
and to the news group.




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

Date: 24 Aug 1998 11:17:54 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Perl Bots! [Chatterbots, FAQbots, InfoBots]
Message-Id: <6rs072$qfk$1@monet.op.net>


In article <35deab01.22076162@news.netcom.ca>,
Harry McGreggor <harry@dublin.net> wrote:
>Are any of TPJ's articles online?

Mine are available at

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

>Or do I need to subscribe to the 'paper' magazine?

That is also a good idea.



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

Date: 24 Aug 1998 11:00:11 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Perl documentation
Message-Id: <6rrv5r$2ia$1@monet.op.net>


In article <35E176E8.A5CE1E84@dead.end.com>,  <no.uce@dead.mailbox.com> wrote:
>meet with all the abusive repliers at the Perl conference - James Manson?

Ah, yes, the notorious brother of Charles Manson.

He was speaking on Wednesday about the Perl interface module for the
X.25 protocol, IIRC.

>I think the prob with the "gurus"

I think the problem with you is that you're too lazy to think about
what you really mean, and that's why you end up criticizing a lot of
helpful people who don't deserve it.




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

Date: Mon, 24 Aug 1998 16:55:31 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Perl documentation
Message-Id: <Pine.HPP.3.95a.980824163754.11381E-100000@hpplus01.cern.ch>

On Mon, 24 Aug 1998 no.unsoliciteds@dead.end.com wrote:

> I think the prob with the "gurus" is that they've been at it so long
> they don't remember their own feeble beginnings, or maybe people were
> just nicer to them and didn't lay into them when they didn't
> understand something. 

You've got this entirely wrong.  I'm pretty much a newcomer to Perl, and
I had hoped to learn something here.  I very much expect to be rebuked
if I make it clear to the assembled usenauts that I'm not playing my
part in the bargain, though.  That's only fair and reasonable, to my
mind. 

Unfortunately, even after disregarding the sheet endless stream of
messages whose subject is "Question" or "HELP" or other variations on
"I'm a lamer and couldnt be helped no matter how hard anyone tried",
it's still difficult to find the substantial articles amongst the noise.
Alright, the problem with complaining about the noise is that it only
adds to the noise.  So I think I'll unsubscribe this group and go back
to the books and FAQs. 



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

Date: Mon, 24 Aug 1998 08:34:04 -0700
From: "Christian Brink" <strat@pacifier.com>
Subject: Re: Perl documentation
Message-Id: <35e189f2.0@news.pacifier.com>


[snip]
>Which means that 100% of what you filter STILL hits your server to be
>processed.  While those that munge get NONE.
[unsnip]


Except for the domain you munge to.... you may not choose a domain that
would be used, but I was
shutdown for a day due to a munged address where  someone used my domain
name. I received 1700
responses to an unknown user on my system because someone decided to munge
there address to
defeat spam. If you let your users munge I would make sure they are check
whois before they pick my
address and I prosecute.

DON'T MUNGE (especially if you're not smart enough to check whois)

P.S. The one good thing being a resident of WA is now I can prosecute
mungers on my domain!!!!






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

Date: 24 Aug 1998 09:13:16 -0600
From: snowhare@xmission.xmission.com (Snowhare)
Subject: Re: Perl FAR version 1.1.1 MAKE SURE YOU READ THIS BEFORE POSTING
Message-Id: <6rrvuc$h4p$1@xmission.xmission.com>



Nothing above this line is part of the signed message.

In article <Pine.HPP.3.95a.980824161000.11381D-100000@hpplus01.cern.ch>,
Alan J. Flavell <flavell@mail.cern.ch> wrote:
>On Sun, 23 Aug 1998 no.unsoliciteds@dead.end.com wrote:
>
>> Oh really and where is the beginners class here? I don't recall seeing a
>> comp.lang.perl.newbie news group mentioned in the FAQ - was this an omission?
>
>This suggests that you can't conceive of any other way of learning how
>to program, or the details of a particular programming language, or
>elementary problem-solving techniques, than to locate a usenet group and
>immediately start posting random questions to it, without bothering
>about the FAQ nor even taking a look at what the recent discussions were
>about. 
>

And this suggests that you can't conceive of any other approach to dealing
with newbie's reasonable questions than belittling their skills and
intelligence. They asked a _good_ question. The _appropriate_ answer was:
"There isn't one. As an alternative, I would suggest the book 'Learning
Perl' by Randal Schwartz. Or you might try starting a maillist for
beginners yourself through one of the free services available on the net." 

Construction support member. Petahertz range electromagnetic wave
perception organ.

Benjamin Franz


Version: 2.6.2

iQCVAwUBNeGDBujpikN3V52xAQHkLQQAulxV4wgxxyV17NdeR1MyjHa7qWe/pgI5
GdRFNKzpftQjj9hej/eUipLMa5T9K7eE4mqr15177j0PbVq9hN8pFDLpFlFmH4LU
/DGaTwdvvYt9Q96e7YX4Aldw1xRTd6J0+NICP02fOLYr7O8pIJZ4GmZmSSe69db8
3z9N4XrlUj8=
=Ojlr
-----END PGP SIGNATURE-----


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

Date: Mon, 24 Aug 1998 15:03:12 GMT
From: louie@visca.com (Louie)
Subject: Re: perl in Win95
Message-Id: <35e17db8.10232519@news.jet.es>

dhawker@bigfoot.com (David Hawker) wrote:

>On Mon, 24 Aug 1998 00:58:09 +0800, "James" <jameshsi@email.gcn.net.tw>
>felt the need to post:
>
>>Hi!
>>I wonder if I can execute perl script in my Win95 PC for testing perpouse,
>>then upload it to UNIX server when I tested.
>>I want to call the script from my local PC with IE 4.0 , How can I do that ?
>
>Get a MS-DOS perl port. Then get OmniHTTPD from www.omnicron.ab.ca IIRC.
>OmniHTTPD is a little webserver for windows. You should use 'localhost' or
>127.0.0.1 to access your own computer.

Apache also has a webserver for W95 (1.3.1) available at
http://www.apache.org/dist/, I believe.

I've used both Omni and Apache and the latter has more options. Also,
if your host is using Apache, you can set things up so that your PC
scripts don't have to be re-edited when you upload them. See:
http://www.visca.com/clueless/gs_perl_apache_win95.html.
>
>Sockets also work using just the perl port - get perl5.004_02 at least. But
>obviously things like forking and file locking can't be tested on your
>computer.

All the best,
Lou Hevly
Clueless Lou's Cgi Help: Aid for the Clue-Challenged
http://www.visca.com/clueless/


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

Date: Mon, 24 Aug 1998 08:53:26 GMT
From: ijg@csc.liv.ac.uk (I.J. Garlick)
Subject: Re: Perl on linux
Message-Id: <Ey6rD2.59K@csc.liv.ac.uk>

In article <6rkhuj$fkg$1@m5.stny.lrun.com>,
"Tim Gray" <tgray@smlny.com> writes:
> By default most UNIX systems do not put the current directory in your path
> for security reasons.
> Try running the script using its full path name or ./scriptname

Redhat 5.1 only follows this so far. The root user never has . appended to
path, and it is not a good idea to append it. As far as i am aware other users
created will have it appended as standard.

Guess whou is trying to run perl scripts as root then.

Do yourself a favour Kevin set up another user to play around with Perl.
Or imagine the destruction you could wreck with an inadvertant

	system (rm -rf *);

as root. :-(

Also if you connect to the web as root with the above scenario and lax
security you are just asking for a hacker to issue that command for you.

Hope that has put the fear of God into you.

> 
> Kevin Thorley wrote in message <6rk1bm$o7n@nnrp2.farm.idt.net>...
>>Hi!  I've been writing perl scripts for awhile on Win95, but recently
>>decided to install linux on my computer.  Now I can't even get a
>>simple script to run!  Perl is located at /usr/bin/perl, but when I
>>add this command as the first line of the script, it doesn't work :
>>#!/usr/bin/perl.  The error message says something like program not
>>found. When I run the following from the command line though, it works
>>great:
>>
>> /usr/bin/perl perltest.pl
>>
>>Whats going on here?  i didn't install perl myself, it came with the
>>RedHat 5.1 installation.  Any ideas?
>>
>> Kevin Thorley
>> kthor@idt.net
>>
> 
> 

-- 
--
Ian J. Garlick
ijg@csc.liv.ac.uk

Democracy is a form of government in which it is permitted to wonder
aloud what the country could do under first-class management.
                -- Senator Soaper


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

Date: 24 Aug 1998 09:29:39 -0600
From: Nathan Torkington <gnat@frii.com>
Subject: Re: Q: Sliding Window Sort With Perl?
Message-Id: <5q1zq6bdp8.fsf@prometheus.frii.com>

mjd@op.net (Mark-Jason Dominus) writes:
> All that said, I wonder if it might be better to code an insertion
> sort than to use Perl's built-in sort here.  The built-in sort is
> usually `qsort', which has pathological running time when the records
> are already almost sorted, as they are here;

I believe this is system dependent, and not the case in 5.005_02.  If
you're running 5.004 or earlier, then you'll be using your system's C
library qsort().  My system (FreeBSD 2.2.6) says that qsort() uses
median selection to avoid worst-case behaviour.  If you're using 5.005
or later, then you're using the qsort() that comes with Perl and I
believe that Perl's qsort() goes to great lengths to be smart about
such things.

The qsort() in 5.005 is well worth reading.  It's one of the few parts
of the Perl source code that is heavily commented, and it's
enlightening and informative.  You can find it in pp_ctl.c by
searching for "Tom Horsley".

Cheers;

Nat


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

Date: Mon, 24 Aug 1998 09:04:58 GMT
From: ijg@csc.liv.ac.uk (I.J. Garlick)
To: "DesQuite" <desquite@hotmail.com>
Subject: Re: Reading From File
Message-Id: <Ey6rwA.5w9@csc.liv.ac.uk>

[Posted and mailed]

In article <U8lD1.9$YI.2922138@news.asheboro.com>,
"DesQuite" <desquite@hotmail.com> writes:
> Ok, sorry to keep troubling some of you.  I've received responses to my
> other messages and I'm very grateful.  I've had troubles with the code given
> to me b/c I don't think I explained exactly what I needed.  But I did get
> what I asked for.
> 
> I'm writing to a file that has 3 different sections.  I've put a header like
> section1, section2, etc. at the beginning of each change of section.  I need
> the sections to be stored in different variables as a word list probably b/c
> here's what I've done.
> 
> section1
> text
> text
> section2
> text1[]text2[]text3[]
> text4[]text5[]text6[]
> section3
> text1[]text2[]text3[]
> 
> I can split section2 & 3 if I can just read it back from the file correctly.
> I have a loop that makes a table in html format with each text part of
> section2 &3 in a cell after I read all of the values in.  I can't quite tell
> the computer to read back the values in a way I can manipulate them.  Please
> help if you can.  Thanks for your help everyone.  I appreciate all of your
> patience with all of us less experienced programmers.

There is a thread running currently entitled 'Reading from files' started
by 'jkghins <jkghins@highpoint.net>', is that you?

If not then I suggest you have a quick search on deja-news for it as I have
posted 90% of the answer there.

HTH (TQT).

-- 
--
Ian J. Garlick
ijg@csc.liv.ac.uk

Democracy is a form of government in which it is permitted to wonder
aloud what the country could do under first-class management.
                -- Senator Soaper


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

Date: Mon, 24 Aug 1998 08:38:48 GMT
From: ijg@csc.liv.ac.uk (I.J. Garlick)
Subject: Re: Reading from files
Message-Id: <Ey6qoo.4Iy@csc.liv.ac.uk>

In article <1de4udr.1dy3uvt1hoahj4N@bay2-20.quincy.ziplink.net>,
rjk@coos.dartmouth.edu (Ronald J Kimball) writes:
> I.J. Garlick <ijg@csc.liv.ac.uk> wrote:
> 
>> Ok Ok. I never put a die there, I know I should but I never do. This was
>> supposed to only give the relevant bit, I wasn't going to the trouble of
>> writing a complete script. :-)
smiley should hace gone here  ^^^
> 
> My point was just that you could have put the die there, instead of a
> comment saying you should put the die there.  :-)
> I hope you didn't take it as a criticism, it was just an observation of
> something amusing.
> 

I did realise this, and I did get the joke. I think I missed a smiley above.

-- 
--
Ian J. Garlick
ijg@csc.liv.ac.uk

Democracy is a form of government in which it is permitted to wonder
aloud what the country could do under first-class management.
                -- Senator Soaper


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

Date: 24 Aug 1998 11:32:16 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: regex question: striphtml and misformed tags
Message-Id: <6rs120$guv$1@monet.op.net>

In article <6rk7re$d9s$1@client3.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
>Too bad there isn't an operator that says: be as greedy as you can, and
>*never* give back what you once took.

Someone, Friedl I think, suggested a \X operator which would cause the
regex engine to forget all its saved state, so that it couldn't
backtrack past the \X.  There is precedent for this; SNOBOL has a
FENCE operator which is substantially similar.



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

Date: Mon, 24 Aug 1998 11:28:27 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Why dont people read the FAQs
Message-Id: <fl_aggie-2408981128270001@aggie.coaps.fsu.edu>

In article <35e2eabb.135535060@news.mmc.org>, drummj@mail.mmc.org wrote:

+ Sigh. Pointlessly combatative and (unfortunately) predictable. I guess I
+ should thank you for so tidily reinforcing my point.

Burnore can be safely ignored.

James


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

Date: Mon, 24 Aug 1998 11:29:23 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Why dont people read the FAQs
Message-Id: <fl_aggie-2408981129230001@aggie.coaps.fsu.edu>

In article <35DF85E3.4CA781E7@erols.com>, "Matthew O. Persico"
<mpersico@erols.com> wrote:

+ Gary L. Burnore wrote:
+ > 
+ > On Mon, 17 Aug 1998 20:23:08 +0100, in article
+ > <ant171908b49Rr9i@waveney.demon.co.uk>, Richard Proctor
+ > <Richard@waveney.demon.co.uk> wrote:
+ > 
+ 
+ > >7) A lot of postings come to clp.misc that are really about servers
and cgi,
+ > >this represents a major use of perl and results from people looking here
+ > >because of the perl content, maybe there should be a clp.cgi?
+ > 
+ > DingDingDingDing.  Now this makes sense.  Great idea.

+ I'll second that. If I get a few minutes to breathe around here, I'll try to 
+ locate the "How to start a new newsgroup" docs and see what I can do.

Why?

What's wrong with comp.infosystems.www.authoring.cgi?

James


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

Date: Mon, 24 Aug 1998 15:49:07 +0100
From: Simon Wistow <simon@new-mediacom.com>
Subject: Writing a moduleless Web client
Message-Id: <645CAC0140CED111AF1500805FEDDB8AA8A2@ns.new-mediacom.co.uk>

I'm trying to write a script that will grab a web page off a server

So far it'll connect to port 80 and print the "GET / HTTP/1.0\n\n"
request but then when I say something like


$a=<S>; 		             # ignore the fact that there will
be more than one line coming through
print "done\n";

it never prints done.

Why so?


Can anyone help with this? I have my reasons for not using any modules
 ... I know that something like

use LWP::Simple;
my $content = get("http://www.whatever.com/");

would be really easy.







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

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


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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