[7986] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1611 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 9 20:07:38 1998

Date: Fri, 9 Jan 98 17:00:23 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 9 Jan 1998     Volume: 8 Number: 1611

Today's topics:
     Re: CGI to CGI?? <rootbeer@teleport.com>
     Re: controlling browser window propertys? <rootbeer@teleport.com>
     Re: Curses, depracated again! <rootbeer@teleport.com>
     Re: file glob restrictions?! (Greg Bacon)
     Re: Finding the TITLE to a HTML page (brian d foy)
     Re: Finding the TITLE to a HTML page <mhazen@franklin.uga.edu>
     Re: Finding the TITLE to a HTML page <mhazen@franklin.uga.edu>
     Re: How to read/write data to com port under Linux <bullock@toolcity.net>
     Re: How to send parameters to a perl script. <rootbeer@teleport.com>
     Re: How to send parameters to a perl script. <ric@megsinet.net>
     Re: Looking for a perl script... <rootbeer@teleport.com>
     Re: Looking for a perl script... <mhazen@franklin.uga.edu>
     Re: Perl CGI script's own directory (brian d foy)
     Re: Perl Question (Mick Farmer)
     perl scripts w/ frontpage 98 win95 <srn253s@cnas.smsu.edu>
     Re: Please Help - Simple global counter using a file <rootbeer@teleport.com>
     Problem with Getopt::Std <jfo@btinternet.com>
     RE:100 Levels deep in subroutine calls and recusrion rehana@allmedia.com
     req: A) Perl/Tk B) Permanter Perl-Interpreter unter oSo (TheTom)
     Re: Review of CGI/Perl book <merlyn@stonehenge.com>
     Scheduler service doesn't see Perl file associations?? <drath@dev.hcsd.hac.ca>
     Re: Server error 500 <rootbeer@teleport.com>
     Re: simple perl script to add directory to PATH if not  <*@qz.to>
     Re: Simple string length <merlyn@stonehenge.com>
     Re: Simple string length <rootbeer@teleport.com>
     Re: Solution Re: Help with passing parameters in URL's  <rootbeer@teleport.com>
     Re: substitution <rootbeer@teleport.com>
     Re: Testing for valid RegExps? <mhazen@franklin.uga.edu>
     weird problem! <ric@megsinet.net>
     Re: what is the meaning of "constant"? <sgordon@athena.lbl.gov>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 9 Jan 1998 16:41:06 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Matt Bieber <mattdb@syntrillium.com>
Subject: Re: CGI to CGI??
Message-Id: <Pine.GSO.3.96.980109163704.26737d-100000@user2.teleport.com>

On 9 Jan 1998, Matt Bieber wrote:

> Can anyone tell me if it's possible to call a perl cgi script from
> within a cgi script?

Sure, it's possible. It's not necessarily trivial, but it's possible. You
just follow the CGI specification, but from the server's side. OTOH, I
don't think that's what you're really wanting. 

> I have a machine which has a script that is processing form contents
> which then need to be emailed. Sendmail, however, resides on our second
> machine so it cannot be invoked from within the form processing script
> (or can it?). 

Don't ask us! :-)  It depends upon your setup. You could try it, or you
could ask your sysadmin. 

> I figure I could send the form contents to a cgi
> script on the sendmail machine which would then mail it. 

You could, but you'd probably be better off using one of the modules from
CPAN which lets you send mail directly. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 9 Jan 1998 14:26:39 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Mikael Henrikson <mikael.henrikson@edt.ericsson.se>
Subject: Re: controlling browser window propertys?
Message-Id: <Pine.GSO.3.96.980109142406.26737N-100000@user2.teleport.com>

On Fri, 9 Jan 1998, Mikael Henrikson wrote:

> I wan't my PERL-script to redirect the user and change the browser
> (Netscape or IE) window propertys (such as toolbar, locationbar). Can I
> do this from a PERL-script??? If so, how?

If you can do this from Perl, you'll use the same method that you'd use
from C or any other language. That's a clue that it's not a Perl-specific
question. If you have questions about browsers, a newsgroup about browsers
will be able to give you better and more complete answers than we can give
here. Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 9 Jan 1998 14:59:48 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Phil R Lawrence <prl2@lehigh.edu>
Subject: Re: Curses, depracated again!
Message-Id: <Pine.GSO.3.96.980109145407.26737T-100000@user2.teleport.com>

