[12192] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5793 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 26 16:07:17 1999

Date: Wed, 26 May 99 13:01:29 -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           Wed, 26 May 1999     Volume: 8 Number: 5793

Today's topics:
    Re: perl script updating 2 frames? <emschwar@rmi.net>
    Re: perl script updating 2 frames? (Scott McMahan)
    Re: PERLFUNC: y/// - transliterate a string <tchrist@mox.perl.com>
        Q: Truncate a string <m-andric@uiuc.edu>
    Re: removings " "s from strings <cassell@mail.cor.epa.gov>
    Re: removings " "s from strings <tchrist@mox.perl.com>
    Re: req: directional help <cassell@mail.cor.epa.gov>
    Re: Running a perl script from an applet <jtashiro@ml.com>
    Re: s/// multiple lines in file from cmd line <otis@my-deja.com>
    Re: s/// multiple lines in file from cmd line <tchrist@mox.perl.com>
        system command to string (DATE) (BXTC)
        Why can't I use flock to mimic semaphores? HELP! <jhilgedi@indiana.edu>
        Wrapping perl funcs... <cgd@teleweb.pt>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 26 May 1999 12:04:44 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: perl script updating 2 frames?
Message-Id: <xkfk8tvg11f.fsf@valdemar.col.hp.com>

Olivier Maas <olivier.maas@at-lci.com> writes:
> Hello,
> I would like a Perl script to modify 2 frames in the web page.
> e.g. a page with 2 frames (Fram1 & Fram2)

This is not a perl question, it is a CGI question.  You should read the
comp.infosystems.www.authoring.cgi FAQ, in which you would learn that you 
Can't Do That(tm).  You can fake it, though.  RTFF to find out how.

-=Eric


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

Date: 26 May 1999 18:22:28 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: perl script updating 2 frames?
Message-Id: <374c3be4.0@news.new-era.net>

Olivier Maas (olivier.maas@at-lci.com) wrote:
> Hello,
> I would like a Perl script to modify 2 frames in the web page.
> e.g. a page with 2 frames (Fram1 & Fram2)

> I have a form being posted to a perl script in Fram2, Fram2 is modified
> simply with:
> $html=CGI->new; printing the header and printing the html page.

> but how do I do to also modify Fram1?

The only way you can do that is to use JavaScript in the output
HTML from the CGI program. You have to say document.framename.write
or whatever in a JavaScript to make something appear in a
different frame.

Scott


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

Date: 26 May 1999 12:34:23 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: PERLFUNC: y/// - transliterate a string
Message-Id: <374c3eaf@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, David Cassell <cassell@mail.cor.epa.gov> writes:
:s/transliterat/translat/;

Both Larry and I prefer it as currently written.

--tom
-- 
    "A journey of a thousand miles continues with the second step." --Larry Wall


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

Date: Wed, 26 May 1999 14:50:02 -0500
From: milan andric <m-andric@uiuc.edu>
Subject: Q: Truncate a string
Message-Id: <Pine.SOL.3.96.990526144657.8734A-100000@ux9.cso.uiuc.edu>


i'm trying to print only the first 8 letters of a string.. and i'm not
sure what to use.  perl has a function called truncate, but that doesn't
seem to work for strings and character truncation.  is the answer
somewhere in the deep world of regular expressions?

any tips?
m-andric@uiuc.edu



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

Date: Wed, 26 May 1999 11:24:18 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Daniel Vesma <daniel.vesma@thewebtree.com>
Subject: Re: removings " "s from strings
Message-Id: <374C3C52.7D842817@mail.cor.epa.gov>

Daniel Vesma wrote:
> 
> >   Where did you get your perl from?
> 
> Perl5 for dummies.

Oooh.  Did you really want to admit that?  On Usenet, for
everyone to see?  :-)

It's a bad book.  But since the people who buy it don't know
that, and don't know Perl, it can get away with murder.
In fact, in terms of getting away with murder, it's a serial
killer.  :-)

> >   Maybe the docs *are* there, but you just can't find them.
> 
> I looked at my install log for perl, and it says that "docs" was created,
> but there are no subdirectories. Maybe the install failed?

Maybe the install was as defective as the book.  I suggest
that you do this:

[1] go to www.activestate.com
[2] follow their surprisingly simple directions for
    downloading a *real* version of Perl, complete with
    documentation and everything
[3] unzip it with something like WinZip [which is also free]
[4] double-click and let it run its InStallShield Wizard and
    install itself for you.  Be sure to let it put its HTML
    docs on your system, with a shortcut on your Start menu.

Then you'll have a real, working Perl.  An up-to-date version.
And real docs, which are a lot cheaper and a lot more 
accurate than "Perl for Dummies who Can't Recognize a Ripoff".
The HTML docs have the complete Perl FAQ, and also the
ActivePerl FAQ for win32 stuff, which is an extra.  They
also have pages and pages of info on every function, everything
about regexen, subroutines, modules, you name it.

