[17003] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4415 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 23 21:06:22 2000

Date: Sat, 23 Sep 2000 18:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <969757507-v9-i4415@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 23 Sep 2000     Volume: 9 Number: 4415

Today's topics:
    Re: - For this type of use (see msg), should I favor Pe (Tim Hammerquist)
    Re: - For this type of use (see msg), should I use Perl (Tim Hammerquist)
        another newbie question <nospam-sven@ektros.com>
    Re: another newbie question <bwalton@rochester.rr.com>
    Re: another newbie question (Martien Verbruggen)
    Re: another newbie question (Maurice E. Jarrell)
    Re: Candidate for the top ten perl mistakes list <rosie@dozyrosy.plus.com>
        connecting to MySQL <abatec@seattleu.edu>
        Displaying form Data <Rome22ro@pharmacy.arizona.edu>
    Re: Displaying form Data (Abigail)
    Re: getting images with LWP? <bbowden@mitre.org>
    Re: How do I shut down an oracle database from perl scr <randy_734@my-deja.com>
    Re: matching a date <bwalton@rochester.rr.com>
    Re: multiple ties to a single DB_file <bwalton@rochester.rr.com>
    Re: PERL Script in a backgroung <mc@backwoods.org>
    Re: popup_menu problems  <rosie@dozyrosy.plus.com>
        Testing file for directory: doesn't work hiroshiishii@my-deja.com
    Re: Time Zone conversion <noone@nospam.com>
    Re: Time Zone conversion <noone@nospam.com>
    Re: Using perl scripts for picture rollover effect in H (Tim Hammerquist)
    Re: variable -> constant? <nconway@klamath.dyndns.org>
    Re: variable -> constant? <nconway@klamath.dyndns.org>
    Re: variable -> constant? (Abigail)
    Re: variable -> constant? <mauldin@netstorm.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 23 Sep 2000 22:10:45 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: - For this type of use (see msg), should I favor Perl or PHP3?
Message-Id: <slrn8sqbcg.ke.tim@degree.ath.cx>

Tony L. Svanstrom <tony@svanstrom.com> wrote:
> Not really, with CGI you start a new process with each script, that
> doesn't happen with PHP. [*]
> 
> 
>      /Tony
> [*] A little to simplified, but true enough.

CGI pretty much requires a new process for each request.  I suppose you
could have a separate process in the background that answers requests as
received, but I'm not sure if that is technically CGI.

PHP, ideally anyway, doesn't create a new process for each
request....unless you run the CGI version of PHP, which seems to be a
favorite for Win32 platforms.

OTOH, Perl is ideally run in the same process as the server (aka
mod_perl).  There are some differences in environment and namespaces
between CGI and Apache/mod_perl, but many scripts run in both
environments unchanged.

Just _had_ to throw some semantics in there.  Apologies. =)

HTH,
-- 
-Tim Hammerquist <timmy@cpan.org>

guru, n:
	A computer owner who can read the manual.


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

Date: Sat, 23 Sep 2000 22:32:21 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: - For this type of use (see msg), should I use Perl of PHP3?
Message-Id: <slrn8sqcku.ke.tim@degree.ath.cx>

[Removed cz.comp.lang.php from NG list to protect us (ok, me) =)]

Jon <vemba72@hotmail.com> wrote:
> I am launching a new site and I have the option of having all my file
> splicing and parsing (templates and whatnot) done either via Perl (.cgi) or
> PHP (.phtml)  That will be 90% of the use of the script... assemble
> templates + raw files, breaking files down into multiple "click here for
> page 2/3/etc" pages... etc...

Splicing and parsing...sounds like an ideal job for Perl.

> ASP is not an option, I'm on UNIX.

Apache/mod_perl/Apache::ASP allows you to take advantage of a very rich
implementation of the ASP object model using everybody's favorite script
language: Perl.

TMTOWTDI[*]