On 9 Jan 1998, Phil R Lawrence wrote:

> Is there an on-line list of all error messages? 

If Perl gives you a message which isn't explained in the perldiag manpage,
please file a bug report.

> Use of comma-less variable list is deprecated

This one is in there, but it's description is less than perfect. But it's
trying to tell you that in a format, the expressions providing the values
should be separated by commas. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!




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

Date: 9 Jan 1998 22:05:58 GMT
From: gbacon@adtran.com (Greg Bacon)
To: drummj@mail.mmc.org
Subject: Re: file glob restrictions?!
Message-Id: <696706$3ea$1@info.uah.edu>

[Posted and mailed]

In article <34b4c4a4.2306969096@news.mmc.org>,
	drummj@mail.mmc.org (Jeffrey R. Drumm) writes:
: On Wed, 7 Jan 1998 18:41:37 -0800, Tom Phoenix <rootbeer@teleport.com> wrote:
: >Globbing will (by default, in most cases) call /bin/csh to do the actual
: >work, and csh has a limit on what it can return. Although there are other
: >workarounds, I recommend that you use readdir and friends instead of
: >globbing. (That's faster than globbing, anyway.) Hope this helps! 
: 
: Looking through the Todo list on my local installation of Perl, I noticed that
: "built-in globbing" is listed as a "vague possibility".
: 
: Has this changed at all? I don't have more than a couple of years experience
: with Unix, but I've heard numerous times that trusting csh is unwise,
: given its variability across Unices.

I've (along with invaluable help from others) been working on a
replacement glob and actually have a working version for Unix (that's
100% identical to csh globbing--at least that's what the tests I have
so far say :-).  I don't have access to any Perlized machines to test it
for other platforms (I'm sure it will need some work for Win32, and I
have no idea about the others).  Patches, testers, and test cases
welcome! :-)

Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Fri, 09 Jan 1998 17:18:17 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Finding the TITLE to a HTML page
Message-Id: <comdog-ya02408000R0901981718170001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34B69098.EAC50B34@tcs.co.at>, mahe@tcs.co.at posted:

>
>   undef $/;
>while(<>){
>
>if (/<title>(.*)<\/title>/si){print $1;}
>}

hasn't it already been shown why this doesn't work?

-- 
brian d foy                                  <comdog@computerdog.com>
Fifth Avenue Disaster! <URL:http://computerdog.com/brian/fire/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Fri, 09 Jan 1998 19:40:17 -0500
From: Mark Hazen <mhazen@franklin.uga.edu>
To: scribble@pobox.com
Subject: Re: Finding the TITLE to a HTML page
Message-Id: <34B6C371.4603A19A@franklin.uga.edu>

Tushar Samant wrote:

> Why is it bad practice to have markup inside
> comments, though? This is not a Perl question, but I am curious,
> and asking a sincere question. What possible use can comments have
> with a restriction like that?

It's actually bad practice, because the HTML 4.0 definintion does not
specify that markup inside of comments should be ignored. Conversely, it
specifies that the contents of comments SHOULD be parsed, because one of the
prime uses of the SGML comment tags is to hide embedded script data (ala
Javascript) from the user, in case their browser cannot execute said script.

Just  a thought... :)

--

-mh.
----
   . _+m"m+_"+_   Mark Hazen    Network Administrator, Dean's Office
 d' Jp     qh qh             The Franklin College of Arts & Sciences
Jp  O       O  O             The University of Georgia (706)542-1546
Yb  Yb     dY dY
 O   "Y5m2Y"  "     even the mightiest wave starts out as a ripple.
  "Y_           why make waves when it's easier to nurture ripples?




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

Date: Fri, 09 Jan 1998 19:44:42 -0500
From: Mark Hazen <mhazen@franklin.uga.edu>
Subject: Re: Finding the TITLE to a HTML page
Message-Id: <34B6C47A.834A0864@franklin.uga.edu>

Tushar Samant wrote:

> Unless you are telling me not to *compose* HTML with comments
> in titles -- in which case I will point out that you have the
> bullying power of neither Netscape nor Microsoft.

