[8663] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2280 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 9 09:18:50 1998

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

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

Today's topics:
        [Q] How to extract a line at a time from a $string <schan_ca@rocketmail.com>
    Re: [Q] How to extract a line at a time from a $string <dcameron@nospam.bcs.org.uk>
    Re: A puzzling problem <qdtcall@esb.ericsson.se>
        ANNOUNCE: Apache::SSIChain (Honza Pazdziora)
        ANNOUNCE: Math::MagicSquare 1.30 module <pivari@geocities.com>
    Re: Bill Gates should be invited to O'Reilly's "Free So (Bart Lateur)
    Re: Bill Gates should be invited to O'Reilly's "Free So (Stefaan A Eeckels)
    Re: FAQ question (Louie)
        Generating Password from Username in Perl ? (Heggie)
    Re: greediness problem matching date expressions? help <rjk@coos.dartmouth.edu>
        Help with S/$var/val/ problem <lwoolsey@innovative.ca>
    Re: Obfuscated Perl: figure this one out (Excession)
        Optimization regexp/list for string search herve_debar@hotmail.com
        OS/2 and Perl? <sbarnum@zoo.uvm.edu>
    Re: perl win 32 :  asterisk on command line (Excession)
    Re: perl win 32 :  asterisk on command line (Jeffrey R. Drumm)
        Perl.exe <TBennett@rnib.org.uk>
    Re: PID, fork(), exec() question again... <qdtcall@esb.ericsson.se>
    Re: RMS should be invited to O'Reilly's "Free Software  (Kenneth P. Turvey)
    Re: s/PATTERN/<how to concat here>/g <mibarnes@mail.vth.vt.edu>
    Re: scanf substitute in perl <rjk@coos.dartmouth.edu>
    Re: Simple Unix Question,  ( Simple for you maybe ) <rjk@coos.dartmouth.edu>
    Re: Strange "Modification of a read-only value attempte <rjk@coos.dartmouth.edu>
    Re: Tail-like functionality (Kuma)
    Re: Why am I getting this regexp error? <rjk@coos.dartmouth.edu>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 09 Apr 1998 07:22:34 GMT
From: "Stephen_Chan" <schan_ca@rocketmail.com>
Subject: [Q] How to extract a line at a time from a $string
Message-Id: <01bd6388$14836760$4bf8aecc@direct.ca.direct.ca>

Hello:

I have a problem regarding extracting a line at a time
from a string.

$mystring="line 1\nline 2\nline 3\n";   # and so on.

Now I need to iterate through "$mystring" one line
at a time, sort of speak, so that I get:

line 1\n     # I have code to do some other stuff then get line 2
line 2\n     # I have code to do some other stuff then get line 3
line 3\n     # I have code to do some other stuff then get the next line
and so on

any help is appreciated.
Thanks
Stephen


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

Date: 9 Apr 1998 09:39:56 GMT
From: "Duncan Cameron" <dcameron@nospam.bcs.org.uk>
Subject: Re: [Q] How to extract a line at a time from a $string
Message-Id: <01bd639b$569f40c0$0d3463c3@dns.btinternet.com>

Stephen

You want to use the /g modifier of the matching operator.  Try this:

$mystring = "line 1\nline 2\nline 3\n"; 
while ($mystring =~ /(.*\n)/g) {
	$part = $1;
	print $part;
}

Or this:

@part = ($mystring =~ /.*\n/g);
print @part;

In both cases the match is on any character (except \n) followed by \n.  In
scalar context the /g modifier makes Perl iterate through the string
finding all matches, returning true and then false at the end.  In list
context it returns a list of the matched substrings.  Note that there is no
need to make the quantifier 'ungreedy' or to use the /m or /s modifiers,
but those may be useful in other contexts.

Try reading perlop and perlre to understand more about this.

HTH

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

Stephen_Chan <schan_ca@rocketmail.com> wrote in article
<01bd6388$14836760$4bf8aecc@direct.ca.direct.ca>...
> I have a problem regarding extracting a line at a time
> from a string.
[snip]


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

Date: 09 Apr 1998 10:27:31 +0200
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: A puzzling problem
Message-Id: <isiuoj1jt8.fsf@godzilla.kiere.ericsson.se>

schipper@morgan.ucs.mun.ca (W Schipper) writes:

> A bit tricky for a novice, but fun, and I learned more about Perl
> and the Camel book than I thought possible, or possibly even wise.

It's easy for novice and expert alike, if you take advantage of the
work Graham Barr has already done for you. Have a look at the
Mail::Header module. I can't really comment on the code and example
data you post, since somehting seems to have mutilated the example
data (it your mail headers really look like that, they are *very*
broken!). 