> I keep hearing different stories about which of the two (Perl vs CGI)
> performs better on large loads (you'd think I was talking about a laundry
> detergent wouldn't you?)

An in-process PHP implementation will be able to process more requests
faster than a CGI -> Perl system.  Apache/mod_perl lets you run Perl
scripts in-process, without sacrificing flexibility or power by using
PHP.

> Perl or PHP3?

As someone else asked: What answer do you expect from comp.lang.perl.*?
I see you've cross-posted to a php NG as well.  What answer did you
expect from them?  ;)

> PS: The server admin told me he had to shut down several sites earlier this
> year because of Perl scripts... too many hits, and every hit ran the
> template-grabbing CGI.  He said sites that get less hits but use Perl tax
> the server more than sites that get more hits but use PHP... somehow, PHP
> opens and closes fewer files (that's how it was explained to me) so he's
> strongly pushing for PHP.  Is this all just BS?

This could very well be true.  I've often found that the sysadmin comes
the closest to knowing what really goes on in a web-based company, as
opposed to tech-support who are basically people off the street given
scripts to ask questions like, "Well, is your modem plugged into the
wall?"

This my no means that the scenario your sysadmin described is the only
way it _can_ be.  It's quite possible your sysadmin is partial to PHP,
but too many people in this industry are operating the same way you
appear to be running: flying blind, relying on buzzwords and the
incomplete, biased knowledge of arrogant programmers such as myself. ;)

Research it yourself.  But here's a simplified breakdown of PHP and
Perl:

	PHP was created to simplify the creation of dynamic web pages and
	facilitate database integration.  Most things not critical to this
	goal were placed on the back burner or added as an afterthought.

	Perl was designed to do what you asked.  It's right there in the
	PERL acronym itself: Practical Extraction (and) Report Language.
	Text-file processing was one of it's major goals.  Despite it's
	emphasis here, Perl has become so widely used to dynamic web page
	creation that Perl and CGI are synonymous in (way too) many circles.
	
	Besides, if you ever need anyone to program anything outside of a
	web page, PHP has just become a non-issue.  Whereas, Perl is
	everywhere.

Research it some more on your own:
	http://www.php.org/
	http://www.perl.org/
	http://perl.apache.org/

-- 
-Tim Hammerquist <timmy@cpan.org>
Perl can certainly be used as a first computer language, but
it was really designed to be a *last* computer language.
	-- Larry Wall


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

Date: Sun, 24 Sep 2000 00:19:15 +0200
From: "Sven" <nospam-sven@ektros.com>
Subject: another newbie question
Message-Id: <newscache$7q0d1g$v39$1@news.freegates.be>

since I'm new I guess this question could have been asked before but
anyway...

I'm looking for a way to include files with functions.

for example you put all your common functions in one file called common.pl
and then in your main file you do something like in C #include "common.pl"

tnx for any help




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

Date: Sat, 23 Sep 2000 22:29:44 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: another newbie question
Message-Id: <39CD2EEB.7722B034@rochester.rr.com>

Sven wrote:
> 
> since I'm new I guess this question could have been asked before but
> anyway...
> 
> I'm looking for a way to include files with functions.
> 
> for example you put all your common functions in one file called common.pl
> and then in your main file you do something like in C #include "common.pl"
> 
> tnx for any help

See:

    perldoc -f require

and maybe:

    perldoc -f use

-- 
Bob Walton


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

Date: Sun, 24 Sep 2000 09:37:18 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: another newbie question
Message-Id: <slrn8sqc4u.jr6.mgjv@martien.heliotrope.home>

On Sun, 24 Sep 2000 00:19:15 +0200,
	Sven <nospam-sven@ektros.com> wrote:
> since I'm new I guess this question could have been asked before but
> anyway...

Reasonably often.

Do you know about www.deja.com? They keep an archive there of stuff
posted to Usenet.

> I'm looking for a way to include files with functions.

# perldoc -f require
# perldoc -f do
# perldoc -f use

Slightly related:

# perldoc perlmod

In other words: If you have perl installed, you also have the perl
documentation installed, as well as a tool to access that documentation.
Read some documentation, and learn to use the perldoc tool. Start with

# perldoc perldoc
# perldoc perl