Well, if he won't tell you not to do it, the standard will. From the W3
Consortium HTML 4.0 Spec document (this section in
{http://www.w3.org/TR/REC-html40/struct/global.html#edef-TITLE} )"
Titles may contain character entities (for accented characters, special
characters, etc.), but may not  contain other markup."

Just a thought.... :)

-mh.
----
   . _+m"m+_"+_   Mark Hazen    Network Administrator, Dean's Office
 d' Jp     qh qh             The Franklin College of Arts & Sciences
Jp  O       O  O             The University of Georgia (706)542-1546
Yb  Yb     dY dY
 O   "Y5m2Y"  "     even the mightiest wave starts out as a ripple.
  "Y_           why make waves when it's easier to nurture ripples?




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

Date: Fri, 09 Jan 1998 16:35:02 -0500
From: Ben Bullock <bullock@toolcity.net>
To: Fred J Keller <fred@ywl.com>
Subject: Re: How to read/write data to com port under Linux
Message-Id: <34B69806.4AB9CEA1@toolcity.net>

Fred J Keller wrote:

> I am trying to develop a perl program that will communicate with a
> Davis Instruments weather station via the comm port on a PC running RH
> Linux 4.2.  As a newbee to both Perl and Linxu I need some direction
> on the preferred approach to access the serial port.
> 
> Thanks in advance,
> 
> Fred
> 
> Fred
> fred@ywl.com
> 
> Yellow Wood Llamas
> Specializing in Pure Bolivian and Bolivian North American Crosses
> http://www.ywl.com/yw/yw.htm

Check out this URL: http://www.halcyon.com/sjm/wx/latest.shtml

The author has done essentially what you want to do and has software
available for downloading.  Although his package is specifically
designed to work with a Peet Brothers weather station, the techniques he
uses should help you a lot.


Plug: go to   http://www.geos.edinboro.edu/~bullock/weather_page.html 
      for a look at another fully automated weather station running 
      on a Linux box.  (Location is Edinboro University in Edinboro, PA)

-Ben Bullock


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

Date: Fri, 9 Jan 1998 16:16:39 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Dico Reyers <dico@peionline.com>
Subject: Re: How to send parameters to a perl script.
Message-Id: <Pine.GSO.3.96.980109161404.26737a-100000@user2.teleport.com>

On Fri, 9 Jan 1998, Dico Reyers wrote:

> Subject: How to send parameters to a perl script.

You send parameters to a Perl script in the same way you send them to any
other script.

> for example, if I had this in my html....
> 
> <a href="bin/xxxx.cgi"><img src="icon1.gif"></a>
> 
> when someone clicks on this link, the script should know that it is
> icon1.gif which they clicked.  

There's nothing Perl-specific about this; the script could be written in
virtually any language. But this sounds as if you're trying to make a CGI
script. The people in a newsgroup about CGI programming may be able to
give you better and more complete advice on CGI programming than we can
here. Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 09 Jan 1998 18:28:47 -0600
From: Ricky <ric@megsinet.net>
To: Dico Reyers <dico@peionline.com>
Subject: Re: How to send parameters to a perl script.
Message-Id: <34B6C0BF.D7DE1CFB@megsinet.net>

Dico Reyers wrote:

> Hi there,
>
> I am looking to build a perl script which will calculate some
> information for me.
>
> The way it should work is like this...
>
> there are many different icons a person can click on and it will load
> up a perl script (always the same script).  The thing is that the
> script should know which icon is calling the script.
>
> for example, if I had this in my html....
>
> <a href="bin/xxxx.cgi"><img src="icon1.gif"></a>
>
> when someone clicks on this link, the script should know that it is
> icon1.gif which they clicked.  similary there would be other links
> like above with icon2.gif and icon3.gif.
>
> how can I let the script know which one the person clicked on? and
> finally, how does this show up when the script is run?  in other
> words, what line of code is needed to for me to know which icon they
> pressed.
>
> Thanks in advance,
>
> Dico

what you can do is use an image in a form to send the script some data.
the only problem with this is, that when the image is clicked, the
browser will send the x,y coordinates of the image.  think of it as an
image map for forms.  so basically, you'll need a very small form like
this:

<FORM ACTION="path/to/script.cgi" METHOD="GETorPOST">
<INPUT TYPE="image" SRC="path/to/image.gif" NAME="icon"
VALUE="whatever">
</FORM>

so, you'll need to combine all your icons into one big image.  then,
when a user clicks on the image, you can test for the coordinates in
your program.  just remember that the coordinates are mapped out from
the top left hand corner of the image.  so the data sent resulting from
someone clicking on the image (according to the example above)  would
be:

icon.x=50&icon.y=50

so that would mean that the user clicked on the pixel located 50 pixels
to the right and 50 pixels down.  now, moving right along, you'd have to
know the coordinates of the areas of your icons.  so if the first icon
covers from (0,0) to (100,100) (meaning the icon is the first 100x100
pixels), then you can test for that in your script.  that is, of course,
assuming that you've parsed the query string and placed the coordinates
in variables like $coord_x and $coord_y.  once that is accomplished THEN
you can test the variables for the appropriate values like so:

if ($coord_x > 0 && $coord_y < =100) {
        &icon_one_process( );
} elsif ($coord_x >100 && $coord_y <=200) {
        $icon_two_process( );
}

the biggest disadvantage to this would be if you're planning to add or
remove icons.  that would mean that you'd have to change your script to
test for the new coordinates every time you change the image.  also, the
fact that you'd have to change the entire image holding all the icons,
just to change one icon.  so i would think about this carefully if i
were you.  if you aren't planning to do any changing frequently, like
maybe once or twice a year, i'd say what the heck!  go for it!  some
people would just advise you to use submit buttons.  well, i hope this
helps.  if it works, let me know.  take care buddy.

ricky



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

Date: Fri, 9 Jan 1998 14:09:05 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Dan Cash <dmcash@facstaff.wisc.edu>
Subject: Re: Looking for a perl script...
Message-Id: <Pine.GSO.3.96.980109140759.26737L-100000@user2.teleport.com>

On Thu, 8 Jan 1998, Dan Cash wrote:

> We have a problem with an application which is in the process of being
> moved to a new server and required some perl editing because of safety
> concerns from the new server's admin. The edits have caused the
> application to become unstable:  after several users have visited, it
> hangs at odd times. We're working on it, but the check means we have to
> hit the page and submit a form, many many times.  About a hundred,
> actually. 
> 
> We are looking for a simple perl script that might do that for us
> automatically. 

Do you mean you want a script which will hang at odd times? :-)

