[9025] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2643 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 19 20:07:24 1998

Date: Tue, 19 May 98 17:00:30 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 19 May 1998     Volume: 8 Number: 2643

Today's topics:
        $|, fork and pipe <yong@shell.com>
    Re: $|, fork and pipe (Martien Verbruggen)
        [NAPRC] Re: Pre-ANNOUNCE of a Perl Documentation Naviga <birgitt@order.booktraders.com>
    Re: Can't call method "Worksheets" without a package or Brett.A.Hunsaker@usace.army.mil
        CGI not working part 2 carrr@mris.com
    Re: CGI not working part 2 (Craig Berry)
    Re: Creating HTML tables? (it's a big block of code!) <edelhart@teleport.com>
        Cryptography in Perl? <ahdiii@webspan.net>
    Re: Does Perl have a IDE?I don't like command line. (Abigail)
    Re: Does Perl have a IDE?I don't like command line. (Ken Fox)
    Re: Does Perl have a IDE?I don't like command line. (Mike Heins)
    Re: file locking question <jgoldberg@dial-but-dont-spam.pipex.com>
    Re: file locking question <danboo@negia.net>
        grep variable value not its name. <choleman@simpact.com>
        grep variable value not its name. <choleman@simpact.com>
    Re: grep variable value not its name. <merlyn@stonehenge.com>
    Re: grep variable value not its name. (brian d foy)
    Re: grep variable value not its name. (Martien Verbruggen)
    Re: grep variable value not its name. (I R A Aggie)
        Help with Win32::Internet (Dave)
    Re: How to include a file that contains subs <dkhosla@compaq.com>
    Re: HTTP/1.0 501 Not Supported (Nathan V. Patwardhan)
    Re: I need help using the system command (Craig Berry)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 19 May 1998 16:50:18 -0500
From: Yong Huang <yong@shell.com>
Subject: $|, fork and pipe
Message-Id: <3561FE9A.DEF5AABF@shell.com>

There's an interesting question at the CGI group. But I think it's
better asked here. The question asks why he got "Content-type: text/html
Hello" in the browser by executing the script below (called q.pl here)
while he only got "Hello" if $|=1 is uncommented? Seems it has to do
with piping. I don't know how to explain. This is my screen dump (the
prompt is proteus%):

proteus% cat q.pl
#!/usr/shell/bin/perl -w
#$|=1;
print "Content-type: text/html\n\n";
if (fork)
 { print "Hello\n";
 }
proteus% q.pl
Content-type: text/html

Hello
proteus% q.pl | more
Content-type: text/html

Content-type: text/html

Hello
proteus% q.pl | cat
Content-type: text/html

Content-type: text/html

Hello



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

Date: 19 May 1998 23:14:39 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: $|, fork and pipe
Message-Id: <6jt3ov$sbl$3@comdyn.comdyn.com.au>

In article <3561FE9A.DEF5AABF@shell.com>,
	Yong Huang <yong@shell.com> writes:
> There's an interesting question at the CGI group. But I think it's
> better asked here. The question asks why he got "Content-type: text/html
> Hello" in the browser by executing the script below (called q.pl here)
> while he only got "Hello" if $|=1 is uncommented? Seems it has to do
> with piping. I don't know how to explain. This is my screen dump (the
> prompt is proteus%):

# perldoc -f fork
[snip]
Note: unflushed buffers remain unflushed in both processes, which means
you may need to set C<$|> ($AUTOFLUSH in English) or call the autoflush()
method of IO::Handle to avoid duplicate output.
[snip]

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | In a world without fences, who needs
Commercial Dynamics Pty. Ltd.       | Gates?
NSW, Australia                      | 


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

Date: Tue, 19 May 1998 19:34:56 -0400
From: Birgitt Funk <birgitt@order.booktraders.com>
Subject: [NAPRC] Re: Pre-ANNOUNCE of a Perl Documentation Navigator
Message-Id: <35621720.4EA6B957@order.booktraders.com>

Peter Rowell wrote:

[snip Pre-ANNOUNCE]

> 
> The following are just my opinions.  If you are happy with yours,
> you can skip the rest of this message!

