[17727] in Perl-Users-Digest
Perl-Users Digest, Issue: 5147 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 19 03:05:46 2000
Date: Tue, 19 Dec 2000 00:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <977213109-v9-i5147@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 19 Dec 2000 Volume: 9 Number: 5147
Today's topics:
Re: .pl or .plx? msalerno@my-deja.com
Re: Algorithms and PERL <mcnuttj@nin.iats.missouri.edu>
Re: Algorithms and PERL (Tad McClellan)
Re: Algorithms and PERL <jbuff1856@my-deja.com>
Re: Alternating Prints from Two Files <mcnuttj@nin.iats.missouri.edu>
Re: Array of arrays, stack & print layout <mcnuttj@nin.iats.missouri.edu>
Re: Can I submit the contents of a form into the same c <mcnuttj@nin.iats.missouri.edu>
Re: changing array contents as you iterate over it (Martien Verbruggen)
Cookies in ASP <brianb@thedartboard.net>
Re: ftp - setting remote file permissions msalerno@my-deja.com
Re: getting upper bound of two dimensional arraydimens <mcnuttj@nin.iats.missouri.edu>
Re: good format for frequently-updated database? <mcnuttj@nin.iats.missouri.edu>
Re: Help !!! (Richard Zilavec)
Re: Home Directory (Tad McClellan)
Re: One-Liner to Sum a Stack of Numbers? (Jon Bell)
Perl to TCP/IP Connection & Overall Direction Needed <eric@hilding.com>
Re: Perl to TCP/IP Connection & Overall Direction Neede <uri@sysarch.com>
Re: possibly st00pid question regarding 'require' (Tad McClellan)
Re: Run dbiproxy upon boot up? <corlando@MUNGEpop.phnx.uswest.net>
Re: temporary files (Garry Williams)
Re: Trying to extract only names with letters in regex (Tad McClellan)
Re: Upload Image don't refresh martinnitram@my-deja.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 19 Dec 2000 03:16:46 GMT
From: msalerno@my-deja.com
Subject: Re: .pl or .plx?
Message-Id: <91mjuq$ueg$1@nnrp1.deja.com>
In article <91lo0f$5ci$1@nnrp1.deja.com>,
Brendon Caligari <bcaligari@my-deja.com> wrote:
>
>
> Should standalone scripts be extensioned as .pl or as .plx?
>
> I know that at the end of the day it doesn't make a difference, but
> somewhere I must have read that *.plx is good practice for scripts
> while *.pl should be left for perl libraries (what on earth is a perl
> library??)
>
> Anyways....vim doesn't automatically syntax highlight for .plx
> (althouth easy to remedy) but I've downloaded ActiveState Komodo,
which
> (whilst lacking vi keystrokes) is quite nice. However I could not
> figure out how to associate .plx with perl.
>
> Brendon
>
> Sent via Deja.com
> http://www.deja.com/
>
Usually when you install ActiveState Perl on a windows system it should
create the associations during the install. Also, as for the .pl
and .plx, what I have done in the past is associate .pl with the
perl.exe and .plx with the perlis.dll for iis.
ActiveState FAQ - Check it out (explains associations and more):
http://velocity.activestate.com/docs/ActivePerl/faq/Windows/ActivePerl-
Winfaq6.html
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 19 Dec 2000 04:43:49 GMT
From: Justin McNutt <mcnuttj@nin.iats.missouri.edu>
Subject: Re: Algorithms and PERL
Message-Id: <91mp25$mf9$1@dipsy.missouri.edu>
Russ Jones <russ_jones@rac.ray.com> wrote:
> aldenave@hotmail.com wrote:
>>
>> I'm currently taking an algorithims class at school, and my prof.
>> assigned us this problem;
>>
>> Has anyone developed a new algorithm that can solve
>> the traveling salesman problem in polynomial time,
>> using Perl or another command line programming language.
>>
> Your prof is a mean sumbitch, huh? This is kind of like a math
> professor telling you to prove Goldbach's Conjecture. Good luck.
Hadn't heard of this one. What's the traveling salesman problem?
--J
------------------------------
Date: Mon, 18 Dec 2000 23:38:10 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Algorithms and PERL
Message-Id: <slrn93tphi.8it.tadmc@magna.metronet.com>
Justin McNutt <mcnuttj@nin.iats.missouri.edu> wrote:
>Hadn't heard of this one. What's the traveling salesman problem?
http://www.keck.caam.rice.edu/tsp/
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 19 Dec 2000 05:26:08 GMT
From: jbuff <jbuff1856@my-deja.com>
Subject: Re: Algorithms and PERL
Message-Id: <91mrhe$45r$1@nnrp1.deja.com>
In article <91mp25$mf9$1@dipsy.missouri.edu>,
Justin McNutt <mcnuttj@nin.iats.missouri.edu> wrote:
> Hadn't heard of this one. What's the traveling salesman problem?
>
Given a scatter plot of a finite number of points in 2D space, compute
the shortest path that connects all the points and returns to the
origin.
The name comes from the dilemma of the travelling salesman who must
complete his rounds at a minumum expenditure of time and fuel.
-- jbuff
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 19 Dec 2000 04:55:27 GMT
From: Justin McNutt <mcnuttj@nin.iats.missouri.edu>
Subject: Re: Alternating Prints from Two Files
Message-Id: <91mpnv$mf9$2@dipsy.missouri.edu>
>> while ( <HEAD> ) { # run all lines of HEAD through $_
>> last if eof TAIL; # ...unless TAIL runs out of data
>> chomp; # we don't want a newline in the middle, it's
> confusing
>> $_ .= <TAIL>; # append line from tail. keep final newline
>> print; # output the line
>> }
> If I get a moment today, I'll see what I can do with that. However, one
> thing I don't want is to stop the copying if one or the other file runs out
> of lines. It's perfectly normal for them to have different numbers of lines,
> and all the information needs to be recovered. As I think of it, it's as
> though the two files were both printed out onto tracing paper and the
> desired result is the transparent superposition of everything they contain.
> They have been spliced apart so that they are negatives of eachother, with
> no two elements ever occupying the same line-column position on both.
Okay, so perhaps something like this:
while ( 1 ) {
last if ((eof FIRST) && (eof SECOND));
$line = <FIRST>;
chomp $line;
$line .= <SECOND>;
print OUT $line;
}
That should stop only after you've hit the end of *both* files.
--J
------------------------------
Date: 19 Dec 2000 05:08:39 GMT
From: Justin McNutt <mcnuttj@nin.iats.missouri.edu>
Subject: Re: Array of arrays, stack & print layout
Message-Id: <91mqgn$p1h$1@dipsy.missouri.edu>
eggrock@my-deja.com wrote:
> Somewhat of a fun question, but kind of long.
> my $count = 0;
> foreach (@stack) {
> #get x,y pos. and add 1 to each
> my $y = $count % 10 + 1;
> my $x = int($count / 10) + 1;
> $print_stack[$y][$x] = $_;
> $count++;
> }
> for($y = 0; $y <= 10; $y++) {
> for($x = 0; $x <= 10; $x++) {
> printf "%6s ", $print_stack[$y][$x];
> }
> print "\n";
> }
> }#print_stack()
> Is there a better (faster) way? It seems to be fairly quick as it is.
My only suggestion is that since you already have a mathematical way to
calculate the indices for the values in @stack, why have two arrays?
How does the data get into @stack? Is there some reason it can't be
stored directly into @print_stack?
If so, is there some reason that all of the values of @stack[x0] and
@stack[0y] can't be the same as the "header" strings you've got in
@print_stack? You'd then have two lines in your nested for loop. The
first would calculate the proper index in @stack for what you want to
print next, and the second would print it.
I recommend the second way, since (I think) a single array is more
efficient than an array of arrays - since you have a clean way to make
sense of the indices. In *either* case, you get around moving data
from one array to another for no apparent reason.
Of course, none of that is really *necessary* if your code works, but
minimizing the number of lists/hashes/variables of any kind in your
code is (almost) always a good practice. After all, variables are
(usually) stored in memory, which is finite. It may not be necessary
in this case, it's just a "good programming habits" thing.
--J
------------------------------
Date: 19 Dec 2000 05:18:01 GMT
From: Justin McNutt <mcnuttj@nin.iats.missouri.edu>
Subject: Re: Can I submit the contents of a form into the same cgi script which generated the form?
Message-Id: <91mr29$p1h$2@dipsy.missouri.edu>
Gordon Vrdoljak <vrdoljak@uclink.berkeley.edu> wrote:
> Thanks for the reply,
> but I am still at somewhat of a loss... The cgi script receives input from an
> html form and creates another form:
See below:
> -----------code begins.....
> #!/usr/bin/perl -wT
> use CGI;
> use CGI qw(:standard);
> use CGI::Carp qw (fatalsToBrowser );
>
> $week = param("week");
Do a "$pass = param("pass");" here.
The "pass" parameter should be a hidden field in your HTML. If null, you're in
the first pass. The CGI should print the first form. The first form should
contain the HIDDEN parameter "pass" with a value of "passtwo" or something like
that.
When it's submitted, your program should FIRST check to see if param("pass") is
equal to "passtwo". If so, it should print the second form, with a hidden
parameter "pass" set to "passthree".
And so on. More below:
> opendir(DIR, '/home/httpd/cgi-bin');
> @schedfiles = grep { /SCHED/ } readdir(DIR);
> closedir(DIR);
>
> @schedfiles = sort { $a <=> $b } @schedfiles;
> if ($week == 1) {$file = $schedfiles[0];}
> if ($week == 2) {$file = $schedfiles[1];}
> if ($week == 3) {$file = $schedfiles[2];}
> if ($week == 4) {$file = $schedfiles[3];}
> if ($week == 5) {$file = $schedfiles[4];}
This should be shortened to:
$file = $schedfiles[$week];
> open(SCHEDULE, "$file") || die "Could not create open scedule.";
You need an "h" in "schedule" here.
> while (my $line = <SCHEDULE>) { # line refers to each line from the schedule
> (my $time, my $user) = split(":", $line); # line is parsed by time and user
> $sched{$time} = $user;
> }
> print <<END_of_Start;
> Content-type: text/html
>
> <HTML>
> <HEAD>
> <TITLE>Administration form for Schedules</TITLE>
> </HEAD>
> <BODY>
> <FORM METHOD = POST
> ENCTYPE = "text/plain"
> ACTION = "http://wilfred.berkeley.edu/cgi-bin/admin2.cgi">
Right here, put this:
<INPUT TYPE="hidden" name="pass" value="passtwo">
> <BODY BGCOLOR="WHITE">
> <CENTER><H1>Schedule of file: $file</H1></CENTER>
>
> <META HTTP-EQUIV="Content-Type" CONTENT="text/html charset=iso-8859-1">
> <TITLE>Schedule</TITLE>
> <CENTER><TABLE BORDER COLS=11 WIDTH="85%" >
>
> <TR ALIGN=CENTER VALIGN=CENTER>
> <TD ALIGN=CENTER VALIGN=CENTER><B></B>
> </TD>
> <TD>
> <CENTER><B>9:00</B></CENTER>
> </TD>
> <TD>
> <CENTER><B>10:00</B></CENTER>
> </TD>
> <TD>
> <CENTER><B>11:00</B></CENTER>
> </TD>
> <TD>
> <CENTER><B>12:00</B></CENTER>
> </TD>
> <TD>
> </TR>
> <TR><TD><CENTER><B>Monday</B><BR><B>($monday[4])-$monday[3]</B></CENTER></TD>
> <TD><CENTER><SELECT NAME="$monday-9">
> <OPTION selected>$sched{("$monday"."-9")}
> <option>open
> <option>EM LAB
> <option>LAB CLOSED
> </select></CENTER></TD>
> <TD><CENTER><SELECT NAME="$monday-10">
> <OPTION selected>$sched{("$monday"."-10")}
> <option>open
> <option>EM LAB
> <option>LAB CLOSED
> </select></CENTER></TD>
> <TD><CENTER><SELECT NAME="$monday-11">
> etc... for other table form elements
> END_of_Start
> --------------------------
> Now how can I get the result of this form put into the next code, where I write
> it back out to the schedule file?
> Sorry for my difficulties, but I can't seem to find a good reference. I have
> the Oreilly perl and CGI books, but they don't go into a lot of detail for me.
> Gordon.
Feel free to e-mail me if that doesn't make sense. I've got a script that does
something similar (a single CGI that prints three different forms, each with
dynamic content based on the previous submission).
--J
------------------------------
Date: Tue, 19 Dec 2000 02:13:57 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: changing array contents as you iterate over it
Message-Id: <slrn93tgv3.j5f.mgjv@verbruggen.comdyn.com.au>
On Tue, 19 Dec 2000 00:06:59 GMT,
bdesany@my-deja.com <bdesany@my-deja.com> wrote:
>
>
> for (@array) {
> # do some checks with the "first" $_
> # based on the results, splice out various elements of @array
> }
>
> Will the for loop reflect changes to @array, or will it iterate over
> the elements as they existed when the loop was initiated? I think the
> latter.
# man perlsyn
[snip]
If any part of LIST is an array, `foreach' will get very
confused if you add or remove elements within the loop
body, for example with `splice'. So don't do that.
[snip]
It doesn't really say what happens to the iteration, but it does tell
you to not do it. I'd take that advice :)
> My question really is how can I make it behave like the former? I have
> worked around it by doing this:
>
> while (@array) {
> LOOP:
> for (@array) {
> # do some checks with the "first" $_
> # based on the results, splice out various elements of @array
> last LOOP;
> }
But this loops multiple times. If you can do all your work in one
loop, it's wasteful to do two.
You could consider a for loop with an index, and modify the index
inside of the routine:
for (my $i = 0; $i < @a; $i++)
{
# based on $a[$i], splice the array if needed,
# modify $i if necessary
}
But I'd probably reconsider the storage you have here. Why do you need
to adapt the array length based on its contents? Is the array really
large? Maybe instead of modifying it in place you should just create a
copy? maybe instead of a flat array an array of array references would
be a better storage solution?
Martien
--
Martien Verbruggen |
Interactive Media Division | That's funny, that plane's dustin'
Commercial Dynamics Pty. Ltd. | crops where there ain't no crops.
NSW, Australia |
------------------------------
Date: Tue, 19 Dec 2000 02:22:21 GMT
From: BrianB <brianb@thedartboard.net>
Subject: Cookies in ASP
Message-Id: <6aht3to5u6timh7bpm7vt742eu1p2oidgh@4ax.com>
Perl in a Nutshell suggests setting cookies like:
$Response->Cookie("user") = 123;
I get:
PerlScript Error error '80004005'
(in cleanup) Can't modify non-lvalue subroutine call
Any ideas? I took it straight out of the book. Of course the code I
wrote to read in my cookies compiles, but it's hard to test without
setting some :(
Brian Borders
BrianB@thedartboard.net
P.S. Please cc: via email
------------------------------
Date: Tue, 19 Dec 2000 03:21:05 GMT
From: msalerno@my-deja.com
Subject: Re: ftp - setting remote file permissions
Message-Id: <91mk6s$uot$1@nnrp1.deja.com>
In article <91l73j$ltc$1@nnrp1.deja.com>,
cgrab@my-deja.com wrote:
> I'm attempting to use the Net::FTP module to move files from a staging
> server to a production one. While the files themselves get moved ok,
> their permissions are getting changed. The local machine has them set
> at 755, but the remote one has them at 644. Is there any way to
either
> keep them the same or change them back? Thanks.
>
> Charles
>
> NOTE: I've tried using the 'site' command, but get back a "<<< 502
SITE
> command not implemented" message.
>
> Sent via Deja.com
> http://www.deja.com/
>
Depending on the ftp server you can set the umask on a per-user basis.
You could have the script log in as a dedicated user with a 022 umask.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 19 Dec 2000 05:26:03 GMT
From: Justin McNutt <mcnuttj@nin.iats.missouri.edu>
Subject: Re: getting upper bound of two dimensional arraydimens
Message-Id: <91mrhb$p1h$3@dipsy.missouri.edu>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> <dts@netkonnect.net> wrote in comp.lang.perl.misc:
> @result = ( [ 1, 2, 3], [ 4, 5], [ 6, 7, 8, 9] );
> we can loop through the array, evaluating the individual arrays
> in scalar context and assigning the length to a variable $dim if
> the current $dim is smaller:
> my $dim = 0; for ( @result ) { $dim = @$_ if $dim < @$_ }
> Here, $_ walks through the individual array references, so
> @$_ walks through the arrays. Using this in scalar context,
> we are talking about the array lengths in each case.
That will get $dimx (or $dimy, depending on which way you "turn"
it). You'll need to do this to get both:
my $dimx = 0; for ( @result ) { $dimx = @$_ if $dimx < @$_ }
my $dimy = @result;
That will give you the number of rows in $dimy and the length
of the longest row in $dimx.
--J
------------------------------
Date: 19 Dec 2000 05:33:41 GMT
From: Justin McNutt <mcnuttj@nin.iats.missouri.edu>
Subject: Re: good format for frequently-updated database?
Message-Id: <91mrvl$p1h$4@dipsy.missouri.edu>
Eric Undersander <eundersander@austin.rr.com> wrote:
> For my music website, I have a list of about 200 artists/bands. Each artist
> has a dedicated html page, and I want to keep track of various data to
> display in each artist's page. Two examples are
> - user-submitted links to artist-specific fanpages
> - traffic to the page itself
> I originally planned to store every artist's name, along with all their
> data, in one "master" file. But then, to add (for example) a fanpage link
> for an artist, I would have to:
> - read the entire master file into an array/string/whatever
> - search and find the specific artist
> - insert the fanpage link
> - probably reprint the artist's html page to reflect the update
> - print the *entire* array/string back to file
> Considering how often these updates will be done (100/day, perhaps more
> often), I started thinking it would be better to have a master artist file
> containing just names, and then have separate files for each artist
> containing their data. This way I'd only have to update one little file (in
> addition to the artist's html page). Now, I'm not worried about conserving
> CPU overhead... I guess it just seems risky to be messing with the entire
> database so often.
> Any suggestions on how to do this?
As mentioned already, this question is best posted to comp.databases, but
there are some Perl angles to this, which I will address here.
First, you want to use a DBMS to create and store your database. Using a
flat file database is reinventing the wheel. I suggest MySQL as the DBMS.
That will take some effort to learn, and you'll have to learn a little SQL,
and a little bit about database design.
Second (the easy part), get the MySQL DBI module from CPAN. That's the little
guy that will let you make SQL queries against your database from within your
Perl scripts. It works very well (I've been pleased with it so far).
To help you with MySQL, SQL, and (some of the) database design, I HIGHLY
recommend _MySQL and mSQL_ from O'Reilly. It's WELL WORTH the effort to read
the appropriate chapters from that (Ch. 1, 2, 3, 4, 6, and 15 if you're using
MySQL). There are other goodies in there, but those chapters contain the
essentials.
--J
------------------------------
Date: Tue, 19 Dec 2000 03:14:32 GMT
From: rzilavec@tcn.net (Richard Zilavec)
Subject: Re: Help !!!
Message-Id: <3a3ed235.28828836@news.tcn.net>
Bad subject line, Help is not very descriptive....
>I need to modify these line to my needs...When I run this script it does
>everything correct except it won't make the index.shtml to chmod 755
>(-rwxr-xr-x)
>Please Help !!!
perldoc -f chmod
--
Richard Zilavec
rzilavec@tcn.net
------------------------------
Date: Mon, 18 Dec 2000 21:14:22 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Home Directory
Message-Id: <slrn93th3u.87t.tadmc@magna.metronet.com>
mgrime@my-deja.com <mgrime@my-deja.com> wrote:
>Can anyone tell me if there is there any way to reference your home
>directory
There is code for that in the "C-style Logical Or" section
of perlop.pod.
>as the tilde (~) does in shell?
No, shell syntax does not work in Perl (in this case at least).
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 19 Dec 2000 06:22:12 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: One-Liner to Sum a Stack of Numbers?
Message-Id: <G5sxp0.C0p@presby.edu>
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>>>>>> "SuperGumby" == SuperGumby <tick.toff@spam.com> writes:
>
>SuperGumby> The great majority of groups I am involved in are not *nix
>SuperGumby> specific, therefore the majority of readers are using
>SuperGumby> Outlook Express (or another win reader with preview). By
>SuperGumby> using "top posting" a thread can be walked simply.
>
>No, I actually find it harder to read an upside-down quoted item. I end
>up scrolling down, and then up, to see first the question, and then
>the answer.
SuperGumby is probably referring to the fact that Outlook Express provides
no simple way (as far as I can tell) to call up the "parent" to a given
posting, similar to the back-arrow key in 'trn' or the "References" links
in Netscape Communicator. In a complex thread, the only way you can
easily read the full text of the "parent" posting is if it's quoted in the
current posting. (I'd be delighted if someone would tell me there is
indeed a way to do this, so I can include it in the "quoting style" page
on the news.newusers.questions Web site.)
I hasten to note that I do *not* think we should use wasteful and
otherwise inconvenient quoting styles to accommodate brain-damaged
newsreaders. I merely offer this as one explanation for why OE users tend
to prefer full-quoting, which leads naturally to top-posting as a way of
minimizing scrolling if the reader needs to read only the response.
--
Jon Bell <jtbell@presby.edu> Presbyterian College
Dept. of Physics and Computer Science Clinton, South Carolina USA
[ Help try to keep the Deja.com archive alive! Sign the petition at ]
[ http://www2.PetitionOnline.com/dejanews/petition.html ]
------------------------------
Date: Mon, 18 Dec 2000 20:37:52 -0800
From: Eric Hilding <eric@hilding.com>
Subject: Perl to TCP/IP Connection & Overall Direction Needed
Message-Id: <3A3EE620.D09436C6@hilding.com>
My Perl studies took a dive over the past few years, but now a project
is before me that I'd like to ask for a little direction about. I just
ordered the "Perl CD Bookshelf" on CD so this should help :-)
What I need to do is use Perl on my ISP's Unix, to do (at timed
intervals),
what I laboriously have to do manually now using HyperTerminal to
access a remote database on another system via a TCP/IP connection.
At "timed" intervals (this may be a problem since the perl script must
be
in my USR subdirectory and don't think I can use CRON):
1. Connect via Perl with TCP/IP to a remote database. Is there already
some
kind of module? I AM CLUELESS ON HOW TO APPROACH THIS.
2. Issue a USER ID & Password to get in with appropriate "Pauses"
(it's a slow database). I CAN DO THIS.
3. Based upon remote system "prompts", plug-in various search criteria
in
about 7 different levels including "Pause"commands between multiple
search entries in each category. The "Search Parameters" will come
from
a simple .csv or .txt file (or multiple "search" parameter files as
may
be needed. I THINK I CAN DO THIS.
4. Parse the "found" data. I CAN DO THIS.
5. Compare certain components of the "found" data to previously "found"
data for the individual searches, and ONLY act upon the New
Information.
Each individual search will yield only several records to maybe 25
maximum, and I'm thinking a simple flat file type database for each
separate "search". I AM CLUELESS ON HOW TO APPROACH THIS.
5. E-mail a copy of the "New Info" data & also save it to an ASCII .csv
flat file. I CAN DO THIS.
6. Perform the next "search" while still logged in to the remote
system.
Hmmm... I THINK I CAN DO THIS.
7. Log Off the remote database when all searches are done. I CAN DO
THIS !!!
Thank you for ANY direction and guidance in approaching the "clueless"
parts.
Eric
------------------------------
Date: Tue, 19 Dec 2000 06:11:54 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Perl to TCP/IP Connection & Overall Direction Needed
Message-Id: <x7zohtdjo5.fsf@home.sysarch.com>
>>>>> "EH" == Eric Hilding <eric@hilding.com> writes:
EH> 1. Connect via Perl with TCP/IP to a remote database. Is there
EH> already some kind of module? I AM CLUELESS ON HOW TO APPROACH
EH> THIS.
use IO::Socket
EH> 2. Issue a USER ID & Password to get in with appropriate "Pauses"
EH> (it's a slow database). I CAN DO THIS.
use Expect
EH> 3. Based upon remote system "prompts", plug-in various search criteria
EH> in
EH> about 7 different levels including "Pause"commands between multiple
EH> search entries in each category. The "Search Parameters" will come
EH> from
EH> a simple .csv or .txt file (or multiple "search" parameter files as
EH> may
EH> be needed. I THINK I CAN DO THIS.
again, expect should be fine for that
EH> 4. Parse the "found" data. I CAN DO THIS.
given your lack of other perl skills, i wonder about it.
EH> 5. Compare certain components of the "found" data to previously "found"
EH> data for the individual searches, and ONLY act upon the New
EH> Information.
EH> Each individual search will yield only several records to maybe 25
EH> maximum, and I'm thinking a simple flat file type database for each
EH> separate "search". I AM CLUELESS ON HOW TO APPROACH THIS.
hire a perl programmer.
EH> 5. E-mail a copy of the "New Info" data & also save it to an ASCII .csv
EH> flat file. I CAN DO THIS.
are you sure? that is about the same difficulty as the first #5.
EH> 6. Perform the next "search" while still logged in to the remote
EH> system.
EH> Hmmm... I THINK I CAN DO THIS.
think harder.
EH> 7. Log Off the remote database when all searches are done. I CAN DO
EH> THIS !!!
exit() ;
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Mon, 18 Dec 2000 21:25:29 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: possibly st00pid question regarding 'require'
Message-Id: <slrn93thop.87t.tadmc@magna.metronet.com>
The WebDragon <nospam@nospam.com> wrote:
>
>I have a number of scripts that I use to process a file in different
>ways.. yet they all have a similar set of variables to import the data.
>
>can I dump all that 'similar' stuff
Is the "similar stuff" by chance global variables?
Let's hope not...
>into a file 'setup.pl' and have it
>all executed via a
>
> require 'setup.pl';
>
>which would then let me share all those common variables and their data?
Yes.
>or should require only be used to import various subroutines and
>whatnot?
Above you asked "can I", now you switch to "should I" :-)
Having lots of global variables is bad. If that is what you
are talking about, then you should not use require to import
them. You should not have them in your main program either.
You should group them together in some other data structure
(a hash is often used for this). That is, one global hash
with 20 pairs rather than 20 global variables.
The "best" (most scalable) way would be to use packages and
modules to provide the common variables (with "use" instead
of "require").
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 18 Dec 2000 22:19:27 -0700
From: "c" <corlando@MUNGEpop.phnx.uswest.net>
Subject: Re: Run dbiproxy upon boot up?
Message-Id: <s8C%5.1382$%x6.524105@news.uswest.net>
"Karl Mikasa" <Karl.Mikasa@usa.xerox.com> wrote in message
news:91lhup$2u$1@nnrp1.deja.com...
> I'm running dbiproxy on Win NT 4.0. I'd like to know how am I able to
> at the boot up, run a command...
>
> dbiproxy --localport 3333 --debug --logfile /dev/tty
>
> Do I put in a command line in start up?
>
> Thanks,
> Karl
>
>
> Sent via Deja.com
> http://www.deja.com/
If *X try rc.local or the like on NT look at running it as a service.
------------------------------
Date: Tue, 19 Dec 2000 05:02:16 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: temporary files
Message-Id: <sZB%5.319$Kk5.14946@eagle.america.net>
On Mon, 18 Dec 2000 21:44:22 GMT, EM <me@privacy.net> wrote:
>how do i save a file to the memory/disk where that when the script
>terminates any temporary files are automatically deleted
I would unlink the file after opening it, if in Unix.
If not Unix, then an END block, but that won't handle abnormal
terminations. You may want to define signal handlers for that
situation.
--
Garry Williams
------------------------------
Date: Mon, 18 Dec 2000 21:02:30 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Trying to extract only names with letters in regex exp?
Message-Id: <slrn93tgdm.87t.tadmc@magna.metronet.com>
[ please limit your line lengths to the customary 70-72 characters,
else they get hard to read after being quoted a few times.
]
Robert Chalmers <robert@chalmers.com.au> wrote:
>trying to extract from a list, only those names that contain letters.
>No numbers, no dashes or stops etc. Just A-Z
That would be "contain uppercase letters".
A-Za-z would be "contain letters".
>I though this would do it. The name is at most 4 letters long,
> so should'n this do it?
You wouldn't be here it it did :-)
>Match only letters in the A-Z range, and in
>the position, 0 to 4 in the string $name.?
Your pattern match does not restrict the position in any way.
Pattern matches are free to slide around over the string in
an attempt to match. But you can "anchor" the pattern to
stop that behavior.
>but it doesn't do it... I admitto getting real confused with regex,
>but this seems so easy ! and I'm stumped.
>
> if ($name =~ /[A-Z]{0,4}/) {
That pattern matches *every possible* string. It allows zero to four
uppercase letters. There are at least zero uppercase letters in
every string. Beware of writing patterns where everything is
optional, because then the the empty string will match. The
empty string is in every string!
>If any kind soul can pointout the error of my ways, I'd really appreciate it.
if ( $name =~ /^[A-Z]{1,4}/i ) {
But it sounds to me like you are trying to validate the contents
of $name. The usual idiom for that is:
anchor the start
anchor the end
pattern in between to account for all allowable cases
so this is probably better:
if ( $name =~ /^[A-Z]{1,4}$/i ) {
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 19 Dec 2000 02:42:00 GMT
From: martinnitram@my-deja.com
Subject: Re: Upload Image don't refresh
Message-Id: <91mhto$su8$1@nnrp1.deja.com>
..deleted.
You could try pragma no cache on your page.
I had tried to expires the page like that:
1. use CGI.pm->header,
print $query->header( -type=>'text/html',
-expires=>'-1d',
-charset=>$charset
);
2. use HTTP meta tab,
<meta http-equiv="Expires" content="Fri, 01 Jan 1983 00:00:00 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
3. use the other reply (thx first), using cgi header:
print<<EXPIRE;
Pragma: no-cache
Expires: Fri, 01 Jan 1983 00:00:00 GMT
EXPIRE
But still no effect... Any other idea(rather than write another cgi to
read image)? This make me gone crazy...
P.S. I found that it maybe only happened in IE5.0/5.5 and NS 4.7 under
Win98/Win98SE, as i use IE4.0 under NTServer4.0(SP5), every thing go
well.
Sent via Deja.com
http://www.deja.com/
------------------------------
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 5147
**************************************