The most recent issue of The Perl Journal has a good article about
torture-testing webservers. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 09 Jan 1998 19:28:09 -0500
From: Mark Hazen <mhazen@franklin.uga.edu>
Subject: Re: Looking for a perl script...
Message-Id: <34B6C099.4D97D305@franklin.uga.edu>

Tom Phoenix wrote:

> Do you mean you want a script which will hang at odd times? :-)

Ooo! Oooo! I do! I do! :)

Might just be a useful addition to that BadProgrammer package I'm working on.
:)

-mh.
----
   . _+m"m+_"+_   Mark Hazen    Network Administrator, Dean's Office
 d' Jp     qh qh             The Franklin College of Arts & Sciences
Jp  O       O  O             The University of Georgia (706)542-1546
Yb  Yb     dY dY
 O   "Y5m2Y"  "     even the mightiest wave starts out as a ripple.
  "Y_           why make waves when it's easier to nurture ripples?




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

Date: Fri, 09 Jan 1998 17:22:46 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl CGI script's own directory
Message-Id: <comdog-ya02408000R0901981722460001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34b68890.524144494f47414741@radiogaga.harz.de>, MARTIN@RADIOGAGA.HARZ.DE posted:

>There are a couple of related Perl CGI scripts that pull in other files
>(e.g. for configuration) via require. 

require()-ing files for configuration?  there are much better ways
to do that.


>But how is perl supposed to find
>these, as the scripts' cgi-bin sub-directory isn't part of @INC? Is
>there a (portable) way for a Perl CGI script to get the directory it's
>situated in, in order to push it into @INC before attempting to require?

there is the Cwd module.  see the documentation of the details.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
Fifth Avenue Disaster! <URL:http://computerdog.com/brian/fire/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Fri, 9 Jan 1998 16:48:05 GMT
From: mick@picus.dcs.bbk.ac.uk (Mick Farmer)
Subject: Re: Perl Question
Message-Id: <EMJ005.1C2@mail2.ccs.bbk.ac.uk>

Dear Muhammed,

How about something like this.