> A number of headers (most notoriously the ones that begin "Received:
> ..." are followed by several additional lines that begin with a tab
> or a series of spaces to look like indents.

That's the normal RFC822 line-continuation method. Having a good look
at the RFC before trying to parse data according to it will very
likely make you job easier.
-- 
		    Calle Dybedahl, UNIX Sysadmin
       qdtcall@esavionics.se  http://www.lysator.liu.se/~calle/


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

Date: Thu, 9 Apr 1998 12:19:32 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: ANNOUNCE: Apache::SSIChain
Message-Id: <adelton.892124372@nemesis>

[ This post is for people who know what a stacked handler in mod_perl is. ]

Hello, 

The URL

    http://www.fi.muni.cz/~adelton/perl/Apache-OutputChain-0.04.tar.gz

has entered CPAN as

  file: $CPAN/authors/id/JANPAZ/Apache-OutputChain-0.04.tar.gz
  size: 3466 bytes
   md5: 98cf596653a07b7737e9c3da0dbca00f

The new thing is the Apache::SSIChain module. It joins the
functionality of Apache::SSI and Apache::OutputChain to make a module
that takes previous output and filters it to something new (expands
SSI's). If you put

	<Files *.html>
	SetHandler perl-script
	PerlHandler Apache::OutputChain Apache::SSIChain Apache::PassHtml
	</Files>

to your conf/access.conf, your htmls will be parsed using this module.
You can check that it works using for example test.html containing

	<HTML>
	<BODY>
	Hello user from <!--#perlsub sub=remote_host -->
	</BODY>
	</HTML>

For me it returns

	Hello user from nemesis.fi.muni.cz

The nice way of doing it this way and not like Apache::SSI is that you
have separate module that only does the minimum required. And, you can
further process the output, so putting Apache::MakeCapital into the
chain in the PerlHandler will take the "Hello user from
nemesis.fi.muni.cz" output of Apache::SSIChain and filter it into
uppercase (not that it's too usefull, but you get the idea ;-). And,
you can add Apache::GzipChain to the chain and have the output
compressed on the fly.

That's the good news. The bad news is that it's really a quick hack.
If you have the time, please check the source code and help me with
following problems:

How can I make the html_parser local thing in $r? Currently it's just
in external variable but I'm sure that will break multithreading and
probably also sub requests. So the first question: what's the good way
of storing things inside $r? Or shall I store it inside the
Apache::OutputChain object? I should probably make it into hash
instead of array, if this is to be the place for various data.

How do I know that there will be no more output? Currently I check for
</HTML> but that's probably not too carefull approach.
	
I will be glad to hear what you think about the module -- let me
know.

Yours,

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Thu, 09 Apr 1998 08:13:16 +0000
From: Fabrizio Pivari <pivari@geocities.com>
Subject: ANNOUNCE: Math::MagicSquare 1.30 module
Message-Id: <352C831C.5C6C8368@geocities.com>

What is Math::MagicSquare module?
The first purpose of this PERL module is to help you to check your
Square, to answer these questions
Is it a Semimagic Square?
Is it a Magic Square?

The second purpose of this PERL module is to help you to print your
Square.
At the moment the available methods are 'print' that prints the square
on STDOUT and printhtml that prints the square in HTML format.
I'd like to add
- pringif     (to print the square in a GIF image)
- prinpdf   (to print the square in PDF format)

The third purpose of this PERL module is to help you to manipulate
your Square.
At the moment the method available is 'rotation' that rotates your
Square of 90 degree clockwise.


What is a Magic Square?
Do you like Magic Square?
Do you want to know more information about Magic Square?
Try to visit

A very good introduction on Magic Square
http://www.astro.virginia.edu/~eww6n/math/MagicSquare.html

A whole collection of links and documents in Internet
http://www.pse.che.tohoku.ac.jp/~msuzuki/MagicSquare.html

A good collection of strange Magic Square
http://www.geocities.com/CapeCanaveral/Lab/3469/examples.html

The only Magic Square checker and gif maker in Internet (I think)
http://www.geocities.com/CapeCanaveral/Lab/3469/squaremaker.html

What's new with version 1.30
Added rotation method

Where can I find it?
http://www.geocities.com/CapeCanaveral/Lab/3469/
is the primary location
You also can find it at CPAN archive

Enjoy it!

Send me your suggestions.


--
Fabrizio Pivari
mailto:pivari@geocities.com
http://www.geocities.com/CapeCanaveral/Lab/3469/
Member of ANFACE Software
http://www.geocities.com/CapeCanaveral/Hangar/4794/





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

Date: Thu, 09 Apr 1998 07:04:00 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <35317296.3189824@news.tornado.be>

ben@hayamasa.demon.co.uk wrote:

>In fact I've never heard of Microsoft taking anything
>freely redistributable and turned it into a proprietory product, so
>perhaps Microsoft is a more suitable host.

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

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

Perl may be a next target. What do you think that .asp scripts are,
anyway? MS proprietary crap.

	Bart.


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

Date: 9 Apr 1998 09:38:22 GMT
From: Stefaan.Eeckels@ecc.lu (Stefaan A Eeckels)
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <6gi4ue$vrv$1@justus.ecc.lu>

In article <35317296.3189824@news.tornado.be>,
	bart.mediamind@tornado.be (Bart Lateur) writes:
> ben@hayamasa.demon.co.uk wrote:
> 
>>In fact I've never heard of Microsoft taking anything
>>freely redistributable and turned it into a proprietory product, so
>>perhaps Microsoft is a more suitable host.
> 
> There is not ONE MS product that is not based on products that was
> available before MS developed their own. You name it: OS (CP/M clone),
> Windows (Mac and Xerox), spreadsheet, word processor, browser, server
> software. First they imitate it, add some proprietary features, and then
> compete the original manufacturer to death. Just look at what they're
> trying to do to Netscape now.
You forget NT (VMS clone), IIS (Apache clone but
with war paint), Xenix (UNIX with proprietary extensions)...

But Bill's clever, and we (the rest of the software world)
can't even manage to keep X11 alive. 

I wonder if RMS ever anticipated that his 'free software' would
be the last bastion against Microsoft?

-- 
Stefaan
-- 

PGP key available from PGP key servers (http://www.pgp.net/pgpnet/)
___________________________________________________________________
  "Don't worry about people stealing your ideas.  If your ideas
   are any good, you'll have to ram them down people's throats."
                                                -- Howard Aiken


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

Date: Thu, 09 Apr 1998 08:17:51 GMT
From: $louie@visca.com (Louie)
Subject: Re: FAQ question
Message-Id: <352c83f6.6661808@news.jet.es>

abigail@fnx.com (Abigail) wrote:

>Louie ($louie@visca.com) wrote on MDCLXXXI September MCMXCIII in
><URL: news:352bd6e7.2240892@news.jet.es>:
>++ Greetings:
>++ 
>++ Here's my script, which uses the "simple-minded" approach for removing
>++ HTML tags suggested in Perlfaq9:
>++ 
>++ "(?:[^>'"]*|(['"]).*?\1)* matches null string many times at
>++ html2txt.pl line 9."
>++ 
>++ Is there a fix for this?
>
>
>Yes. Its mentioned in the lines right below the given regex!

I should have mentioned that I had tried Tom Christiansen's
striphtml.pl, but the only way I could figure to get it to give me a
text file for a result was by redirecting STDOUT at the beginning of
the script:

BEGIN {
open (STDOUT, ">c:/www/visca/newtext.txt");
}

What I'm after is to use "glob" and "$^I" to return a separate text
file for each of the html files. When I tried pasting the "replace
tags" substitution routine (s{<(?:[^>'"]*|".*?"|'.*?')+>}{}gs;) from
striphtml.pl into my program (within my "while (<>)" statement) I got
the "matches null string many times" warning again. All this before
posting.

Am I correct in assuming that the warning ("The pattern you've
specified would be an infinite loop if the regular expression engine
didn't specifically check for that.") is generated because the
substitution is done within a "while (<>)" statement?

At any rate, I reckoned my Perl level wasn't up to combining
striphtml.pl with "glob" and "$^I", so I was hoping to adapt the
"simple-minded" approach to my needs. And it does work. But the
warning message bugs me.

Thanks for your answer.

-- 
Louie
louie@visca.com
http://www.visca.com/


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

Date: Thu, 09 Apr 1998 12:33:15 GMT
From: hege-n@hsr.no (Heggie)
Subject: Generating Password from Username in Perl ?
Message-Id: <352cbcaa.9571342@news1.c2i.net>

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


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

Date: Thu, 09 Apr 1998 02:18:14 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: greediness problem matching date expressions? help
Message-Id: <352C682E.7E13FC3F@coos.dartmouth.edu>

Josh England wrote:
> 
> I don't understand what is going on.  Is it a greedyness problem with
> the .{12}?

No.  '.{12}' matches *exactly* 12 characters, so greediness is not an issue.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 9 Apr 1998 08:38:37 -0400
From: "Les Woolsey" <lwoolsey@innovative.ca>
Subject: Help with S/$var/val/ problem
Message-Id: <6gig0q$gk3$1@nr1.ottawa.istar.net>

I have a piece of code which can be summarized as follows:

$_='junk%value%morejunk%$other%junk';  # a string for working on
$kw = 'value';                #a value to look for in a variable
s/%$kw%/frodo/g;       #this substitution works
$kw = '$other';             #this time the kw value contains a leading "$"
character
s/%kw%/beans/g;       #this does not work !!!!!!!!!!!

Can someone explain to me why the second substitution doesn't work. It's
clearly caused by the $ in the contents of the variable.

The actual code is running through a hash using the key values &
substituting the associated values. It looks like:

      foreach $kw (keys %keywords)
      {
         $subct += s/%$kw%/$keywords{$kw}/g;
      }

As I say, it works if the keyword ($kw) does not have a leading "$" but
fails if it does.  What have I done wrong & how do I fix it???


Les




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

Date: Wed, 08 Apr 1998 22:09:10 GMT
From: daclay@NOSPAMzip.com.au (Excession)
Subject: Re: Obfuscated Perl: figure this one out
Message-Id: <352cf516.3091192@news.zip.com.au>

On Wed, 8 Apr 1998 16:50:54 -0400, kpreid@ibm.net (Kevin Reid) wrote:

>#!/usr/bin/perl -w-e 'open ME,@_[$$];print %_{$0+1}'
>eval scalar((($_='!;_$$,!$_!;') =~ tr@_$;!,@=",$;@),
>$_); eval "@{[reverse split /[1-9]/, '>1A2T3A5D4<6 '
>.'7t8in1r2p2;405,801,8A9AT3k D5e6e7s8']}" __END__

substituting eval for print:

c:\bat>perl tmppl.pl
$,="";$"=$,s e e k D AT A , 0 , 0 ; p r in t   < D A T A >

Looks like attemps to print out your entire diskdrive.

Dac


---
David Andrew Clayton     # Please remove NO_SPAM when 
dac@NOSPAM.pcug.org.au   # sending email replies.
I post therefore I am.   #


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

Date: Thu, 09 Apr 1998 04:02:21 -0600
From: herve_debar@hotmail.com
Subject: Optimization regexp/list for string search
Message-Id: <6gi2qt$jai$1@nnrp1.dejanews.com>

Hi,

I have the following problem. I receive strings, and i keep them only if i
haven't seen them previously. Right now, i'm storing the strings in an array
and look iteratively for an exact match on all strings in the array. Would a
regexp search be more efficient, i.e. if i append all my strings into a large
one, and do a regexp search ?

Thanks

Herve.

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


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

Date: Thu, 9 Apr 1998 05:58:28 -0400
From: "Samuel H. Barnum" <sbarnum@zoo.uvm.edu>
Subject: OS/2 and Perl?
Message-Id: <Pine.A41.3.96.980409050830.52716D-100000@elk.uvm.edu>

Has anyone succesfully setup perl on OS/2?  I am in the process of trying
to do this.  Any suggestions about mistakes to avoid, or things that are
OS/2 specific, that may not be obvious, but needs to be done, would be a
great help.  I haven't been able to find any information specific to
running perl on OS/2 on the internet yet. The following is a brief
description of what I have done sofar: 

Thanks in advance for any suggestions/comments,  Sam

 I used the OS/2 port available at
http://www.perl.com/CPAN-local/ports/os2 and so far all seems well. I can
run a short script, from the command line that prints text to the screen.
I can also get the webserver, on the OS/2 system, to process a similar
Perl script, as a CGI script, and return text from a "print" statement to
a web browser. Ultimatly I want to use Perl for CGI scripts that will
access a Database and return data to a web browser.  The data base I have
availble is IBM DB2 Ver5. which is supposed to be ODBC compliant.  I'm
thinking that I might need a DBD/DBI or ODBC pm module specific to OS/2
and IBM DB2 to make this work, but I don't know.... yet...
    Also, I am not a perl Wizard, and the people I have helping me know
nothing about Perl, but they are OS/2 certified.




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

Date: Wed, 08 Apr 1998 21:57:44 GMT
From: daclay@NOSPAMzip.com.au (Excession)
Subject: Re: perl win 32 :  asterisk on command line
Message-Id: <352befac.1705738@news.zip.com.au>

drummj@mail.mmc.org (Jeffrey R. Drumm) wrote:

>On 8 Apr 1998 14:37:17 GMT, "WS010" <WS010@dvvlap.be> wrote:

[regarding perl -xxx blah blah * blah]

>>Who knows why this feature has been deliberately added to Perl for Win32?

>Remember that Perl's roots are in the Unix world; there, the command line is
>_always_ interpreted first by the shell, and shell metacharacters such as ? and
>* are expanded into matching file names by the shell before their expansions
>are turned over to the script as arguments.

Same thing happens with Windows NT command processor.

>Perl is merely attempting to duplicate this behaviour in the somewhat
>brain-addling environment of NT. :-)