> I would like to say a few words about "newbie abuse".
> 
> 
> And just because you have been programming for 25 years, have used
> 30+ languages on 60+ different platforms, and written a gazillion
> lines of code for OSes, apps, drivers, etc. - even with all of that
> you are *still* a newbie yourself (at some level) when you approach
> a new language or a new environment.  You are just more experienced
> at *being* a newbie than a new newbie is (does that make sense?).

A lot to me.

> 
> Here are my own contributions to the FAQ.
> 
> Q:  Is Perl a good language to learn programming in?
> A1: Yes, it's cheap, well documented, runs on everything, and is
>     the basis for much of the dynamic content of web sites.
> A2: Yes, but start slowly, using the features one-at-a-time until
>     you understand what they do.
> A3: Yes, but don't ask any questions on c.l.p.m :-)

never.. :-)

> A4: No, but don't ask me to name a better one.

no, I learned this already on c.l.p.m ...:-)

> A5: No. I once heard that Pascal was like the round-nosed scissors
>     you had in grade shool and that C was like a two-edge razor
>     (you could do a lot, but you could also bleed to death on the
>     machine room floor).  I would like to extend this by saying
>     that Perl *looks* like the round-nosed scissors, but is actually
>     a multi-dimensional laser beam.  ("Fenster!  Don't run with that
>     laser beam, you'll delete someone's directory!")

When anything helpful came out of this "Is Perl a good first
language to learn programming with" discussion involving PASCAL
and other languages for me, then it was that I understood I HAVE
to find out myself. That IS an answer, quite a good one to me.

> 
> Q:  How does a newbie get started?
> A1: Buy lots of O'Reilly books and read them cover-to-cover.

Have so many I can't carry them around anymore.

> A2: Look at the source of modules written by the tribal elders.

Gladly.

> A3: Just do it!  Programming is a state of mind and the only way
>     to get there is to be there.  I know that sounds a bit Zen
>     or something, but if you don't make an effort to figure out
>     your own problems/bugs, you will never develop the mental tools
>     you need to BE a programmer.

Will be done given the right studying condition.

> A4: But don't do it in CGI!  I think many of the problems that are
>     posted to c.l.p.m are related to the mind twist you need in
>     order to understand that the CGI script is being run as the
>     *server's* user, not as you.  This has many subtle (and not so
>     subtle) implications in terms of working directories, environment,
>     permissions, etc.  Debugging can be difficult enough when
>     everything is in the same directory.  Debugging through a
>     [browser->network->web server->CGI script] combination can be a
>     bitch!  I have developed a raft of tools for simulating my CGI
>     environment just so I *don't* have to debug in that tar pit!
>     But is a newbie going to know that they just decided to learn
>     to rock climb on a (potentially) Class 6 ascent?  I think not.
> 

I think I might have watched someone having gotten in trouble with
something like that already. I am warned - thank you.

> Q:  So what do you do when the 1,000th newbie asks the same question?
> A1: Well, by now it sure as hell should be in the FAQ!

> A2: Don't say anything.  Let someone else yell at them and say RTFM! :-)

good advice.

> A3: Realize that it is probably *the newbie's* first time asking
>     that question.  This is different from someone asking the
>     same question 1,000 times, true?

yes, but who can remind himself 1,000 times of that ?

> 
> Q:  But they don't *read* the F****** FAQ!
> A:  Perhaps they need a little help finding things. (see above)
> 

Perhaps, may be they just can't handle the "freeness" of an
online usenet newsgroup "helpdesk". It is just too simple to
type and send any questions you might have. In my opinion it
is the 'medium' which many can't get a handle on. It's too
much "in the ether" and not enough "bound to physical interaction",
where you use five senses instead of one.

I guess I would fall apart and vanish in the dust, 
asking any question in real life I might post here  ...

> Q:  Newbies drive me crazy!  What can I do?
> A1: Ignore them.

yupp.

> A2: Stop reading the newsgroup.

if that is really needed, what a pity, but yes.

> A3: Only read postings by people you know are not newbies.

yes, and give very smart answers so that we newbies have
some good stuff to read and search for.

May be, if you get in lengthy discussions which are religious or
personal in nature and not Perl programming related you could put a
NAPRC = "Not A Perl Related Comment" as the first word in the subject
line ? :-).


> A4: Create a filter (in perl) for the newsgroup that eliminates all
>     posts containing questions that have an 80+% conceptual similarity
>     to items in the FAQ.  Share it with others!

Great, put that filter script up somewhere in the DOCs too so we can 
look of how to write good filters.