And the install comes with PPM, which will painlessly
install more modules for you, whenever you want.  The
modules have HTML pages in your new HTML tree, so you can 
read through them too.

Based on "Perl for Dummies" I would never buy one of those
'Dummies' books.  What, is "Sex for Dummies" going to tell 
you that supermodels actually like to be stalked?

Lord, I *hope* that's hyperbole.

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


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

Date: 26 May 1999 12:40:20 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: removings " "s from strings
Message-Id: <374c4014@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    David Cassell <cassell@mail.cor.epa.gov> writes:
:accurate than "Perl for Dummies who Can't Recognize a Ripoff".

Mistake #0: Perl is *not*for*dummies*!

:The HTML docs have the complete Perl FAQ, 

As does what I just ANNOUNCEd.

--tom
-- 
    echo "Congratulations.  You aren't running Eunice."
        --Larry Wall in Configure from the perl distribution


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

Date: Wed, 26 May 1999 11:08:42 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Bastiaan S van den Berg <office@asc.nl>
Subject: Re: req: directional help
Message-Id: <374C38AA.389C0914@mail.cor.epa.gov>

[courtesy cc sent to poster]

Bastiaan S van den Berg wrote:
> 
> oh man!!!!
> 
> great tutorial , it is allready learning me everything i ever wanted to know
> :)
> btw. is that perlmonth.com down or something? i can't look it up from here..

I just checked, and it's up.  Maybe it's my karma.  :-)

You did try this URL with no typos, right?

http://www.perlmonth.com/articles//rtfm.html

That's a double-slash after 'articles'. 

> cul8r
> buZz
> 
> >> i'm a young internet enthousiast that is starting to look at perl for
> easy
> >> to maintain , template driven , database-like approaches to normal
> webpages
> >
> >Good choice.  But you'll probably need to learn enough Perl to be
> >able to recognize bad Perl programs when you find them on the
> >Web.  Trust me, there are more bad ones out there than good ones.
> 
> well , the idea is to code my own stuff , i have some years of
> basic/pascal/c++/html experiance , and perl is a logical step onwards.
> 
> >Sturgeon's Law certainly applies to the Web.
> 
> what's his law??

Sturgeon's Law: "90% of everything is crap."
Cassell's Corollary: "If Ted Sturgeon had seen the Web, he 
would have upped that percentage."
 
> >You might also want to read this article, which will tell you
> >how to look things up in the extensive Perl docs:
> >   http://www.perlmonth.com/articles//rtfm.html
> 
> >Unfortunately, it doesn't help to use AltaVista with
> > +perl +tutorial +dbi +not_full_of_hideous_errors
> 
> nope , it doesn't :)
> 
> >But you can use Deja to look through posts in this newsgroup
> >about DBI and DBD issues, and glean dozens of good code
> >samples.
> 
> yeah , i figured..

Well, there's tons of reliable stuff in various webplaces.
If you're considering MySQL, you could go to Jay Flaherty's
http://mysql.turbolift.com/mysql/DBD_3.21.X.html   .
 
HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Wed, 26 May 1999 14:49:34 -0400
From: John Tashiro <jtashiro@ml.com>
Subject: Re: Running a perl script from an applet
Message-Id: <374C423E.D2550362@ml.com>

If you have the perl script set up as a CGI, and want to run it with
parameters, do the following.

 URL url = new URL("http://web/myscript.pl?Flag=1&Mode=2);   // Create the
URL
         url.openConnection().setDefaultUseCaches(false);   // disable
browser caching
         url.openConnection().setUseCaches(false);   // disable brower
caching

This will create a URL, run the script, and leave you in position to call
openStream so that you can read the output from perl if you choose.



"Denley, Jake (EXCHANGE:FITZ3:9D14)" wrote:

> I have a perl script that I want to call from my Java applet.  The
> script takes two parameters, which I would like to pass from the
> applet.  Is it possible to run a perl execuatable from the applet?  The
> script will simply create a file which I will be using later on in the
> applet.
>
> Is this possible and if so how is it done?
>
> Jake Denley
> jaked@comnet.ca



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

Date: Wed, 26 May 1999 18:38:57 GMT
From: Otis Gospodnetic <otis@my-deja.com>
Subject: Re: s/// multiple lines in file from cmd line
Message-Id: <7ihf41$68c$1@nnrp1.deja.com>

In article <FCBDo6.4Au@news.boeing.com>,
  ced@bcstec.ca.boeing.com (Charles DeRykus) wrote:
> In article <7idbfr$692$1@nnrp1.deja.com>,
> Otis Gospodnetic  <otis@my-dejanews.com> wrote:
> >Hello,
> >
> >I was wondering if it is possible to replace something like this:
> >
> >message_footer      <<  END
>
>-----------------------------------------------------------------------
-
> >To UNSUBSCRIBE send a message to $LIST-request@mysite.com with
> >UNSUBSCRIBE in the body of the message.
>
>-----------------------------------------------------------------------
-
> >END
> >
> >with:
> >message_footer      <<  END
> >END
> >....
>
> Another possibility if there's a file too big to slurp:
>
> perl -pi.bak -e '/-{60,}/ && $s++;s/.*//s if $s;$s %= 2' *.config

The first suggestion worked nicely (how/where does one learn about that
-0777 thing??)

As for this suggesiton - what is the limit on the file size for
slurping? :)