If you have an ActiveState installation of Perl, you should have some
HTML files installed somewhere _as well as_ the pod documentation. 

Martien
-- 
Martien Verbruggen              | Since light travels faster than
Interactive Media Division      | sound, isn't that why some people
Commercial Dynamics Pty. Ltd.   | appear bright until you hear them
NSW, Australia                  | speak?


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

Date: Sat, 23 Sep 2000 23:22:09 GMT
From: mejarrell@worldnet.att.net (Maurice E. Jarrell)
Subject: Re: another newbie question
Message-Id: <m3ya0jj9m7.fsf@localhost.localdomain>

Bob Walton <bwalton@rochester.rr.com> writes:

> See:
> 
>     perldoc -f require
> 
> and maybe:
> 
>     perldoc -f use
> 

also: perldoc -f do

HTH,

Mo.


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

Date: Sat, 23 Sep 2000 23:11:29 +0100
From: Rosemary I H Powell <rosie@dozyrosy.plus.com>
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <MPG.1435cae066baa5539896d3@usenet.plus.net>

In article <s0dy5.1995$hD4.575937@news1.rdc1.mi.home.com> dated Thu, 21 
Sep 2000 00:55:52 GMT,  our revered colleague Clinton A. Pierce 
(clintp@geeksalad.org) was so kind as to advise ...

> [Posted and mailed]
> 
> In article <Pine.GSO.4.21.0009201131470.15465-100000@crusoe.crusoe.net>,
> 	Jeff Pinyan <jeffp@crusoe.net> writes:
> >>> 1: didn't use -w
> >>> 2: didn't use strict
> >>> 3: didn't test the results of an "open"
> >>> 4: listened to anything godzilla said
> >>  5: didn't read perldoc -f localtime
> >    6: uses @array[$index] where $array[$index] should be used
> 
> Based on several years of teaching perl, looking at code written by 
> newbies, feedback from a book, and posting to Usenet...
> 
> "purl, clintp's top ten list?"
> 
> 	Top ten mistakes newbies make 
> ....
1) asked cgi questions in clpm
2) asked cgi questions in clpm
3) asked cgi questions in clpm
4) asked cgi questions in clpm
5) asked cgi questions in clpm
6) asked cgi questions in clpm
7) asked cgi questions in clpm
8) asked cgi questions in clpm
9) asked cgi questions in clpm
10) asked cgi questions in clpm

:-)

Rosemary
(Just Another Microsoft Idiot)
-- 
----------------------------------------------------------------
| Rosemary I.H.Powell  EMail: Home: rosie@dozyrosy.plus.com    |
|                             Work: r.i.h.powell@rl.ac.uk      |
|                       http://NeedleworkSamplers.com/         |
|                       http://www.CavalierKingCharles.com/    |
----------------------------------------------------------------


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

Date: Sat, 23 Sep 2000 11:08:07 -0700
From: "Chris" <abatec@seattleu.edu>
Subject: connecting to MySQL
Message-Id: <Dnaz5.1704$R05.235424@news.uswest.net>

How can I use Perl and CGI to connect to a MySQL Database.  I want to be
able to connect using DBI but the webmaster at the server I signd up on said
it probably isn't setup.  So how do I set it up or what other way is there
to connect to the database?

Thanks,
Chris




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

Date: Sat, 23 Sep 2000 16:55:11 -0700
From: "Andrew V. Romero" <Rome22ro@pharmacy.arizona.edu>
Subject: Displaying form Data
Message-Id: <39CD42DF.449E315A@pharmacy.arizona.edu>

I have the following test html form:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html><head>   <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">   <meta name="Author" content="romero">   <meta
name="GENERATOR" content="Mozilla/4.7 [en] (Win95; U) [Netscape]">
<title>Test</title></head><body>
<form action="mailprint.pl" method="POST">Your Name:&nbsp;<input
type="text" name="name">Email
Address:&nbsp;<input type="text" name="email">Age:&nbsp;<input
type="text" name="age">Favorite
Color:&nbsp;<input type="text" name="favorite_color"><input
type="submit" value="Send"><input type="reset" value="Clear
Form"></form></body></html>