while () {			# loop forever
	sleep 60;		# sleep for 1 minute
	next unless -r $file;	# file not arrived
	...			# process file
}

Regards,

Mick


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

Date: Fri, 09 Jan 1998 16:02:55 -0600
From: Steve Nell <srn253s@cnas.smsu.edu>
Subject: perl scripts w/ frontpage 98 win95
Message-Id: <34B69E8F.B8E05D3@cnas.smsu.edu>

perl scripts w/ frontpage98 win95

Is there a way to invoke the perl interpreter when I call a .pl cgi
script, or do I need to turn all of my pl files into executables or
batch files?



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

Date: Fri, 9 Jan 1998 14:03:46 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Matt Bieber <mattdb@syntrillium.com>
Subject: Re: Please Help - Simple global counter using a file
Message-Id: <Pine.GSO.3.96.980109140241.26737J-100000@user2.teleport.com>

On 8 Jan 1998, Matt Bieber wrote:

> I'm lite on Perl and was wondering what might be the best way to
> implement a simple counter in a file (to be used in a CGI situation to
> create an 'ID' number) which will be incremented++ each time the file is
> opened.

I think you could use the methods in Randal's fourth Web Techniques
column, which explains how to use flock() to avoid problems when multiple
processes need to modify one file. Hope this helps! 

   http://www.stonehenge.com/merlyn/WebTechniques/

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 10 Jan 1998 00:31:43 +0000
From: John Olsen <jfo@btinternet.com>
Subject: Problem with Getopt::Std
Message-Id: <34B6C16F.765B@btinternet.com>

I may be reading this wrong but from the Getopt::Std documentation:

"For each switch found, sets $opt_x (where x is the switch name) to
the value of the argument, or 1 if no argument."

So if my script is:

----------------------
#!perl

use Getopt::Std ;

getopts('h:lp:') ;

print "h = $opt_h\n" ;
print "l = $opt_l\n" ;
print "p = $opt_p\n" ;

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

and I type    myscript -h -l -p pathname filename

I would expect     opt_h = 1  (one)
                   opt_l = 1  (one)
                   opt_p = pathname
with @ARGV containing filename.

Instead I get      opt_h = -l
                   opt_l =
                   opt_p = pathname
with @ARGV containing filename.

The idea was to see the effect of supplying a switch but forgetting
the argument to the switch.

What am I missing? 

I initially tried this with Laszlo Molnar's Perl port (Hurrah!) on
a PC but I get the same effect on the sun solaris servers at work.



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

Date: Fri, 09 Jan 1998 16:01:29 -0600
From: rehana@allmedia.com
To: roehrich@cray.com
Subject: RE:100 Levels deep in subroutine calls and recusrion
Message-Id: <884382871.1035730956@dejanews.com>

My problem went when I renamed the XS routine "buildHTML" as
"Win32::XSBuildHTML". Note that I do not have to use "Win32::", it can be
anything. When level is deep, Perl treats XS routine "main::buildHTML"
same as Perl subroutine "buildHTML" and keeps calling recursively.

Here is my original Perl routine.
>sub buildHTML
>{
>        my ($src_pkg, $in_leafname,$user) = @_;
>
>        // The "main::" package is needed since our XS i part of
>        // our own "perl.exe" which we needed for Embedding Perl anyway
>        @status = main::buildHTML($src_pkg, $in_leafname,$user);
>
>        print "buildhtml() has been called....\n";
>        return @status;
>}

I am onto another problem now!.
-- rehana

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Fri, 09 Jan 1998 22:28:59 GMT
From: the.tom@usa.net (TheTom)
Subject: req: A) Perl/Tk B) Permanter Perl-Interpreter unter oSolaris
Message-Id: <6965tc$7kb$2@freenet-b.fen.baynet.de>


Hi Alle,

ich suche 2 Sachen:

A) Wo kann ich Perl/Tk fuer Win311 und WinNT kriegen/saugen?

B) Gibt es eine Moeglichkeit unter oSolaris (das is das SUN
Unix OS) Perl als permanenten Prozess zu starten, soda_ der
Overhead des Ladeprozesses beim Starten eines Perl-Scripts
entfaellt? Hierbei bin ich an ALLEN Infos interessiert...
selbst wenn ich das Perl-Script dann via Socket-Connection
an den Interpeter schicken muss.