> 
> Q:  They want us to do their homework!

Do they ? Naaa, and if really so and for free...
then yes 
> A:  Well, to hell with them! (you gotta flame *something*! :-)

definitely.

I just would like to add that not only clueless newbies come here
but also clueless pre-newbies, who just want to find out how
to become an acceptable newbie, before they even had one
Perl programming question. 

Amazingly you can even learn that here, that's really not bad at
all.

Birgitt Funk


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

Date: Tue, 19 May 1998 23:46:23 GMT
From: Brett.A.Hunsaker@usace.army.mil
Subject: Re: Can't call method "Worksheets" without a package or object reference
Message-Id: <6jt5kf$74g$1@nnrp1.dejanews.com>

Thanks Jenda, your comments were right on the money!  The problem is that
Excel is not looking in the current directory for test.xls and the Open
method will not create the file if it is missing.

May you and your family have many years of happiness!

   ...

> > $excel = CreateObject OLE 'Excel.Application'
> >         or warn "Couldn't create new instance of Excel App!!";
> > $excel->Workbooks->Open( 'test.xls' );
>
> You should definitely test if the Open failed!
> something like
>
> $excel->Workbooks->Open( 'test.xls' )
> or die "Couldn't open the file!\n";
>
> I'm sure $excel contains some Error collection or something,
> but I do not have docs nor Excel by hand :-(
>
> > $excel->Workbooks(1)->Worksheets('Sheet1')->Cells(1,2)->{Value} = 'foo';
> > $excel->Workbooks(1)->Worksheets('Sheet1')->Cells(1,2)->{Value} = 'bar';
> > $excel->Save(); $excel->Quit();
> >
> > Attempting to execute this code results in the following error:
> >
> > Can't call method "Worksheets" without a package or object reference at
> > duh.pl line 5.
> >
> > I have tried this both with and without the Excel spreadsheet test.xls
> > existing in the current directory before running the script.  Listing the
> > current processes on the system shows that Excel is successfully started.
> >
> > Any help would be appreciated.
> >
> > Thanks in advance!
>
> I don't think Excel is looking for the file in the current directory
> of your script.
> I'd think it rather uses "c:\My Documents" or something.
> It should be the same directory as you see if you
> launch Excel by hand and select File\Open.
>
> You should always use full paths.
>
> HTH, Jenda

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


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

Date: Tue, 19 May 1998 21:16:56 GMT
From: carrr@mris.com
Subject: CGI not working part 2
Message-Id: <6jsss7$r2d$1@nnrp1.dejanews.com>

when i put in http://.....com/cgi-bin/ice_cream?favorite=mint I get an error:
Internet Explorer cannot open the internet sit ....

I have PWS running. The file ice_cream.cgi is there.

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


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

Date: 19 May 1998 22:14:21 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: CGI not working part 2
Message-Id: <6jt07t$91q$2@marina.cinenet.net>

carrr@mris.com wrote:
: when i put in http://.....com/cgi-bin/ice_cream?favorite=mint I get an error:
: Internet Explorer cannot open the internet sit ....
: 
: I have PWS running. The file ice_cream.cgi is there.

A) This has stopped being a Perl issue, and started being a CGI/server
   issue.  Groups devoted to those topics might give you better help.