and I was wondering how to make mailprint.pl that simply displays (in
html) what the user entered into the form.  I have tried several things
but nothing seems to work.
Thanks,
If you want to reply personally, remove the numbers from my address.
--
Andrew V. Romero
Romer1999o@pharmacy.arizona.edu
Remove the #'s from my address to reply.
http://www.u.arizona.edu/~avr/
ICQ #54080914




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

Date: 24 Sep 2000 00:36:55 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Displaying form Data
Message-Id: <slrn8sqj2t.lo9.abigail@alexandra.foad.org>

Andrew V. Romero (Rome22ro@pharmacy.arizona.edu) wrote on MMDLXXX
September MCMXCIII in <URL:news:39CD42DF.449E315A@pharmacy.arizona.edu>:
)) I have the following test html form:
)) <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
)) <html><head>   <meta http-equiv="Content-Type" content="text/html;
)) charset=iso-8859-1">   <meta name="Author" content="romero">   <meta
)) name="GENERATOR" content="Mozilla/4.7 [en] (Win95; U) [Netscape]">
)) <title>Test</title></head><body>
)) <form action="mailprint.pl" method="POST">Your Name:&nbsp;<input
)) type="text" name="name">Email
)) Address:&nbsp;<input type="text" name="email">Age:&nbsp;<input
)) type="text" name="age">Favorite
)) Color:&nbsp;<input type="text" name="favorite_color"><input
)) type="submit" value="Send"><input type="reset" value="Clear
)) Form"></form></body></html>
)) 
)) and I was wondering how to make mailprint.pl that simply displays (in
)) html) what the user entered into the form.  I have tried several things
)) but nothing seems to work.


I give you the first lines of your program, and you take it from there, ok?


    #!/usr/local/bin/perl -wT

    use strict;
    use CGI;

And here's the last line, as a bonus:

    __END__


Abigail
-- 
perl -we '$_ = q ;4a75737420616e6f74686572205065726c204861636b65720as;;
          for (s;s;s;s;s;s;s;s;s;s;s;s)
              {s;(..)s?;qq qprint chr 0x$1 and \161 ssq;excess;}'


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

Date: Sat, 23 Sep 2000 20:11:34 -0400
From: Bruce Bowden <bbowden@mitre.org>
Subject: Re: getting images with LWP?
Message-Id: <39CD46B6.46F7FB79@mitre.org>

Martien Verbruggen wrote:

> Why not
> 
> get($var);
> 
> ?
> 
> Unless you know why get("$var") and get($var) are potentially different,
> you shouldn't quote your variables.

force of habit, I guess. From now on I will abandon quotes whenever
possible!


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

Date: Sun, 24 Sep 2000 00:48:14 GMT
From: Randy <randy_734@my-deja.com>
Subject: Re: How do I shut down an oracle database from perl script
Message-Id: <39cd4d5e.127507156@207.126.101.100>

"orassilv" <ssilv@rochester.rr.com> wrote:

>I am trying to shutdown an Oracle database.
>In unix I would have in my bourne shell script the following:
>
>ORACLE_SID=abcd; export ORACLE_SID
>svrmgrl <<EOF
>connect internal
>@some_sql_script
>shutdown immediate
>exit
>
>I have tried this in perl - no good - any ideas how to do this for
>perl/nt4.0?


While reading "Learning Perl" (the gecko version, not the llama),
chapter 14, I learned how to use a process as a filehandle.  This
works perfectly to shut down an Oracle DB, without shutting down the
service.

$sid="mysid";
$pass="mypass";
$ENV{'oracle_sid'}=$sid;
open (P, "|svrmgr30");
print P "connect internal\n";
print P "$pass\n";
print P "shutdown immediate\n";
close (P);

HTH
Randy Harris

PS - LOVE the book.  Perfect for a beginner (like me).  I am
dumbfounded by the negative reviews on the ORA site.

>
>
>Thanks,
>orassilv
>
>



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

Date: Sat, 23 Sep 2000 23:33:06 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: matching a date
Message-Id: <39CD3DC4.5838359A@rochester.rr.com>