Thanks,

Otis


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


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

Date: 26 May 1999 13:05:23 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: s/// multiple lines in file from cmd line
Message-Id: <374c45f3@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    Otis Gospodnetic <otis@my-deja.com> writes:
:As for this suggesiton - what is the limit on the file size for
:slurping? :)

What is the limit of your virtual memory?  Check your swap space.

--tom
-- 
    "If you think Emacs is such a great editor, just look what it did for
     Richard Stallman's typing skills!"


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

Date: Wed, 26 May 1999 19:36:40 GMT
From: "(BXTC)" <bxtc@forfree.at>
Subject: system command to string (DATE)
Message-Id: <374D579E.64A496B4@forfree.at>

To start let me tell you I am new to Perl.  This is what I need:
	I need to get the date from my system (linux) and put the output into a
string.
	I read from someone else's post(and perldoc -f system), that calling
'date' from the system is not good because it isn't intended to capture
the output, and someone said exec might be better.  And perldoc was
saying that system is almost the same thing as exec LIST but after
reading some it looks like exec doesn't return to the program, so when I
use it, it just spits out the output and exits the program.

So, can anyone help me out and point me in the right direction?  I can
probably figure it out if I had some places to look(or rather knew what
to look for), I mean I don't know what to look for, I've gone through
perldoc for stuff I think should be related, but can't get it to work. 
I would greatly appriciate a little help.  I figure this is pretty easy
I am just new and missing something.  Thanks in advance,

-- 
(BXTC) ICQ# 23289202


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

Date: Wed, 26 May 1999 14:52:06 -0500
From: "John Hilgedick" <jhilgedi@indiana.edu>
Subject: Why can't I use flock to mimic semaphores? HELP!
Message-Id: <7ihiu0$5pu$1@jetsam.uits.indiana.edu>

Hello group,

I've got a web-based application that uses files (on the filesystem, natch)
and want to protect the files from competing processes.

I've been looking around.  The perl semop functions appear to only work for
System V servers.  There is a Thread module which is great if the competing
threads are in the same program.  There's also a Win32::Semaphore module
which is great if you aren't running on Unix...

I'm wondering what the disadvantage is to just using flock.  flock works on
unix and on any other server that implements fcntl (I believe that win32
supports this).  I've written 2 functions - one for waiting until you get a
"named" semaphore (a file) for exclusive write - the other to release a
"named" semaphore (by closing the same file).

I've written a couple of competing scripts that attempt to grab the same
semaphore - and so far everything seems to work fine.  I'm not sure what the
problem is.  To set a semaphore, you block until you are able to lock a file
that represents a semaphore for exclusive write.  To release a semaphore,
you close the file representing the semaphore (releasing the lock).

Any ideas as to what sort of problems this could cause?

1. Perhaps the processes will not block "in order" (a semaphore is already
grabbed by user 1 and user 2 tries to get it and blocks then user 3 tries to
get it and blocks then user 1 releases the semaphore and user 3 gets it
instead of user 2).
2. fcntl not really supported under win32
3. blocking may timeout on some systems
4. ???

I feel that I must be missing something or there would be a nice Semaphore
module that promised to work under Unix and NT.  What am I missing here?

Any light you can shed would be very helpful,

-john





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

Date: Wed, 26 May 1999 19:51:49 +0100
From: "Carlos J. G. Duarte" <cgd@teleweb.pt>
Subject: Wrapping perl funcs...
Message-Id: <374C42C5.956B4687@teleweb.pt>

Hello.

I wrote a script.  A nice script.  That script uses some perlfuncs, than
interact with system, like unlink, mkdir, ...

Now, I would like to add three options (but could be just one, for the
matter), like: -n dont do any thing, -v print something while working,
-i asks before does. 

The naive way, is to browse all the source, and do lots of :

	if ($opts{'i'}) {
		print "Do you like to rmdir $dir? \n"; 
		...
		...
	}
and the same for the other options. 

A cute solution, was to wrap all calls, i.e. replace mkdir, per _mkdir,
and so on,
and then one would program &{"_$func"} = sub { if ($opts{i}) ....
&{$func}(@_); }

Is this doable? I am not having much luck calling "func @_", and I'm not
even
have started the sym refs stuff! 

--
carlos


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

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

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