Wrong.  Perl is accepting the arguments generated by the WinNT command
processor.

Which brings me to the point

<RANT>

WHAT THE FUCK DO YOU HOPE GO GAIN OUT OF ATTEMPTING TO BELITTLE SOMEONE
ELSES CHOICE OF OPERATING SYSTEM OR THE OPERATING SYSTEM ITSELF?

</RANT>

This operating system *bigotry* really gets up my nose.  Sure, Windows NT
has some problems, and Windows 95 has more, but the amount of oleaginous
self congratulation by the various Unix-centred BIGOTS on this group,
whenever 'NT' and 'Problem' come into scope, is just over-the-top pathetic.

Grow up.

The plain fact of the matter is that -perl- is able to run on many
different platforms, and whatever platform it runs on, there are different
caveats.  All computing platforms have their quirks, their annoyances,
their idiosyncracies.  Even the SAME operating system on different
hardware, will exhibit different behaviour in certain circumstances.  Look
at the Slackware Vs Debian Vs Red Hat linux packages -- differences
everywhere, and some of them rather significant too.

What makes the incompatibilities and idiosyncratic behaviour of perl on
different versions of Linux, any different from perl running on DOS, OS/2
or Window 95 or Windows NT? 

It is usually of LITTLE or NO consequence which OPERATING SYSTEM someone is
using when perl is being discussed.  The same behaviour experienced by the
original author of this thread, would have occured for anyone using a Unix
command shell.  Yet you had to take a gratuitous, otiose poke at an
operating system deemed to be 'not worthy', possibly to ingratiate yourself
that iota more with the bigotted unix crowd, and their endless sagacity
with regards to all things wrong with the evil Gatesian upstart and his
satanic Windows NT operating system.