tuple wrote:
> 
> Hello,
> 
> How can i match a date given in something like this:
>     Exchange   2000-09-23  19:37:25    EST
> 
> /\b20[0-9]{2}-[0-1][0-9]-[0-3][0-9]\b/ would work
> but would match  2000-19-39 too.
> 
> I' ve search comp.lang.perl.* with the pattern "date" in a
> power search but it returns nothing !! Very strange.
> 
> Pierre Bachelart

You could feed the result of your match above into the ParseDate
function of the Date::Manip module, and test for an error (false value
returned).
-- 
Bob Walton


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

Date: Sat, 23 Sep 2000 23:05:16 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: multiple ties to a single DB_file
Message-Id: <39CD373E.1C2D93F1@rochester.rr.com>

"Tony L. Svanstrom" wrote:
> 
> Ok, I've been exploring lots of fun (NOT) memory-related problems with
> tie:ing and MacPerl today... and before I spend yet another day trying
> something, that this time won't work, I thought I'd ask if it even is
> possible to tie more than one hash to a single DB_File-file.
> 
> Out of habit I've mostly used plain text-files in the past, and since I
> haven't tried anything like this in the past I don't know where the
> limitation might be... and since not even MacsBug can save me from a
> restart when MacPerl goes down I don't feel like testing every single
> combination I can think of.
> 
> So... Anyone here that can give me an answer to this simple question?
> 
>      /Tony
 ...

My little experiment shows that, with just a few keys, the first hash
dbm-type tie to a given file works, and that the second dbm-type tie to
the same file does not generate a tie through which writing works. 
Using small amounts of data (a couple of keys), the second tie seems to
work for reading (it echos the contents written into the file using the
first hash), but modifications to the second hash aren't getting written
to the file (even though they stick around in the second hash -- which
indicates the second hash may not really be tied).  When I tried it with
lots of data (10000 keys), it quit working altogether -- some keys were
dropped, and apparently all values were lost (null or undef was
returned).  There were no error messages.

I'm having a hard time envisioning why one would want to tie two hashes
to the same dbm-type file, anyway.  If it did "work" (by generating two
hashes that simply tracked each other), it wouldn't provide any
additional functionality over simply using one hash -- just change all
references to the second hash to the first hash, and it would work just
the same.  If it worked, it might be good for obfuscation, though.

My tests were on Windoze 98 SE with:

This is perl, v5.6.0 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2000, Larry Wall

Binary build 616 provided by ActiveState Tool Corp.
http://www.ActiveState.com
Built 13:47:17 Jul 14 2000

I used dbmopen, which defaults to DB_File in this version of Perl.
-- 
Bob Walton


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

Date: Sat, 23 Sep 2000 19:18:38 -0400
From: MC <mc@backwoods.org>
Subject: Re: PERL Script in a backgroung
Message-Id: <39CD3A4E.36BEE16B@backwoods.org>

(One of) The proper ways to do this is layed out on the pages below, which I
recently located while looking for precisely the same thing.

http://www.webreference.com/perl/tutorial/9/index.html

MC

Barna wrote:
> 
> use "# exec myscript.pl &"
> 
> Marvin schrieb:
> 
> > Hi !
> >
> > I have a perlscript, which I want to run in a background on UNIX system
> > (now I have a cronjob to run script every minute).
> > The script is checking various systems over the network and it takes
> > more than a minute, so after a while a have several instances of them in
> > a memory.
> > If I try to run
> > # myscript.pl &
> >
> > the script is immediately stopped. Is there any argument it must be
> > passed to perl interpreter ?
> >
> > Thanks

-- 
---------------------------------------------------------------------
My email address(s) are my private property.  They are NOT to be used
or recorded for ANY reason without my explicit permission.  Disregard
of this statement is in violation of federal privacy & copyright law.
---------------------------------------------------------------------
"The world wont end with a bang, or even a whimper, but with an error
message." -- format C:


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

