[12530] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6130 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 25 18:07:22 1999

Date: Fri, 25 Jun 99 15:00:18 -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           Fri, 25 Jun 1999     Volume: 8 Number: 6130

Today's topics:
    Re: alphabetical sorting <rootbeer@redcat.com>
    Re: Beginner's Question <upsetter@ziplink.net>
    Re: CGI.pm: submit + image? <gellyfish@gellyfish.com>
        creating multipart output to browser from Net::POP3 <i_tel@my-deja.com>
        Don't really want to reinvent a wheel... <gaedtech@earthlink.net>
    Re: formatting text in email owlswell@my-deja.com
    Re: Getting SIGALARM to break a blocked connect(), help <rootbeer@redcat.com>
    Re: HELP: Can't delete ONE stinking file with Unlink! <rootbeer@redcat.com>
    Re: HELP: Fast file Concatenation <rootbeer@redcat.com>
    Re: how to make nested quotes? <rootbeer@redcat.com>
    Re: is there any perlscript for client-side scripting? <gellyfish@gellyfish.com>
    Re: Kicking off remote program <carvdawg@patriot.net>
    Re: Network admin <carvdawg@patriot.net>
    Re: Newbie - Using Perl & Digital Teamlinks <cassell@mail.cor.epa.gov>
    Re: should be how to remove ^M from middle of variable? (Philip 'Yes, that's my address' Newton)
    Re: syntax check without execution <cassell@mail.cor.epa.gov>
    Re: validating a regexp from a CGI form <rootbeer@redcat.com>
    Re: Viral matters [completely off-topic] <dbc@tc.fluke.com>
    Re: Viral matters [completely off-topic] (Philip 'Yes, that's my address' Newton)
    Re: Why do we like Perl? <cassell@mail.cor.epa.gov>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 25 Jun 1999 14:02:48 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: alphabetical sorting
Message-Id: <Pine.GSO.4.02A.9906251401330.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999, Aaron Walker wrote:

> How would I go about sorting the data file and then putting each
> member name under the appropriate anchor?

Once your list is sorted, this is easy. Output the list of items one at a
time. If the name starts with a new letter, put the header out first.

Cheers!

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



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

Date: Fri, 25 Jun 1999 21:25:42 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Beginner's Question
Message-Id: <qtSc3.295$Of3.65598@news.shore.net>

Erik Denkers <edenkers@ktis.net> wrote:
: Array --- @myarray = (1,2,3)

: Reference --- $myref = [1,2,3]

: What is the difference, both contain same data, no?

The reason (or a reason) to create a reference is to be able to use an
array or hash in a place where you would normally only be able to use a
scalar: as multiple arguments to a subroutine, for instance, or as members
of another array or hash. Most of the time, when I use references in my
code, it's as an anonymous reference in a hash of hash or list of lists or
some sort of "multidimensional array". In the Camel and Llama books, most
of the beginning examples are of references being stored in scalars
(things named $arrayref and such), but in practice, I find I use anonymous
references around 5-10 times as often as named references.

One of the things I love about perl is the way it lets you "attach" data
to other data. If you have a hash or array in your program (maybe a list
of files in a directory or something), you can easily attach "attributes"
to each item at any point by just creating a hash whose key is the item
from the previous list and whose value is a reference to the additional
information you're trying to store on that item (usually a hash, sometimes
an array). Perl makes stuff like this ridiculously easy.

: I think I understand about complex data structures, just not 100%,
: maybe after start writing some code with this need I will understand
: better, maybe I've just got some unlearning to do.

When you "get it," you'll wonder how you ever lived without them. :)

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


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

Date: 25 Jun 1999 21:27:32 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: CGI.pm: submit + image?
Message-Id: <7l0s84$ke$1@gellyfish.btinternet.com>

On 25 Jun 1999 05:41:41 GMT Peter Bismuti wrote:
> Martin Quensel (martin@adoma.se) wrote:
> : 
> : Peter Bismuti skrev i meddelandet <7kkd7r$838$1@news.fsu.edu>...
> : >I would like to use the submit function that display an image instead of
> : >the standard button and label.  I do NOT mean an image_button, which does
> : >not allow you to pass back a value with the name, just the coordinates
> : >where you clicked on the image.  I want it to behave *exactly* like a
> : regular
> : >submit button just with an image displayed instead of the normal labeled
> : >button.  Can this be done?  If not this is a major oversite
> : in...CGI?...CGI.pm?
> : 
<snip>
> : 
> : There are a lot of HTML newsgroups out there, if you ask your question there
> : you will have a higher chance of getting a soloution for your problem.
> : I am not that good at HTML, if i where i would have ansvered you, even if
> : you did post in the wrong newsgroup.
> : 
> 
> This is very much a Perl questions, it is a CGI.pm question, are you
> familiar with CGI.pm?    
> 

You are wrong.  This is not a question about CGI.pm, it is not even a 
question about the CGI at all - it is a question about the capabilities
of HTML - I would however be interested to hear your reasoning that it
might be anything other than that.

> Now I have a question for you, when are you going to get a life, you loser?
> 

Er sorry ...  Under normal circumstances I would have gone straight for
the ^K but as I would like to read some explanation from you here I didnt.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Fri, 25 Jun 1999 20:56:29 GMT
From: hojo <i_tel@my-deja.com>
Subject: creating multipart output to browser from Net::POP3
Message-Id: <7l0qdm$feo$1@nnrp1.deja.com>

This concerns both Apache and perl.  I do not know much about generating
and displaying multipart contents to the browser.  I am interfacing a
unix mail folder and creating a web interface just like hotmail has.
However, I don't know how to first stream out text/html and then display
an atachment image/gif.  I have this bit of code that almost works.
I need help with specificying the headers, and getting the data to the
browser.  any help/suggestions are welcome (needed).

the code reads through the mail message (already attained with
net::pop3) and looks for the first content-type occurance.  Then it
streams the content type out and then the following lines.  However, it
will go through a messate, print the text, then overwrite the text with
the image or whatever comes next.
Code:
 ...
my $j=0;
for $line (@$message){
        if ($line =~ /^Content-Type/) {
                $j = 1;
        }
        if ($j == 1){
                if ($line =~ /^Content-Type/) {
                        $line =~ s/^Content-Type: //;
                        chop $line;
                        # $r is the Apache request object
                        $r->send_http_header($line);
                }else{
                        print "$line";
                }
        }
}

--
=-=-=-=-=-=-=-=-=-=
David Hajoglou
Sys. Admin., Abbreviator
=-=-=-=-=-=-=-=-=-=


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 25 Jun 1999 14:26:11 -0700
From: M <gaedtech@earthlink.net>
Subject: Don't really want to reinvent a wheel...
Message-Id: <3773F3F3.B5672C78@earthlink.net>

 ... or in this case reinvent a maintenance log...

I am trying to help automate the logging procedure for
some equipment maintenance at a friend's company, and
I can't believe that I have to reinvent the wheel to
do it...  I'm looking for a pointer to an existing 
script that does the following, or something close to
it so that I can modify it...

Note that I'm NOT asking somebody to write this script
for me, I'm just asking for a pointer to something 
I can use or modify...

Problem description:

They have a intranet web page (html) that lists the equipment,
with a link to each piece of equipment.  Bringing up that 
page displays a text block at the top identifying the 
equipment (make/model/etc.), along with where it is,
what department is responsible for it, etc.
Below that I want to have log entries appear, with the 
most recent at the top.

I'm trying to get a simple script to work that will
put up a form requesting a email name and a 
text block, like this:

+--------------------------------------
! Mechanic name:
!    [xxxxxxxxxxxxxxxxxxxxxxxx
!
! Description of work performed:
![
![
![
![
!...etc

The script will then open a file that is in a directory 
named 'status' (the file name is hard coded in the config 
area of the script), search for a marker in the file 
(perhaps '<<insert here>>') insert the current date and time
(preferrably in dd-mmm-yyyy format), the mechanic's name, 
a blank line, the text for the work performed, and make sure 
that the entry is bracketed by a single blank lines top and 
bottom (i.e. if the mechanic put 10 blank lines at the bottom 
or top of the message just to be funny, they are truncated to one).
And place a new 'insert' marker in the file at the right place.

Any ideas?


Lastly, Is there a convenient way to determine the last-changed-date
of a given equipment file (so it can be displayed on the top-level 
equipment list page)?

Mike Morris
gaedtechTHIS@earthlink.net      <--- remove THIS to email me...



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

Date: Fri, 25 Jun 1999 21:29:19 GMT
From: owlswell@my-deja.com
Subject: Re: formatting text in email
Message-Id: <7l0sb3$g49$1@nnrp1.deja.com>

Eric and Tom, thanks for your help. I'm not tied to formats, but the
message has to be text/plain. If you have any ideas, I'm open to
suggestions.

In using formats, I have run into a problem. I can work around it, but
I'd like to know what I'm doing wrong.

I have a multi-line text field to print so I want to use the '^'
(caret) and '~~' (double tilde), like so:

   DESCRIPTION: ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~

This, of course, prints 'DESCRIPTION:' on every line. I have tried a
lot of different variations trying to separate the heading from the
field text to no avail. The only way I can get it to print the way I
want it is to do a separate print for each of these multi-line fields:

<snip>

@fields=($user_name,
	$email,
	$phone,$fax,
	$mail_1,
	$mail_2,
	$city,$state,$zip,
	$country,
	$subject);

@fields2=($description);

@fields3=($sources,$share);

#####################
#  print the top part
#

$str = swrite(<<'END', @fields);

---------------------------------------------------------------
NAME:               @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

E-MAIL:             @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

PHONE:              @<<<<<<<<<<<<<<    FAX:  @<<<<<<<<<<<<<<

ADDRESS:            @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
~                   @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                    @<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<< @<<<<<<<<<
~                   @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

SUBJECT:            @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

DESCRIPTION:
END

  print $str;

########################
# print the description
#

$str = swrite(<<'END2', @fields2);
                    ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~

SOURCES CONSULTED:
END2

  print $str;

###########################################
# print the end - no more multi-line fields
#

$str = swrite(<<'END3', @fields3);
                    ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~

SHARE MY NAME:      @<<<
---------------------------------------------------------------

END3

  print $str;

# end printing
#######
#
# subs
#

sub swrite
{
    croak "usage: swrite PICTURE ARGS" unless @_;
    my $format = shift;
    $^A = "";
    formline($format,@_);
    return $^A;
}

<end snip>

What do I have to do to avoid all this?

Thanks again for your help.

Virginia


In article <37731213@cs.colorado.edu>,
  tchrist@mox.perl.com (Tom Christiansen) wrote:
>      [courtesy cc of this posting mailed to cited author]
>
> In comp.lang.perl.misc,
>     ebohlman@netcom.com (Eric Bohlman) writes:
> :The section of perlfaq5 entitled "How can I write() into a string"
should
> :clear up your confusion.
>
> Perhaps.  Or perhaps perlform will help.  Then again, maybe it won't.
> Formats aren't the best answer to all problems.  Just to some.
>
> --tom
> --
> The reductionist approach has its place, as does the holistic
approach.
> Render therefore unto Unix the things which are Unix's, and unto Perl
> the things that are Perl's.  :-)  Larry Wall in
<1994Nov10.185030.16615@netlabs.com>
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 25 Jun 1999 14:25:47 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Getting SIGALARM to break a blocked connect(), help!
Message-Id: <Pine.GSO.4.02A.9906251418081.6929-100000@user2.teleport.com>

On 25 Jun 1999, Peter Leonard wrote:

> Newsgroups: comp.lang.perl, comp.lang.perl.misc

If your news administrator still carries comp.lang.perl, please let him
or her know that that newsgroup has not existed since 1995. If you
have such an outdated newsgroup listing, you are probably missing out
on many other valid newsgroups as well. You'll be doing yourself and
many others a favor to use only comp.lang.perl.misc (and other valid
Perl newsgroups) instead.

>     local $SIG{ALRM} = "print STDDERR 'SIGALARM on $site\n'";

Are you sure that's doing what you want? I can see at least two problems
with it. (Perl should be doing something when the alarm goes off, even if
it's not doing what you wanted.)

>   What I was hoping for was that if it got stuck in connect(), the
> alarm would go off,

Of course, it's important to give the connection enough time to take
place. I don't think that one second is sufficient.

Good luck with Perl!

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



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

Date: Fri, 25 Jun 1999 14:31:26 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: HELP: Can't delete ONE stinking file with Unlink!
Message-Id: <Pine.GSO.4.02A.9906251428280.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999 roberthp@my-deja.com wrote:

> I think I'm in the right directory.... 

You should be more certain than that before you delete a file!

> What confuses me about this is why I can open and get a directory
> listing but can't do the deletion of a file I'm listing as resident in
> the directory;

If you're examining the return value from unlink (and the $! variable,
when appropriate) you will not be so confused for so long.

> Speaking of documentation, I have about 6 books on Perl and not one of
> them says explicitly that I have to chdir to a directory in order to
> delete a file from it,

 ...which is good, since you don't have to. But you do have to give the
correct (relative) pathname. If you say you want to delete the file
'fred', that's 'fred' in the current directory. 

Cheers!

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



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

Date: Fri, 25 Jun 1999 14:17:05 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: HELP: Fast file Concatenation
Message-Id: <Pine.GSO.4.02A.9906251405080.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999 kgentes@gentek.net wrote:

> I searched through Perl books and this newsgroup to find the fastest
> way to concatenate files, but didn't find any information on
> performance of the various methods.  I ran some of them on my local
> machine, but didn't see much difference.

Why would you think there would be much difference? I'd suspect that the
bulk of the time will be spent in I/O operations anyway, so there's not a
whole lot that your algorithm is going to do to speed that up, although a
really poor algorithm could slow it down.

> open(FILE1, "<$filename1");

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.

> I am going to be concatenating 3 files at a time into a single file.  
> Each file is about 20k (obviously making a single 60k file from each
> group of three).

You should probably choose a blocksize constant (say, 8192 bytes) and use
read() on chunks of that size, writing each chunk out (with print) as you
go. 

> I will need to process about 20 concatenations per second to stay up
> with the data on a maxxed out system.

And what happens if your program doesn't get enough timeslices and falls
behind?

Good luck with it!

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



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

Date: Fri, 25 Jun 1999 14:39:55 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: how to make nested quotes?
Message-Id: <Pine.GSO.4.02A.9906251437560.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999, Bin Zeng wrote:

> What I need is a nested quote, i.e. I what this works:
> qq? whatever qq# here # is?
> 
> I hope you know what I want but the above doesn't work.

It's not clear to me what you want. Do you want to produce two strings
from one set of quotes? Do you want to include quote marks within a
double-quoted string? Something else?

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



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

Date: 25 Jun 1999 21:42:00 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: is there any perlscript for client-side scripting?
Message-Id: <7l0t38$kk$1@gellyfish.btinternet.com>

On Mon, 21 Jun 1999 15:39:13 -0700 TRG Software : Tim Greer wrote:
> smnayeem@my-deja.com wrote:
>> 
>> Does anyone know where i can find some documentation on perlscripts, is
>> it going to be a good scripting language for doing client side
>> scripting? so that i wont have to wait about javascript or vbscript, and
>> not to mention be restricted to their limited vocabulary :(
>> thanks
>> 
> PerlScript on the client-side? I haven't heard anything about that. 

Yeah you can do that ... With the Microsoft scripting engine there is
basically little difference betweeen a Scripting Provider that will
run on the Client side or on the server side ... If it wasnt Microsoft
I might even be lured into thinking it was quite a nice idea.  Try out
some of the IE examples that come with the Activestate Distribution.

Of course, yes, if you insist on using this then you are going to have
to get all of your potential audience to use a particular browser and
to download and install Activestates distribution.  


/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Fri, 25 Jun 1999 17:29:31 +0100
From: Marquis de Carvdawg <carvdawg@patriot.net>
Subject: Re: Kicking off remote program
Message-Id: <3773AE6B.9DA93551@patriot.net>

I see a couple of ways to do this...

1.  Run it as an AT job.  Have your machine access the Schedule service
on the remote machine, and run the job.  The job would complete with
the output to a file, and your script would just keep looking for the file.
Once the file is found, read it, and delete it.

2.  Write a small script that listens on a port, and accepts commands...
sort of like your own little NetBus.  Install this as a service on the target
machine (you'll have to install Perl, as well).  Then, you can connect to the
port, issue your command, and the results will be returned to you...

Hope this helps.

> I want to be able to kick off either a .bat job or .pl program from one NT
> server to another (also WinNT). The far end is complete (checks if tape
> drive is empty using a utility that MUST run on the far server from the
> command line. I MUST be able to kick it off from the local server at various
> (different)_ times and can't leave a mess of AT jobs. The next project is
> something similar, but to run an existing utility to check the status of
> each drive in a Raid5 array (also runs from the command line on the remote
> server).
>





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

Date: Fri, 25 Jun 1999 17:22:06 +0100
From: Marquis de Carvdawg <carvdawg@patriot.net>
Subject: Re: Network admin
Message-Id: <3773ACAE.45CAFEB9@patriot.net>

> How can I retrieve information from my domain members? I need to find out
> Service Pack #, CPU type, RAM, Server description.
> I'm using NT Resource kit tools like SrvInfo and WinMSDP.
> Please help!!

I've written code that does this as part of an application for my company.
I can't give you the code, but if you can send you some code that will do
these things for you.

I saw Dave's response to you regarding Win32::AdminMisc.  Interesting
response...mostly b/c the current documentation doesn't say anything about
running the functions for CPUInfo() and GetMemory() remotely.  If you
really do need those, you would likely have to (a) load Perl on all machines,

(b) write an agent script in Perl using Win32::AdminMisc, and (c) run that
script as a service.  That service would then listen for connections and dump

the information that you want...much like port 15 on an AIX machine.  But I
digress...

If you'd like me to send you some code, tell me roughly those items that
you need and I'll send it to you...

Carv




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

Date: Fri, 25 Jun 1999 14:27:37 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Newbie - Using Perl & Digital Teamlinks
Message-Id: <3773F449.4AD586EF@mail.cor.epa.gov>

Darren Millin wrote:
> 
> I am trying to write a script that will allow me to send e-mail to
> accounts on held on a Digital Teamlinks system. As far as
> i am aware, this system uses x400 mail. Can anyone give
> me some pointers to resources, modules or docs that would
> help ?
> 
> I have looked throught the FAQ's, CPAN, RFC's and 'Learning Perl'.
> These cover the use SMTP and sendmail, but I did not see
> anything on linking to any e-mail system other than
> POP & SMTP.

I must be missing something.  You say that you want to send
e-mail to those accounts.  Even if they are using X.400, you
should be able to send them e-mail the same way you send e-mail
to anyone else.  You'll just have to get the addressing correct
in your To: line.  And if they're all on a single Teamlinks
system, then won't they all have identical ADMD and PRMD
values in that format?  So you won't have to do any substitutions
in that part of the address string.

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


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

Date: Fri, 25 Jun 1999 21:07:27 GMT
From: nospam.newton@gmx.net (Philip 'Yes, that's my address' Newton)
Subject: Re: should be how to remove ^M from middle of variable?
Message-Id: <377384c1.69018554@news.nikoma.de>

On Fri, 25 Jun 1999 01:23:57 GMT, Kazuma <kazuma@my-deja.com> wrote:

>To be sure, I would do:
>
>$val =~ s/\r//g;       # remove ^M, the var is now 'unix like'
>$val =~ s/\n/ /g;      # subsitute newline with space

Again, tr is probably what you want. For example, tr/\r\n/ /s; Ask
Larry R. why.

>this because if the variable is generated by a 'dos' browser, it has
>\r\n, while if is generated by a unix system it has only \n.
>
>$val =~ s/\r\n/ /g;    # will only work with 'dos' browsers
>$val =~ s/\n/ /g;      # will only work with 'unix' browsers

You *do* know about the ? flag, don't you? (As in \r?\n)

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.net>


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

Date: Fri, 25 Jun 1999 14:22:15 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: syntax check without execution
Message-Id: <3773F307.A2580DD8@mail.cor.epa.gov>

Bart Lateur wrote:
> [snip]
>         if(`$^X -c $file 2>&1` =~ "syntax OK") { ... }
> 
> (not on a PC though... not unless "2>&1" works.)

It doesn't with the M$ command.com running.  But there are
shells which run on PCs which will grok that (or something
morally equivalent).  4NT comes to mind first...

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


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

Date: Fri, 25 Jun 1999 14:47:23 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: validating a regexp from a CGI form
Message-Id: <Pine.GSO.4.02A.9906251441340.6929-100000@user2.teleport.com>

On 25 Jun 1999, John Siracusa wrote:

> Tom Phoenix <rootbeer@redcat.com> wrote:
> >> Is there a reason you've got the empty string and =~ in there?
> 
> > Yes. :-)
> 
> ...and that would be...?

Actually, two reasons. 

Without the binding operator, the pattern would run against $_ by default.
Since that may be undef, that could cause a warning.

A pattern should finish most quickly when checking against the empty
string. Since we don't care about whether it matched, but only that it
compiled, the empty string is the best possible choice.

Cheers!

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



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

Date: Fri, 25 Jun 1999 13:58:56 -0700
From: Dan Carson <dbc@tc.fluke.com>
Subject: Re: Viral matters [completely off-topic]
Message-Id: <Pine.LNX.3.95.990625132506.1451B-100000@dbc-pc>

On 24 Jun 1999, Dale Henderson wrote:

>      I am very aware of why there are few to no virus written for Unix
>      systems. It is because it would be impractical. As I've said
>      before, the only way to do any real damage on a Unix box is with
>      root access. And the practicality of hacking root in a virus is
>      nil. 

Unfortunately, "hacking root" is getting more practical all the time.  For
some reason, some people want Linux to "compete" with Microsoft.  So in the
interest of making Linux "easy to use", the Standard Operating Procedure
is becoming:

1.  Download anything you see on the net with a '.rpm' extension.

2.  su root.

3.  Type rpm -whatever.

4.  Voila!  Something happened!  I have no idea what, but whatever it was,
    it ran as root!

Now maybe /bin/ls is suid root and does something in addition to the
standard functionality.

Am I just being paranoid?


-Dan



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

Date: Fri, 25 Jun 1999 21:07:29 GMT
From: nospam.newton@gmx.net (Philip 'Yes, that's my address' Newton)
Subject: Re: Viral matters [completely off-topic]
Message-Id: <3773eecc.96169118@news.nikoma.de>

On Fri, 25 Jun 1999 10:38:44 -0700, David Cassell
<cassell@mail.cor.epa.gov> wrote:

>Philip 'Yes, that's my address' Newton wrote:
>>
>> Don't dare. For one, I've never seen any code directly[1] and can't
>> comment on the quality -- I've just gained the strong impression (from
>> reading this newsgroup) that the quality is not very good.
>>
>> [1] Except, of course, for "How to misparse a CGI query string", again
>> and again.
>
>And the 'how to totally munge date info returned from localtime()'
>bit, which I think Jonathan posted from Matt's wwwboard script.
>
>And the get_date [dys]function.

Hmm, don't remember those. But then, I don't read every post on clpm
in my Copious Free Time.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.net>


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

Date: Fri, 25 Jun 1999 14:53:02 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Why do we like Perl?
Message-Id: <3773FA3E.C6AE9607@mail.cor.epa.gov>

Chance Harris wrote:
> [snip]
> What I didn't like about it (and still don't):
> 
> Seems to get used for wrong things by people who like it.
> Something starts out as a perl prototype (seems perfect for
> that!).But then three years later its a big glob of brittle
> perl crap, that just doesn't freakin work, and can't be fixed
> either. This can't be blamed completely on the language, but
> perl and the people who love it seem to encourage it.

But that's a problem with *all* languages.  Actually, the
gurus and Perl Gods encourage structured programming and
modularity and code re-use.  It's not the fault of the language
that people who would never dream of writing a C++ program
without learning the language first are perfectly willing to
do this with Perl.  It's something about the pervasiveness
of Perl in many areas like systems admin, CGI, ....

This newsgroup has decried several such messes, including
some of the more popular web scripts.  Look inside the Perl
modules: you'll see clean, elegant, maintainable code.
*That's* what Perl code should be.
 
> Unneeded redundancy. I might get my head bit off for this.
> If there are two really different ways of doing the same thing,
> thats fine. Language support that amounts to nothing but
> syntactic sugar for 50 ways to _express_ doing the "real" same thing
> doesn't accomplish anything except allowing people to write obtuse
> code, and make me waste my time learning lots of syntax for stuff
> I already understand and have syntax for. This is a vague criticism,
> I know, so don't take it personally anybody out there.

I *love* this.  But then, I like APL.  And statistics.

What's wrong with having four different loop constructs?
Seriously.  I like having the loop I want for the case I have.
Having to wiggle around this for those ultra-orthogonal
languages is just a royal pain, and leads to ugly kludges
which *do* cause unmanageable code down the line.

> [snip of reasons why he likes it, because we all agree here]

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


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

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


Administrivia:

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

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

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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