Stop the bigotry. 

Thanks.

Dac


---
David Andrew Clayton     # Please remove NO_SPAM when 
dac@NOSPAM.pcug.org.au   # sending email replies.
I post therefore I am.   #


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

Date: Thu, 09 Apr 1998 12:06:56 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: perl win 32 :  asterisk on command line
Message-Id: <352ca842.669938791@news.mmc.org>

On Wed, 08 Apr 1998 21:57:44 GMT, daclay@zip.com.au (Excession) wrote, without
bothering to check his facts:

>drummj@mail.mmc.org (Jeffrey R. Drumm) wrote:
>
>>On 8 Apr 1998 14:37:17 GMT, "WS010" <WS010@dvvlap.be> wrote:
>
>[regarding perl -xxx blah blah * blah]
>
>>>Who knows why this feature has been deliberately added to Perl for Win32?
>
>>Remember that Perl's roots are in the Unix world; there, the command line is
>>_always_ interpreted first by the shell, and shell metacharacters such as ? and
>>* are expanded into matching file names by the shell before their expansions
>>are turned over to the script as arguments.
>
>Same thing happens with Windows NT command processor.

Think so? Explain the following:

C:\>echo *
*

Do you understand the significance of this? In the future, I would suggest you
do your homework before you post.

>>Perl is merely attempting to duplicate this behaviour in the somewhat
>>brain-addling environment of NT. :-)