Date: Sat, 23 Sep 2000 23:11:33 +0100
From: Rosemary I H Powell <rosie@dozyrosy.plus.com>
Subject: Re: popup_menu problems 
Message-Id: <MPG.1435f04e6c4068039896d5@usenet.plus.net>

In article <B5EA6B16.8302%star@sonic.net> dated Mon, 18 Sep 2000 19:35:35 
GMT,  our revered colleague arthur (star@sonic.net) was so kind as to 
advise ...
> I am trying to get a popup_menu to work
> When I run the following:
> 
> #!/usr/bin/perl -w
> use strict;
> use CGI qw(:standard);
> 
> print header,start_html("popup"),h1("popup_menu");
        ######
header --> header()
> if (param() {
     ##    ##
{ 
(param()  --> (param())

>     my $pages = param("name");
>     print "OK the name of your game is $pages";}else{
>         print hr();
>         print start_form();
>      p("name the game, textfield('name'));
         ##            ##
"name the game, --> "name the game",

>         print p("Here are the games made all ready: " popup_memu("pop",
                                                        ###########
popup_memu --> popup_menu

    {'mint',"cherry",'mocha']));
    ##                     ##
{ ...  ] --> { ... }

>         print p(submit("send"), reset('clear"));
                                        ##    ## 
'clear" --> "clear"       
>         print end_form(), hr();
> }
> print end_html;    
> ----------------------
> I get:
> 
> # syntax error, near "print"
> File 'StarMax HD:Desktop Folder:popup.cgi'; Line 8
> # Global symbol "pages" requires explicit package name.
> File 'StarMax HD:Desktop Folder:popup.cgi'; Line 8
> # Execution of StarMax HD:Desktop Folder:popup.cgi aborted due to
> compilation errors.
>                    
                    
> anyone care to share why?

Sometimes the error you get reported is NOT the real error, you get a 
sort of cumulative problem, and in this case it was actually the missing 
bracket at the end of (param() that was causing your error message... 
Maybe someone more knowledgable can explain WHY you got this particular 
message??

Write and test you script in tiny "baby steps" - it is far easier to pick 
up errors this way, and you will be building on solid foundations all 
time...

Here is the corrected version:

#!/usr/bin/perl -w
use strict;
use CGI qw(:standard);

print header(),start_html("popup"),h1("popup_menu");

if (param()) {
   my $pages = param("name");
   print p("OK the name of your game is $pages");
}

else{
        print hr();
        print start_form();

        print p("name the game", textfield('name'));
        print p("Here are the games made all ready: ", 
                 popup_menu("pop",                                          
				{"mint","cherry","mocha"}));

        print p(submit("send"), reset("clear"));
        print end_form(), hr();
}
print end_html; 

Rosemary
-- 
----------------------------------------------------------------
| Rosemary I.H.Powell  EMail: Home: rosie@dozyrosy.plus.com    |
|                             Work: r.i.h.powell@rl.ac.uk      |
|                       http://NeedleworkSamplers.com/         |
|                       http://www.CavalierKingCharles.com/    |
----------------------------------------------------------------


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

Date: Sun, 24 Sep 2000 00:03:17 GMT
From: hiroshiishii@my-deja.com
Subject: Testing file for directory: doesn't work
Message-Id: <8qjgbt$1nn$1@nnrp1.deja.com>

Hi all:

I am programming to process certain files from the entire directory.
I came up with the following recursive subroutine.

When I test a file for directory in the line 18 below, test failes.
Because $file doesn't have a complete PATH.  (I started perl from my
local subdirectory.)

QUESTION: How can I make this test work and call this sub recursively?

T.I.A.

-Hiroshi

#!/usr/local/bin/perl5 -w
#use strict;
# This lists all files including subdirectories.

print "Which directory? \n";
$start_dir = <STDIN>;
chomp $start_dir;
search($start_dir);

#***********
 sub search
#***********
{
	my $dir = shift;
	opendir(DIR, $dir) or die "Cannot opendir $dir:$!";
	while (my $file = readdir DIR)
	{
		next if ($file eq "." || $file eq "..");
		if (-d $file) {
                ############# (Line 18:)
			search($file);
			next;
		}
		print "$file\n";
	}
	closedir(DIR);
}



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 23 Sep 2000 17:47:58 -0600
From: "Michael Love" <noone@nospam.com>
Subject: Re: Time Zone conversion
Message-Id: <39cd41db.0@oracle.zianet.com>

Thanks! Unfortunately, I'm using ActivePerl on Win2000.

I tried this approach with the TZ environment variable earlier, hoping it
would be easy to implement this way. I'm looking for a platform independent
way to try and pull this off since my program runs on both Windows 2000/NT
and FreeBSD/Redhat Linux.

Basically, what I have is a message board script I've written that I'm
trying to modify so that users can enter their timezone and see all of the
times in their local time rather than the server's time.

I found this webpage: http://www.webexhibits.org/daylightsaving/g.html that
gives me a chart of countries and when their DST starts and ends. As you can
see from these... such as calculating the "First Sunday in April" and the
"Last Sunday in October", or even "First Sunday on or after the 9th of
October"... this can be rather involved.

At first I thought I would rely on whether the server itself was on dst, but
if the system running the code isn't in a country that uses dst then it
becomes useless, and depending on the country you are in the time dst
compensation lasts could be off by up to a month.

I don't want to turn this piece of code for handling timezones into a
project on its own, and if I have to I want to make sure that I'm not going
to be replicating work that has already been done.




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

Date: Sat, 23 Sep 2000 17:51:45 -0600
From: "Michael Love" <noone@nospam.com>
Subject: Re: Time Zone conversion
Message-Id: <39cd42be.0@oracle.zianet.com>

Thanks, but it's not the idea of timezone conversion I'm having problems
with. I was hoping that someone already had a piece of code out there that
would check for DST in another timezone without having to write it myself
and duplicate the effort.

I found this webpage: http://www.webexhibits.org/daylightsaving/g.html that
gives me a chart of countries and when their DST starts and ends. As you can
see from these... such as calculating the "First Sunday in April" and the
"Last Sunday in October", or even "First Sunday on or after the 9th of
October"... this can be rather involved.

This is meant to be a modification to a program, not as a programming
project on its own. If I have to write up a module to do this from scratch,
I'll do it, but I want to make sure that there sin't something out there
already.




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

Date: Sat, 23 Sep 2000 22:49:01 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: Using perl scripts for picture rollover effect in HTML?
Message-Id: <slrn8sqdk8.ke.tim@degree.ath.cx>

Marc Liegeois <marc.liegeois@ic24.net> wrote:
> I try to find a script to achieve a picture rollover effect using perlscript
> in my HTML pages.
> The only examples which I have found around are based on javascript.

The reason they use JavaScript is that JavaScript is the only widely
supported client-side scripting language.  To my knowledge, the only way
to accomplish what you ask requires that _every single user_ have Microsoft
Internet Explorer 3 or higher, and thet _every single user_ have
ActivePerl and/or MKS Perl.  If you're doing this on an intranet where
you can control the software each visitor uses, this might be useful.
However, considering your only goal is image rollovers implies this is
a WWW page.

As far as directing you to code if you _did_ decide to embark on this
exceedingly improbable task, I couldn't give you working code (at least
not free).  There are already too many people with a vague working
knowledge of HTML and no knowledge of JavaScript beyond cut-and-paste
out there selling themselves as web designers or developers.

If I hit too close to home, I apologize, but you basically asked a huge
group of programmers, many of whom are professionals, how to cheat.

If you want to learn how to _program_ javascript, Netscape has a decent
javascript reference and tutorial; they also have information on the
Netscape Navigator's DOM (Document Object Model), which you'll need to
be familiar with to program JavaScript in an HTML page.

Also, look for ECMAScript, which is the standard on which JavaScript is
based, and upon which Micro$oft's JScript is loosely based.

<Speculation type="idle">
	It would be very, very, VERY nice if JavaScript could be called
	ECMAScript.  This would eliminate all the confusion coming from,
	say, bosses, talking about "Java rollovers" and getting that
	deer-in-headlights look if you even imply there's a difference
	between the Java and JavaScript.
</Speculation>

</Rant>  ;)

-- 
-Tim Hammerquist <timmy@cpan.org>
Nearly all men can stand adversity, but if you
want to test a man's character, give him power.
	-- Abraham Lincoln


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

Date: Sat, 23 Sep 2000 23:39:54 GMT
From: Neil Conway <nconway@klamath.dyndns.org>
Subject: Re: variable -> constant?
Message-Id: <39CD3F48.9070106@klamath.dyndns.org>

Thanks for the response Jim.

Jim Mauldin wrote:

> 'FOO' sends a string literal to the subroutine.  You want:

> print &test(FOO), "\n";

Yes, I understand that. Essentially, I want to evaluate a string literal 
such that a 'constant lookup' takes place - that was what I was trying 
to do with the eval{} nonsense in my original example. Here's a better 
example:

##############
use constant CONST_1 => 'hello';
use constant CONST_2 => 'world';
my $var = 'CONST_1';
print &test($var);
$var = 'CONST_2';
print &test($var), "\n";

sub test ($) {
#magic Perl that translates the passed string literal
#into a bare-word (?), looks it up as a constant, and returns
#the definition of the constant
}
##############

I'd like this code to print 'helloworld'. How do you do this?

Thanks in advance,

Neil
PGP key from public keyservers



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

Date: Sat, 23 Sep 2000 23:59:01 GMT
From: Neil Conway <nconway@klamath.dyndns.org>
Subject: Re: variable -> constant?
Message-Id: <39CD43C3.5060704@klamath.dyndns.org>

Mark-Jason Dominus wrote:

> I should add that it is really unclear what you are actually trying to
> accomplish here, and that makes it hard to understand what advice to
> give you. 

I'm sorry, I should have been more clear. I thought my example was okay, 
but on re-examination, it's clear I didn't explain myself very well.

I replied to the other response to my post clarifying myself. I think 
your suggestion will work, but I'll doublecheck when I get home.

My sincere apologies, and thanks for your help,

Neil
PGP Key available from public keyservers



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

Date: 24 Sep 2000 00:33:15 GMT
From: abigail@foad.org (Abigail)
Subject: Re: variable -> constant?
Message-Id: <slrn8sqis0.lo9.abigail@alexandra.foad.org>

Neil Conway (nconway@klamath.dyndns.org) wrote on MMDLXXX September
MCMXCIII in <URL:news:39CD3F48.9070106@klamath.dyndns.org>:
() 
() ##############
() use constant CONST_1 => 'hello';
() use constant CONST_2 => 'world';
() my $var = 'CONST_1';
() print &test($var);
() $var = 'CONST_2';
() print &test($var), "\n";
() 
() sub test ($) {
() #magic Perl that translates the passed string literal
() #into a bare-word (?), looks it up as a constant, and returns
() #the definition of the constant
() }
() ##############
() 
() I'd like this code to print 'helloworld'. How do you do this?


Trivial.

    sub test {shift -> ()}


Abigail
-- 
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
__END__
A lark flying over // the pond. A spider prowling // beside a pond.


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

Date: Sat, 23 Sep 2000 22:08:00 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: variable -> constant?
Message-Id: <39CD4ECE.49A5E92D@netstorm.net>

Neil Conway wrote:
> 
> Mark-Jason Dominus wrote:
> 
> > I should add that it is really unclear what you are actually trying to
> > accomplish here, and that makes it hard to understand what advice to
> > give you.
> 
> I'm sorry, I should have been more clear. I thought my example was okay,
> but on re-examination, it's clear I didn't explain myself very well.
> 
> I replied to the other response to my post clarifying myself. I think
> your suggestion will work, but I'll doublecheck when I get home.
> 
> My sincere apologies, and thanks for your help,


Mark-Jason has it basically right.  Use either:

sub test {
   no strict;
   &{$_[0]};
}

or 

sub test {
   eval $_[0];
}

An interesting question - not that I really understand why you would
want to do it that way.

-- Jim


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 4415
**************************************


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