B) How is the existence of a file named 'ice_cream.cgi' relevant to the
   invocation of a CGI application named 'ice_cream'?

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Tue, 19 May 1998 21:07:48 GMT
From: "Dave" <edelhart@teleport.com>
Subject: Re: Creating HTML tables? (it's a big block of code!)
Message-Id: <01bd836a$0127cec0$LocalHost@edelhart>

I am working on the same kind of problem in Microsoft Access.

You're going to need a lot more information than you can squeeze into an
ascii table. 

This is quite a lot of overhead of course. I'm doing this in hard code
myself for a very sophisticated HTML templater. 

Let me ask you a very basic question: 

Why aren't you just creating the HTML file in FrontPage or Dreamweaver and
just including placemarks to replace the cell's context with a GREP?

I just spent a day "reinventing the wheel" : I created a custom file I/O
dialog for access then found out that there's a built-in routine for
calling the standard I/O box that you can link to access. 

It's easy to do this as a programmer; but be reasonable about the necessity
for you to reengineer a problem that someone else's already solved. 

Given that, for what it's worth:

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

I don't know perl; the following is a basic algorithm for solving the
problem. A lot of data retrieval subroutines are left to your imagination,
too. 
  
Being the object oriented fiend that I am my approach is to create a
"table" object definition and link it to "cell" definitions.

the TABLE_DEF has all the infomation about table height, width, colors, and
the column and row heights, where defined.

The cells have things like cell color, row/colspan, etc. 

So store the cells in an array of records (does PERL have records/user
defined types? if not just create a "pseudo record" in ascii; you can use
HTML-esque markup or whatever works for you. Call it CELL_ARRAY

 "<!-- CELL -->
(1,3) 'navigation cell' 
ROWSPAN 3 
COLSPAN 2 
<!-- cell contents-->
put this in the cell and smoke it!
<!-- end cell contents -->
<!- END CELL -->"

what your script then does is create an array of cell definitions that
contain these records, call it CELL_DEFINITIONS

Then you create a 3-dimensional array - call it TABLE_ARRAY- of
records/custom types/ascii keys/whatever:
"IS_DEFINED FALSE
DEFINED_BY_CELL_INDEX 0
IS_OVERWRITTEN_BY_CELL 0"

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

Then go through CELL_ARRAY and put for each cell, set the IS_DEFINED flag
to true and the DEF_CELL_INDEX to the array number of the cell in
TABLE_ARRAY, as well as marking the other cells as overwritten. Something
like this

for CELL_INDEX = 1 to [number of cells in CELL_ARRAY) do
  R = getRow(CELL_ARRAY(CELL_INDEX))
  C = getColumn(CELL_ARRAY(CELL_INDEX))
  set the TABLE_ARRAY[R][C]'s IS_DEFINED to TRUE
  set the TABLE_ARRAY[R][C]'s DEF_CELL_INDEX to CELL_INDEX
  
   for RowSpan = R to R + (rowspan of cell CELLINDEX) do
    for ColSPan = C to C + (rowspan of cell CELLINDEX) do 
      if not (RowSpan = R) and (ColSpan = C) then
        (the first cell isn't overwritten -- it's just plain written.)
        IS_OVERWRITTEN = CELLINDEX (so you can track who's doing the
overwriting for error checking)
      end if
    Next
  Next  
end for

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

If a cell ends up both IS_OVERWRITEN  and DEFINED, then write an error
message with the DEFINED and IS_OVERWRITTEN cell's names. 
Othrewise, create the HTML table:

go through the TABLE ARRAY. If there are any cells in it that are not
IS_OVERWRITTEN, do a "<TR...>"  "<TD ...>" "</TD>" "<TR>"  set of tags for
the table:

   for RowSpan = R to R + (rowspan of cell CELLINDEX) do

(Check to see if the row needs to be written at all)
    DRAWROW = FALSE
    for ColSPan = C to C + (rowspan of cell CELLINDEX) do 
      if IS_DEFINED(TABLE_ARRAY[R][C]) then 
        DRAWROW = TRUE
        exit for  
      end if
    end for
    if DRAWROW = TRUE THEN

      WRITE ("<TR><-- row " & R & "-->"
      for ColSPan = C to C + (rowspan of cell CELLINDEX) do 
         if not IS_OVERAWRITTEN(TABLE_ARRAY[R][C]) ) then 
(Write cell information for the Cells that are defined)    
           if IS_DEFINED(TABLE_ARRAY[R][C]) then 
             WRITE("<TD ROWSPAN=" & GETROWSPAN(
GET_DEFINED_BY_CELL_INDEX(TABLE_ARRAY[R][C]) )) & COLSPAN = " &
GETCOLSPAN(.
  ...
                 & "</TD>"
           else (Not defined, but not overwritten either)
		     WRITE("<TD><IMG SRC="TRANSPARENT.GIF" HEIGHT="1" WIDTH="1"></TD>") 
			 (note that the transparent gif is very necessary to keep tables from
collapsing.)
			 (Many sources suggest using an &NBSP; to fill empty cells; this can
bloat tables if
			 the tables are narrower or shorter than an actual blank character.)
           end if
        end if
      next
      WRITE ("</TR><-- row " & R & "-->"
    end if
  Next
  
djones@everest.walcoff.com wrote in article
<6jsiih$ajb$1@nnrp1.dejanews.com>...
> what I'm trying to do is write a perl script that takes an ascii file
that
> contains a table template like the on below and convert it into an HTML
table.
> 
> ----------------------------------------------------
>          |         |           |
>          |         |           ---------------------
>          |         |           |      |      |
> ----------------------------------------------------
> 
> The ultimate goal is to come up with an algorithem that would work an any
> template.  Any ideas?
> 
> -David
> 
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/   Now offering spam-free web-based newsreading
> 


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

Date: Tue, 19 May 1998 18:02:08 -0400
From: Arthur Dardia <ahdiii@webspan.net>
Subject: Cryptography in Perl?
Message-Id: <35620160.2EA8E1C6@webspan.net>

I'm learning Perl and am a complete NEWBIE to crytography.  I want to
learn about using encryption in Perl.  I searched around and found the
webpage for that "export-a-crypto-system sig" thing that a lot of ppl
post to Usenet with.  How does it help?  Any information?
alt.sources.crypto is dead.  Any other newsgroups that deal with crypto?

Also, I downloaded the Crypt mod...still trying to figure it out.  :/

                    Arthur Dardia



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

Date: 19 May 1998 21:42:00 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jsub8$23l$1@client3.news.psi.net>

Mike Heins (mikeh@minivend.com) wrote on MDCCXXII September MCMXCIII in
<URL: news:3561b53c.0@news.one.net>:
++ Leslie Mikesell <les@MCS.COM> wrote:
++ > In article <6jq9p0$bh3$1@client3.news.psi.net>,
++ > Abigail <abigail@fnx.com> wrote:
++ >>++ 
++ >>++ Postgresql is a nice free nearly-complete (lacks HAVING and a
++ >>++ few other things) SQL database: http://www.postgresql.org.  It
++ >>++ is actively supported and has a recently updated ODBC driver
++ >>++ that allows access from MS-windows.
++ >>
++ >>
++ >>That's a nice toy, but in a different league then sometimes is required.
++ >>Yes, I'm aware of all the nice free things. Some of them are wonderful.
++ >>I've nothing against free software, in fact, I'm pro-free software.
++ >>But just because Sybase and Postgresql are both RDBSs doesn't mean
++ >>one can replace the other.
++ 
++ > Where would you draw the line between trying Postgresql and going
++ > with Sybase/Oracle, etc.?   The main problem I see is that Postgresql
++ > doesn't have a built-in way to log transactions to alternate media
++ > between backups or to replicate among multiple servers so you are
++ > only as reliable as your hardware.  But, as long as we are talking about
++ > perl you can have the client log the important stuff.
++ 
++ PostgreSQL has major speed/scalability problems, in my opinion. It is more
++ than an order of magnitude slower than I would expect a database to be.
++ 
++ I like MySQL. Fast, free, support available, source available, and
++ getting better all of the time. It is moving nicely toward the point
++ where I would use it for mission-critical systems.
                            ^^^^^^^^^^^^^^^

Well, I do need a database for mission critical systems. "Moving toward
the point of" isn't acceptable.

Just because PostgreSQL and/or MySQL does fine for cgi programs doesn't
mean they are in the same ballpark as Sybase or Oracle.

What I (or rather, my company/our clients) need are:
   - Decent and scalable performance. Even if you have 60 databases
     on your server, 400 user connections and 20 Gb of disk space.
   - Concurrency. Hundreds of simultanious user connections.
     Multi engine support.
   - 24/365 tech support. World wide presence.
   - Permissions/security.
   - Replication.
   - Documentation. ("This section needs to be rewritten" just doesn't do it)
   - SQL 92 compliance.
   - Third party software has to be able to use it (say a Reuters feed). 
   - Open client applications/software.
   - RPC to different databaseservers.


Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: 19 May 1998 22:08:14 GMT
From: kfox@pt0204.pto.ford.com (Ken Fox)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jsvse$10m3@eccws1.dearborn.ford.com>

Bert Robbins <brobbins@tis.com> writes:
> Clinton Pierce wrote:
> > Jon Drukman <jsd@gamespot.com> writes:
> > > in what way will downloading gcc limit you on solaris vs
> > > what you would be able to do if you bought SUNpro?
> > 
> > Because I can ship production software to plants and not incur the
> > wrath of Ford Management if it's compiled under the Native C Compiler.
> > If people die because the C-Compiler screwed up, it's hard to sue
> > GNU--Sun Microsystems is another matter.
> 
> You haven't been reading the licensing agreements for the software you
> have been using have you? You will see the same disclaimer on just about
> all software saying that all they are responsible for when something goes
> wrong is to replace the defective distribution material that you received
> said software upon.

It isn't quite that simple.  Ford negotiates pretty hard sometimes.
Ford also has a separate purchasing group that supposedly shoulders
the liability for software errors.  We (Americans) live in a litigious
society -- software manufacturers forget that.  Unlike software
companies, if a car crashes due to product design problems, Ford is
liable for a whole lot more than "distribution material" replacement.

This might explain why our products are more reliable than Microsoft's. ;)

- Ken

-- 
Ken Fox (kfox@ford.com)                  | My opinions or statements do
                                         | not represent those of, nor are
Ford Motor Company, Powertrain           | endorsed by, Ford Motor Company.
Analytical Powertrain Methods Department |
Software Development Section             | "Is this some sort of trick
                                         |  question or what?" -- Calvin


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

Date: 19 May 1998 19:50:35 -0500
From: mikeh@minivend.com (Mike Heins)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <35621acb.0@news.one.net>

Abigail <abigail@fnx.com> wrote:
> Mike Heins (mikeh@minivend.com) wrote on MDCCXXII September MCMXCIII in
> <URL: news:3561b53c.0@news.one.net>:
> ++ I like MySQL. Fast, free, support available, source available, and
> ++ getting better all of the time. It is moving nicely toward the point
> ++ where I would use it for mission-critical systems.
>                             ^^^^^^^^^^^^^^^

> Well, I do need a database for mission critical systems. "Moving toward
> the point of" isn't acceptable.

I think mission-criticality is a different issue than either scalability
or support presence -- one can have a smaller mission which is still
critical. 8-)

That being said, I am not one of the people who maintains that free
software is the answer to everything -- I know that there is a reason
for an IBM mainframe, a Data General mini, and even a Microsoft Windows.

Free software is the answer for a fast-growing subset of problems.
It behooves us to adjust as time goes on. I think it is safe to say
that five years ago no company generating 100 million dollars per year
of revenue would base their production systems on FreeBSD or Linux --
but those companies exist today.

-- 
Mike Heins                          http://www.minivend.com/  ___ 
                                    Internet Robotics        |_ _|____
When the only tool you have is a    131 Willow Lane, Floor 2  | ||  _ \
hammer, all your problems tend to   Oxford, OH  45056         | || |_) |
look like nails.                    <mikeh@minivend.com>     |___|  _ <
 -- Abraham Maslow                  513.523.7621 FAX 7501        |_| \_\


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

Date: Tue, 19 May 1998 22:00:43 +0100
From: "Jeremy Goldberg" <jgoldberg@dial-but-dont-spam.pipex.com>
Subject: Re: file locking question
Message-Id: <6jsrvd$6ve$1@plug.news.pipex.net>

>open( MYFILE, "+<myfile" ) || die;
>while( <MYFILE> )
>    { }
>$lastline = $_;
>print MYFILE $freshline;


Now I think about it (a bit late, perhaps), that will probably result in a
$lastline of undef or ""... perhaps this instead:

open( MYFILE, "+<myfile" ) || die;
$lastline = "";
while( <MYFILE> )
{
    $lastline = $_
}
print MYFILE $freshline;




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

Date: Tue, 19 May 1998 17:14:14 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: file locking question
Message-Id: <3561F626.B1D7D766@negia.net>

Jeremy Goldberg wrote:
> 
> Ryan McGuigan wrote in message <6jslin$7lv$1@news12.ispnews.com>...
> >How can I read the last line of a file, and then append to it while having
> >it locked the whole time?
> 
> Try opening with a name prefix of "+<" (read/write, don't destroy contents),
> then scan through all the lines, discarding till you get till the end, and
> then just write:
> 
> open( MYFILE, "+<myfile" ) || die;
> while( <MYFILE> )
>     { }
> $lastline = $_;
> print MYFILE $freshline;
> 
> where $lastline is the lastline in the file, and $freshline is the line you
> want to add.

$_ is only defined within the while loop. i think you need something
to the effect of:

while( <MYFILE> ) {
  $lastline = $_;
}

if (&qualifies($lastline)) {
  $freshline = &getNewLine;
  print MYFILE $freshline;
}

cheers,

-- 
Dan Boorstein   home: danboo@negia.net  work: danboo@y-dna.com

 "THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
                         - Cosmic AC


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

Date: Tue, 19 May 1998 14:32:48 -0700
From: "C.W.Holeman II" <choleman@simpact.com>
Subject: grep variable value not its name.
Message-Id: <6jsteh$i9q@newshub.atmnet.net>

I am attempting to get the file name of a file that
may be located in a specifc directory. The name of the
file may have a dot followed by its type. The beginning
of the name will be the value of $part.

The following code fragment is not correct. How do
specify that I want the value of $part to match
in the names returned by readdir?

    opendir (DIR, "$MP100__ROOT/parts/$series");
    my @thispartfile = grep $part, readdir (DIR);
    closedir (DIR);

If $part were "ht-201-1111" and the list of files returned by
readdir were "ht-201-9999.pdf" "ht-201-1111.pdf". I want
to match on the second item only.

--
C.W.Holeman II                                              (619)503-1101
Configuration Management Specialist
Simpact Associates Inc.
choleman@simpact.com







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

Date: Tue, 19 May 1998 14:49:21 -0700
From: "C.W.Holeman II" <choleman@simpact.com>
Subject: grep variable value not its name.
Message-Id: <6jsuep$iqb@newshub.atmnet.net>

I am attempting to get the file name of a file that
may be located in a specifc directory. The name of the
file may have a dot followed by its type. The beginning
of the name will be the value of $part.

The following code fragment is not correct. How do
specify that I want the value of $part to match
in the names returned by readdir?

    opendir (DIR, "$MP100__ROOT/parts/$series");
    my @thispartfile = grep $part, readdir (DIR);
    closedir (DIR);

If $part were "ht-201-1111" and the list of files returned by
readdir were "ht-201-9999.pdf" "ht-201-1111.pdf". I want
to match on the second item only.

--
C.W.Holeman II                                              (619)503-1101
Configuration Management Specialist
Simpact Associates Inc.
choleman@simpact.com









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

Date: Tue, 19 May 1998 22:43:02 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
To: "C.W.Holeman II" <choleman@simpact.com>
Subject: Re: grep variable value not its name.
Message-Id: <8c1ztpx4p4.fsf@gadget.cscaper.com>

>>>>> "C" == C W Holeman <choleman@simpact.com> writes:

C> The following code fragment is not correct.

No kidding.

C>     my @thispartfile = grep $part, readdir (DIR);

hint: When is the expression $part false?  When is it true?

Do *not* be fooled by the name "grep".

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 104 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Tue, 19 May 1998 19:13:40 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: grep variable value not its name.
Message-Id: <comdog-ya02408000R1905981913400001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6jsuep$iqb@newshub.atmnet.net>, "C.W.Holeman II" <choleman@simpact.com> posted:

>The following code fragment is not correct. How do
>specify that I want the value of $part to match
>in the names returned by readdir?

>    my @thispartfile = grep $part, readdir (DIR);

grep doesn't quite work how you think it works.

consider the output of this little program:

   #!/usr/bin/perl
   
   @list  = qw(just another new york perl hacker);
   $" = ", ";
   
   foreach my $expression (0..1)
      {
      my @found = grep $expression, @list;
      print "$expression: @found\n";
      }
   
   __END__

you probably wanted to match $part to one of the elements of
the list that readdir() returns.  

    my @thispartfile = grep { $_ =~ /\Q$part\E/ }, readdir(DIR);

good luck :)

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


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

Date: 19 May 1998 23:20:03 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: grep variable value not its name.
Message-Id: <6jt433$sbl$4@comdyn.comdyn.com.au>

In article <6jsuep$iqb@newshub.atmnet.net>,
	"C.W.Holeman II" <choleman@simpact.com> writes:

> If $part were "ht-201-1111" and the list of files returned by
> readdir were "ht-201-9999.pdf" "ht-201-1111.pdf". I want
> to match on the second item only.

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

my $part = "ht-201-1111";
my @files = qw( ht-201-9999.pdf ht-201-1111.pdf );
my @grepfiles = grep { /^\Q$part/ } @files;

The ^ is to make sure it only matches from the start. The \Q is to
prevent interpretation of any special characters that might be in
$part.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Advertising:  The science of arresting
Commercial Dynamics Pty. Ltd.       | the human intelligence long enough to
NSW, Australia                      | get money from it.


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

Date: Tue, 19 May 1998 19:41:23 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: grep variable value not its name.
Message-Id: <fl_aggie-1905981941230001@aggie.coaps.fsu.edu>

In article <6jsteh$i9q@newshub.atmnet.net>, "C.W.Holeman II"
<choleman@simpact.com> wrote:

+ The following code fragment is not correct. How do
+ specify that I want the value of $part to match
+ in the names returned by readdir?
+ 
+     opendir (DIR, "$MP100__ROOT/parts/$series");
+     my @thispartfile = grep $part, readdir (DIR);

Simply:

      my @thispartfile = grep /$part/, readdir (DIR);

You want grep to match the contents of $part, thus you use the /value/
operator. Coincidentally, they're called match:

/$part/ is the same as m/$part/, or even m#$part# if you're biased against
/'s.

You can use a kewl regular expression to make the match more specific.
For instance, if you know that the contents of $part _always_ starts
at the beginning of the filename, you could:

grep /^$part/, readdir(DIR);

for instance.

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: Tue, 19 May 1998 21:49:01 GMT
From: dave@cybersigns.com (Dave)
Subject: Help with Win32::Internet
Message-Id: <3563fe03.13821881@news.newsguy.com>

i am trying to get constantly updating images from http server using
Internet module (Perl build 316)
images come down successfully, but every other image is a stale image
from minutes before.  it seems that the process (perlis.dll is not
letting go of the request/image). here's a snip of my code:
(we are using user authentication)

$INET = new Win32::Internet(); #creates a connection to internet
#opens internet connection to IP address specified in form
$INET->HTTP($HTTP, $ip, $serveruser, $serverpass); 
$HTTP->OpenRequest($REQUEST, "image.jpg", "GET", "HTTP/1.1");

while (time le $stoptimecounter) {
		
	$REQUEST->SendRequest();
	$f = $REQUEST->ReadEntireFile(); 
		
	open(OPENFILETEMP,
">C:/inetpub/wwwroot/kinderview/kivs/cams/$cameraip/$count\.jpg");
	binmode( OPENFILETEMP );
	print OPENFILETEMP $f;
	close(OPENFILETEMP);
	undef($f);
}

closing $INETor $HTTP doesn't help, in fact it prevents a connection.

respond to dave@cybersigns.com if possible. 


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

Date: Tue, 19 May 1998 21:29:14 GMT
From: "Deepak Khosla" <dkhosla@compaq.com>
Subject: Re: How to include a file that contains subs
Message-Id: <01bd836d$2cf3a1c0$b90e12ac@print-tst01>

Thanks everyone for the help. I did not want to use 'use' and stayed away
from even reading about 'require' since the docs suggested such - but
'require' in this case (or even 'do' with its documented limitations) will
do just fine!




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

Date: 19 May 1998 21:52:38 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: HTTP/1.0 501 Not Supported
Message-Id: <6jsuv6$aki@fridge.shore.net>

rickryan@ Mindspring (rickryan@mindspring.com) wrote:

: Who cares what you think about my non-related question, just answer it.

No.  Go someplace else.  

This has *NOT A THING* to do with Perl, and since you insist on asking
the question here (even though you admit that it doesn't belong here),
you are a selfish soul who *deserves* to be chided or ignored or both.

--
Nathan V. Patwardhan
you can send your poop to root@localhost if you wish


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

Date: 19 May 1998 22:05:49 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: I need help using the system command
Message-Id: <6jsvnt$91q$1@marina.cinenet.net>

Mark-Jason Dominus (mjd@op.net) wrote:
[Much good advice snipped]
: It might be better to do this:
: 
: 	@PRINTERS = qw(laf kent gcom fuji ci1000);
: 	$PRINTER_PAT = '^(' .  join('|', @PRINTERS) . ')$';

Or, for the paranoide,

  @PRINTERS    = qw(laf kent gcom fuji ci1000);
  @PRINTERS_Q  = map { quotemeta } @PRINTERS;
  $PRINTER_PAT = '^(' . join('|', @PRINTERS_Q) . ')$';

That way you don't get bitten if someone adds a printer named hp5.4 or
vector+ or whatever.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

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

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