>Wrong.  Perl is accepting the arguments generated by the WinNT command
>processor.

See above. Just because the DIR, COPY, FOR, etc. commands happen to fetch
directory entries when used with wildcard characters DOES NOT mean that the
wildcards are expanded _on_the_command_line_ by CMD.EXE/COMMAND.COM. The logic
of those builtins includes findfirst/findnext functionality. An asterisk on the
command line is just another character as far as NT's command processor is
concerned; the application/command _must_ include logic to make use of that
character. So that Perl can provide a simulacrum of consistency between NT and
Unix, fileglob character expansion has been built into it on the NT platform.

>Which brings me to the point

><RANT>

>WHAT THE FUCK DO YOU HOPE GO GAIN OUT OF ATTEMPTING TO BELITTLE SOMEONE
>ELSES CHOICE OF OPERATING SYSTEM OR THE OPERATING SYSTEM ITSELF?

My, my. Do you feed yourself with those fingers?

I use NT every single day. I am consistenly amazed at what DOESN'T work in the
NT world that is trivial to implement on Unix.  If you'd like, I can list what
sucks about NT. I can list lots and lots of things.

Anyway, it's irrelevant. I posted an opinion about an operating system. I
followed that opinion with a smiley, which even most humor-challenged
individuals such as yourself recognize as an indication of frivolity.
Apparently, you're more humor-bereft than most.