tia
TheTom
---
sig censored in physical layer --- The Stack



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

Date: 09 Jan 1998 15:54:20 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Anthony David <adavid@netinfo.com.au>
Subject: Re: Review of CGI/Perl book
Message-Id: <8cbtxl6yxv.fsf@gadget.cscaper.com>

>>>>> "Anthony" == Anthony David <adavid@netinfo.com.au> writes:

Anthony> While we are at it, call me a purist if you will, but I was
Anthony> disappointed at Randall's inclusion of dbmopen in the 2nd
Anthony> Llama when it is a mere facade over the more intuitive tie
Anthony> function.

I don't consider tie "more intuitive".  The llama is meant to teach a
deliberate subset of workable Perl, getting the most results produced
while mastering the fewest number of concepts.  dbmopen() shows how to
"magically put a hash on disk".  If you want more power, you can go
down a level and do it yourself with tie, but that's more concepts and
not as great of a return for the 80% of the audience.

80% of Perl programs can be reasonably built from things shown in the
llama, even though there might be some additional shortcuts if you
know more stuff.  That's the purpose of the llama -- to get you
started, and get you productive.  And in my classes that I teach
nearly every week (on which the llama is based), they come out
*productive*.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 234 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: Fri, 09 Jan 1998 15:04:08 -0800
From: Dave Rathnow <drath@dev.hcsd.hac.ca>
Subject: Scheduler service doesn't see Perl file associations??
Message-Id: <34B6ACE8.59163045@dev.hcsd.hac.ca>

I installed Perl on my Windows NT Alpha and Intel servers  and
have an interesting problem.

We have the Scheduler service running under a username other than
SYSTEM. This user is a Domain Admin so the service has free run
of the machine and network.

I have been trying to use the AT command to schedule a Perl script
to run.  The Intel boxes work fine but on the ALPHA but nothing
seems to be happen.  After some investigating, I discovered that
the Scheduler is not seeing the association between .pl and the
Perl executable.  Here is an example of the at command:

at <time> c:\foo\bar.pl

when <time> passes on the ALPHA, the Perl script disappears but
does nothing; it doesn't even produce any output.  While on the the
Intel machine the script runs fine.  The event log shows nothing; if I
redirect the output to a file I get nothing.

I then ran the following  batch file using the AT command:

echo on
set
assoc .pl
ftype perl
c:\foo\bar.pl
junk

and got the following ouput:

D:\WINNT\system32>echo on

D:\WINNT\system32>set
COMPUTERNAME=SECRET
ComSpec=D:\WINNT\system32\cmd.exe
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Os2LibPath=D:\WINNT\system32\os2\dll;
Path=D:\WINNT\system32;D:\WINNT
PATHEXT=.COM;.EXE;.BAT;.CMD
PROCESSOR_ARCHITECTURE=ALPHA
PROCESSOR_IDENTIFIER=DEC-321064
PROCESSOR_LEVEL=21064
PROCESSOR_REVISION=3
PROMPT=$P$G
SystemDrive=D:
SystemRoot=D:\WINNT
USERDOMAIN=FOO
USERNAME=SCHEDSERV
USERPROFILE=D:\WINNT\Profiles\SCHEDSERV
windir=D:\WINNT

D:\WINNT\system32>assoc .pl
 .pl=Perl

D:\WINNT\system32>ftype perl
perl=C:\Perl5\bin\perl.exe %1 %*

D:\WINNT\system32>c:\foo\bar.pl

D:\WINNT\system32>junk

You will note that Perl is NOT in the PATH which is also strange
because it is has been set in the Control Panel/System/Environment and
it does show up in Console windows.  I even stopped and restarted
the Scheduler service a couple of time to see if this would update
the PATH variable but no luck.

I also tried changing "c:\foo\bar.pl" to "perl c:\foo\bar.pl".  Still
wouldn't work.  It finally worked with I changed the line to

c:\Perl5\bin\perl c:\foo\bar.pl

Only with a fully qualified path name did NT find, and run, the
script.

So I have two questions:
1. Why doesn't schedulre find the association with Perl?

2. What do I have to do to get the Scheduler service to
have the correct Path variable?

I should add that I am not having this problem on any of
my Intel servers?

Thank,
Dave.