></RANT>

>This operating system *bigotry* really gets up my nose.  Sure, Windows NT
>has some problems, and Windows 95 has more, but the amount of oleaginous
>self congratulation by the various Unix-centred BIGOTS on this group,
>whenever 'NT' and 'Problem' come into scope, is just over-the-top pathetic.

>Grow up.

If a simple opinion followed by a smiley gets under your skin this badly, I
might suggest that your suggestion to 'Grow up' is, ahem, misdirected.

Fire up your web browser and take a look at DejaNews for my posts in this
forum. You'll notice that there aren't a lot of them, but a good portion
concern assisting others to use Perl in the NT environment.

As such, I think I'm entitled to my opinion, ESPECIALLY when it comes to a
MISFEATURE of an operating system that the developers of Perl have worked hard
to circumvent. If you don't like my opinion, you're more than welcome to post
an ill-informed rant. Oh, you did that. Never mind. :-)

Oh, did you notice the smiley? There was a smiley at the end of the last
paragraph. That indicates humor. You've heard of humor, right?

>The plain fact of the matter is that -perl- is able to run on many
>different platforms, and whatever platform it runs on, there are different
>caveats.  All computing platforms have their quirks, their annoyances,
>their idiosyncracies.  Even the SAME operating system on different
>hardware, will exhibit different behaviour in certain circumstances.  Look
>at the Slackware Vs Debian Vs Red Hat linux packages -- differences
>everywhere, and some of them rather significant too.

>What makes the incompatibilities and idiosyncratic behaviour of perl on
>different versions of Linux, any different from perl running on DOS, OS/2
>or Window 95 or Windows NT? 

You'll find that the difference in Perl's operation on the aforementioned Unix
platforms is almost imperceptable when running the same version/build of Perl.
Your perceived differences are either because the vendors of those Linux
versions insist on including outdated versions, or you don't actually have any
experience with them (I'll give you the benefit of the doubt and assume the
former).  I run Perl on SCO, AIX, HP/UX and Linux (SlackWare 4.3 if it
matters). I have yet to need to code an application differently because of some
deviance in the underlying operating system. This is most emphatically NOT true
when moving scripts from Unix to NT.

Perl was 'built' with Unix in mind. However, in the DOS/Windows/NT world,
developers come to expect to have to do things like call the DOS
findfirst/findnext routines to get directory listings in their applications,
because the 'shell' (CMD.EXE/COMMAND.COM) doesn't do it for them. THAT, I'm
sure, is why the original poster was surprised by his results.

>It is usually of LITTLE or NO consequence which OPERATING SYSTEM someone is
>using when perl is being discussed.  The same behaviour experienced by the
>original author of this thread, would have occured for anyone using a Unix
>command shell.  Yet you had to take a gratuitous, otiose poke at an
>operating system deemed to be 'not worthy', possibly to ingratiate yourself
>that iota more with the bigotted unix crowd, and their endless sagacity
>with regards to all things wrong with the evil Gatesian upstart and his
>satanic Windows NT operating system.

I will agree that Perl does a better job than most development environments of
evening the playing field. However, one who has spent the better part of
his/her programming career working in the DOS/NT world will find behaviors in
Perl that are unexpected, and as pertains to the subject of the original post,
especially when it comes to expansion of wild-card characters.

One who has worked in the Unix world will find the lack of features such as
alarm(), fork(), decent redirection, the need for binmode(), etc. to be
virtually crippling.

>Stop the bigotry. 

Yeah, right. Sure. You bet.

>Thanks.

Uh huh.

-- 
                               Jeffrey R. Drumm, Systems Integration Specialist
                       Maine Medical Center - Medical Information Systems Group
                                                            drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me


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

Date: Thu, 09 Apr 1998 11:07:07 +0100
From: Tara Bennett <TBennett@rnib.org.uk>
Subject: Perl.exe
Message-Id: <352C9DCB.3DBABC4A@rnib.org.uk>

I am having problems with running the following script, I wan it to
query a database but it is coming up with the following error.
Can't locate Win32/ODBC.pm in @INC at psodbc.pl line 8.  BEGIN
failed--compilation aborted at psodbc.pl line 8.
What's the problem ?


#!/progra~1/perl/bin/perl

#Fetch data
# April 1998

#set variables

use Win32::ODBC;
$DSN = "richard1"; #Opens a connection to my database
if (!($Data = new Win32::ODBC($DSN))) {
 print "Error conencting to $DSN\n";
 print "Error: " . Win32::ODBC::Error() . "\n";
 exit;
}



print "HTTP/1.0 200 OK\n";
print "Content-type:text/html\n\n";

$SqlStatement = "SELECT * FROM customers";
 if ($Data ->sql ($sqlstatement)) {
 print "SQL failed.\n";
 print "Error: " . $Data->() . "\n";
 $Data ->Close();
 exit;
}
while ($Data->FetchRow())  {
 ($customerid, $Companyname, $contactfirstname, $contactlastname,
 $billingaddress, $city, $stateorprovince, $postalcode, $country,
 $contacttitle, $phonenumber, $faxnumber, $emailaddress ) = $Data ->Data

 ("customerid", "companyname", "contactfirstname", "billingaddress"
 "city", "stateorprovince", "postalcode", "country", "contacttitle",
 "phonenumber", "phonenumber", "faxnumber", "emailaddress");
}

print "<HTML>\n";
print "<HEAD><TITLE>Result of search</TITLE></HEAD>\n";
print "<BODY>\n";
print "<H2>Result $customerid</H2>\n";
print "<H2>Result $comapnyname</H2>\n";
print "<H2>Result $contactlastname</H2>\n";
print "</BODY>\n";
print "</HTML>\n";
$Data->Close ();



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

Date: 09 Apr 1998 10:40:12 +0200
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: PID, fork(), exec() question again...
Message-Id: <ishg431j83.fsf@godzilla.kiere.ericsson.se>

mshavel@erols.com (Michael Shavel) writes:

> I hope I made my self clear and also hope someone has an answer for me. 

Yes, the manpage has. Read the bit in the perlfunc manpage about exec, 
paying particular attention to what it says about the number of
arguments you give to exec().
-- 
		    Calle Dybedahl, UNIX Sysadmin
       qdtcall@esavionics.se  http://www.lysator.liu.se/~calle/


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

Date: Thu, 9 Apr 1998 03:41:39 -0500
From: kturvey@pug1.sprocketshop.com (Kenneth P. Turvey)
Subject: Re: RMS should be invited to O'Reilly's "Free Software Summit"
Message-Id: <slrn6ip2e2.pg8.kturvey@www.sprocketshop.com>

On 8 Apr 1998 19:21:08 GMT, Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:

>You clearly never had any relation to GPLed software.  GPL is as far
>from "free" as you can get - preserving an impression of being free.
>
>While I applaud most other efforts by RMS, GPL is a clear indication
>of what people should not use.

Oh, come on, this is ridiculous.  

-- 
Kenneth P. Turvey <kturvey@pug1.SprocketShop.com> 

The United States is a nation of laws: badly written and randomly
enforced.
	-- Frank Zappa


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

Date: 9 Apr 1998 07:04:33 GMT
From: Michael Barnes <mibarnes@mail.vth.vt.edu>
Subject: Re: s/PATTERN/<how to concat here>/g
Message-Id: <6ghru1$frl$1@solaris.cc.vt.edu>

Use this instead:

s/(STT,\d\d*\-\w\w*\-)(\d\d)/${1}19${2}/g;

I dunno if you need /g or not.

Mike

Robert Lopez <Robert.Lopez@abq.sc.philips.com> wrote:

> How is string concatenation done on
> the left side of substitution?

> This is what I am trying to do:
>    $_ = "STT,31-Mar-98";
>    s/(STT,\d\d*\-\w\w*\-)(\d\d)/$1.19.$2/g; #1
>    s/\.//g;                                 #2
>    $_.="\n";
>    print $_;

> I can not figure how to do #1 and #2 in one line.

> -- 
> Robert Lopez                    <Robert.Lopez@abq.sc.philips.com>
> Philips Semiconductors,   9201 Pan American Fwy. N.E.,   ms 20,
> Albuquerque, New Mexico 87113 USA  [P: (505)822-7112  F: x7237]


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

Date: Thu, 09 Apr 1998 01:36:13 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: scanf substitute in perl
Message-Id: <352C5E52.E2B8B90F@coos.dartmouth.edu>

Grinch wrote:
> 
> Andrew M. Langmead wrote in message ...
> 
> >($string1, $string2, $num) = ( $line =~ /(\S+)\s+(\S+)\s+([-+]?\d+)/ );
> >
> >Is close, except that in scanf() if a line partially, but not
> >completely matches the format string, the arguements that do match are
> >stored. With regular expressions, it is all or nothing (unless you
> >specify it as being optional with the "?" or "*" quantifiers.)
> 
> You could use three regex's to simulate scanf's behaviour, if it's
> important:
> 
> ($string1, $remainder1) = ( $line =~ /(\S+)\s+(.*)/ );
> ($string2, $remainder2) = ( $remainder1 =~ /(\S+)\s+(.*)/ );