PS. Cross-post to comp.lang.perl.misc and
microsoft.public.windowsnt.misc

--
Dave Rathnow
Raytheon Systems of Canada Ltd.
Richmond, B.C.
drath@dev.hcsd.hac.ca

         Surveys have shown that 8 out of 10 people
           believe sex is the ultimiate form of relaxation.
             Obviously these people have been fishing with
               the wrong pattern...




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

Date: Fri, 9 Jan 1998 14:23:38 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Ken <turboman34@hotmail.com>
Subject: Re: Server error 500
Message-Id: <Pine.GSO.3.96.980109142302.26737M-100000@user2.teleport.com>

On Fri, 9 Jan 1998, Ken wrote:

> 500 Server Error

When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN. Hope this helps!

   http://www.perl.com/CPAN/
   http://www.perl.org/CPAN/
   http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
   http://www.perl.org/CPAN/doc/manual/html/pod/

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 9 Jan 1998 23:53:30 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: simple perl script to add directory to PATH if not there already
Message-Id: <qz$9801091843@qz.little-neck.ny.us>
Keywords: from just another new york perl hacker

brian d foy <comdog@computerdog.com> wrote:
> randolph.a.bey@norwest.com posted:
> >I am hoping to someday be able to do this myself, but.....
> >does anyone have a perl script that adds a directory to a PATH if the
> >directory is not already in the PATH? So that it could be invoked as
> you can simply modify the environment variable for PATH.  however,
> if you won't be able to  modify the environment of the parent process.

Hmmm? Sounds like something an adb guru might be able to do. Sure you
might have to clobber something else in the environment, but who needed
that anyway? Particularlly not when you can get such spiffy code to
terrorize future maintainers with.

> perhaps you could explain the context of the problem so that we might
> offer wise solutions :)

Elijah
------
eval PATH=`case $PATH in *$new*) echo $PATH ;; *) echo $PATH:$new ;; esac`


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

Date: 09 Jan 1998 15:58:58 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: jdporter@min.net
Subject: Re: Simple string length
Message-Id: <8c7m896yq5.fsf@gadget.cscaper.com>

>>>>> "John" == John Porter <jdporter@min.net> writes:

John> Martien Verbruggen wrote:
>> 
>> $cnt = $string =~ tr/0-9//; # count the digits in $string

John> Ok, but why destroy the string?  Replace each digit with itself:

John>       $cnt = $string =~ tr/0-9/0-9/;

Heh... that's what the first one was doing.  If the right side is
empty, and /d is not in effect, then the string remains unchanged.

    $ perl
    my $test = "Randal\n";
    $test =~ tr/a-zA-Z//;
    print $test;
    ^D
    Randal
    $

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 234 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: Fri, 9 Jan 1998 15:02:12 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: John Porter <jdporter@min.net>
Subject: Re: Simple string length
Message-Id: <Pine.GSO.3.96.980109150056.26737U-100000@user2.teleport.com>

On Fri, 9 Jan 1998, John Porter wrote:

> Martien Verbruggen wrote:
> > 
> >     $cnt = $string =~ tr/0-9//; # count the digits in $string
> 
> Ok, but why destroy the string?  

He didn't. :-)

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 9 Jan 1998 13:59:34 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Vaughn Fox <vfox@nbnet.nb.ca>
Subject: Re: Solution Re: Help with passing parameters in URL's please
Message-Id: <Pine.GSO.3.96.980109135444.26737I-100000@user2.teleport.com>

On Fri, 9 Jan 1998, Vaughn Fox wrote:

> In case anyone is interested I stumbled onto a solution today for my
> problem with spaces in file names.  By changing the URL parameter

I'm glad that you've found the answer that took you so long to find.

Part of the reason it took so long may have been that you were looking in
the wrong place. Since the answer - changing a URL - would be the same
whether your code was written in Perl, C, or in any other language, yours
was not a language-specific problem. Instead, it sounds as if it was a
problem with making URLs, or perhaps with something like the Common
Gateway Interface (CGI), or with a protocol you were using (like HTTP).

If you have Perl problems which the docs can't solve, this newsgroup is a
good resource. But if it's not a Perl problem, you're likely to get
better, faster, and more complete answers from another source. 

Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 9 Jan 1998 15:03:30 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Colin Forde <c.forde@qub.ac.uk>
Subject: Re: substitution
Message-Id: <Pine.GSO.3.96.980109150248.26737V-100000@user2.teleport.com>

On Fri, 9 Jan 1998, Colin Forde wrote:

> Ive read a file of information into an array and would like to scan each
> line read and replace a string of the type sample@some.machine.somewhere
> with another email address read in as a string into variable $email.

You probably want to use Perl's s/// operator in a foreach loop. Hope this
helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 09 Jan 1998 19:25:20 -0500
From: Mark Hazen <mhazen@franklin.uga.edu>
Subject: Re: Testing for valid RegExps?
Message-Id: <34B6BFF0.2AB2BC1E@franklin.uga.edu>

Clay Irving wrote:

> >most obvious. ::sigh::
>                ^^^^^^^^
>
> Is this a new module?

Yep! Of my very own construct. It's part of the CheesyProgrammer package. Other modules
include ::damn, ::AsciiSpew,  and the ever popular ::AmIReallyGettingPaidForThis.

;-)

-mh.
----
   . _+m"m+_"+_   Mark Hazen    Network Administrator, Dean's Office
 d' Jp     qh qh             The Franklin College of Arts & Sciences
Jp  O       O  O             The University of Georgia (706)542-1546
Yb  Yb     dY dY
 O   "Y5m2Y"  "     even the mightiest wave starts out as a ripple.
  "Y_           why make waves when it's easier to nurture ripples?




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

Date: Fri, 09 Jan 1998 17:32:45 -0600
From: Ricky <ric@megsinet.net>
Subject: weird problem!
Message-Id: <34B6B39D.FB353F52@megsinet.net>

this is weird.  sometimes, my scripts don't work when they absolutely
should.  does anyone know why this happens?  i mean an extremely simple,
child's play script won't work like this one:

#!usr/local/bin/perl

print <<end
Content-type: text/plain

Hello World!
end
exit(0);

yet, this script on the same server in the same directory works.

#!/usr/local/bin/perl

$jpg_img = join ("/", $ENV{'DOCUMENT_ROOT'}, "image/email.jpg");

if (open (IMAGE, "<" . $jpg_img)){
 $byte_size = (stat ($jpg_img))[7];

 print "Content-type: image/jpeg", "\n";
 print "Content-length: $byte_size", "\n\n";

 print <IMAGE>;
 }

exit (0);

does anyone know why this happens.  i can't tell you how frustrating it
is to look for a bug when none exists.  please help. . . anyone?

ricky



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

Date: Fri, 09 Jan 1998 15:26:27 -0800
From: Shawn Gordon <sgordon@athena.lbl.gov>
Subject: Re: what is the meaning of "constant"?
Message-Id: <34B6B223.B9A750CB@athena.lbl.gov>

Hi Mariana,

The constant function is generated by h2xs when creating an
interface between perl and c-libraries.  To see the actual code
for constant(), take a look at the *.xs file that corresponds with
the *.pm file, and search on constant. 

Briefly though, the constant function allows you to access 'enum'
c-types or
other constants from your perl code. ie. suppose you have a enum typed:

enum Boolean {
	True = 1,
	False = 2
};
typedef enum Boolean Boolean

Then from perl you can do the following:

if(foo() == True) {do_something}

Where foo() is a function in the c-library that returns 'True' or
'False'.

Hope that helps,

shawn
 
Mariana Wuerz wrote:
> 
> I append the text of an AUTOLOAD subroutine because the meaning of
> line  4 is not clear for me.
> I could not find a function called constant and I cannot figure out the
> meaning of this word.
> Could you please tell me the way in which this word should be
> understood. Thanks!
> 
> 1: sub AUTOLOAD {
> 2: local($constname);
> 3 : ($constname = $AUTOLOAD) =~ s/.*:://;
> 4: $val = constant($constname, @_ ? $_[0] : 0);
> 5: if ($! != 0) {
> 6:     if ($! =~ /Invalid/) {
> 7:      $AutoLoader::AUTOLOAD = $AUTOLOAD;
> 8:      goto &AutoLoader::AUTOLOAD;
>     }
>           else {
>              ($pack,$file,$line) = caller;
>              die "Undefined Sybase::CTlib macro $constname, used at
> $file line $line. ";
>           }
> }


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

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

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