These two incorrectly assume there must be whitespace after each string,
so change '\s+' to '\s*'.

> $num = ( $remainder2 =~ /[-+]?\d+/ )
                           ^^^^^^^^
Don't forget the parens.  :-)

Alternatively:

$line =~ /(\S+)\s*/g     and $string1 = $1;
$line =~ /\G(\S+)\s*/g   and $string2 = $1;
$line =~ /\G([-+]?\d+)/g and $num     = $1;

/g works in a scalar context too.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 09 Apr 1998 01:04:46 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: Rob Tanner <rtanner@linfield.edu>
Subject: Re: Simple Unix Question,  ( Simple for you maybe )
Message-Id: <352C56F2.2028BBCF@coos.dartmouth.edu>

[posted and mailed]

Rob Tanner wrote:
> 
> In article <kfreg6.gl.ln@localhost>, tadmc@flash.net (Tad McClellan) wrote:
> 
> > : >   $my_variable = `ls -l`;
> >
> > That looks like a string stored in a variable to me.
> 
> `ls -l` is back-ticked.  That means perl should execute the command "ls
> -l", the output of which is multiple lines and so is a list.
> 
> The sequence $my_variable = `ls -l` will yield the count of returned lines
> in the variable $my_variable.
> 
> The sequence @my_variable = `ls -l` will yield the output the the "ls"
> command in the array @my_variable.
> 
> As you can see, there is a major difference there.

Yes, and the difference is, one of you knows what he is talking about, and one
of you doesn't.

Here's a hint; Tad McClellan knows what he is talking about.

Back-ticks, like *many* Perl operators, gives different results depending on
whether it is executed in list or scalar context.  Specifically, in a list
context, back-ticks return a list of newline-terminated strings.  In a scalar
contex, back-ticks return a single string containing all the lines of output.

Instead of incorrectly correcting Tad, you could have tried reading the
documentation for back-ticks, or even, god forbid, *executed the code* to
verify your assertion.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 09 Apr 1998 01:47:07 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: Strange "Modification of a read-only value attempted" error
Message-Id: <352C60E1.7BDF9D7D@coos.dartmouth.edu>

James A Squire 312 M 193884 wrote:
> 
> In the meantime, what kinds of obscure things could cause a value to be
> considered by Perl to be read-only?

Two that I know of:

Aliasing a variable to a read-only special variable, such as:

*x = \$4;

Aliasing a variable to a constant, such as:

*x = \'1234';




-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 09 Apr 1998 05:50:27 GMT
From: tgy@chocobo.org (Kuma)
Subject: Re: Tail-like functionality
Message-Id: <352d5a47.164338488@news.oz.net>

On Tue, 7 Apr 1998 23:37:10 GMT, kees@echelon.nl (Kees Hendrikse)
wrote:

>I'm looking for a way to add unix-like tail functionality to a perl
>script. As I'm only interested in the last 10-20 lines of output, I
>now run 'perlscript largfile | tail', which implies perl is doing a
>lot of work for nothing. 'tail largfile | perlscript' is not the way
>to go, because all the data in largefile is used in the caclualtions.
>In need the tail 'halway' inside the script, without buffering lots
>of data. Any suggestions?

Does this do what you want?

  use IO::Tail;
  $fh = new IO::Tail '-20 largefile';
  @last_20_lines = <$fh>;

IO::Tail is currently available at:

  http://www.chocobo.org/~tgy/perl/IO-Tail-0.01.tar.gz
  http://www.chocobo.org/~tgy/perl/IO-Tail.html

Comments appreciated :)


--
Kuma | tgy@chocobo.org | Moogle Stuffy, Inc.
http://www.dragonfire.net/~tgy/moogle/


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

Date: Thu, 09 Apr 1998 02:29:14 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: "Christopher D. Bain" <chfwahoo@entropy.muc.muohio.edu>
Subject: Re: Why am I getting this regexp error?
Message-Id: <352C6AC3.C65C8B96@coos.dartmouth.edu>

[posted and mailed]

Christopher D. Bain wrote:
> 
> I am writing a perl script, and I got this error:
> 
> </: unmatched () in regexp at /home/chfwahoo/bin/webspell line 140.
> 
> Line 140 is
> 
> $newfile =~ /<$match>$after$/s;

After interpolating the values of $match and $after, your regex contains more
open parens than close parens (or vice versa).


If the values of $match and $after are meant to be literal strings in the
regex, try this, which will put a backslash before non-word characters in the
values of $match and $after.

$newfile =~ /<\Q$match\E>\Q$after\E$/s;


If $match and $after are meant to use regex metacharacters, count your parens
and make sure you match all the open and close parens.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

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 2280
**************************************

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