[10740] in Perl-Users-Digest
Perl-Users Digest, Issue: 4339 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 2 01:07:21 1998
Date: Tue, 1 Dec 98 22:00:21 -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 Tue, 1 Dec 1998 Volume: 8 Number: 4339
Today's topics:
Re: Affiliate script <bprater@jipes.com>
Re: Affiliate script (Martien Verbruggen)
Announce: rezrov 0.12, an Infocom game interpreter (Mike Edmonson)
c:\perl\bin %s %s <smash48@netins.net>
Re: c:\perl\bin %s %s (Martien Verbruggen)
Re: Can you suggest a(n) URL? <richgrise@entheosengineering.com>
Re: Changing Directory Problems (Tad McClellan)
Date caluclations in PERL mvan@sprintmail.com
Re: Date caluclations in PERL (Martien Verbruggen)
Re: Definition of "odd characters" in -T/-B documentati (brian d foy)
Re: Definition of "odd characters" in -T/-B documentati (Tad McClellan)
Re: Difficult Pattern Matching (Ronald J Kimball)
Re: Does (.*?) do what I think it does? <admin@asarian-host.org>
Re: Flushing <> (Ronald J Kimball)
Re: Help with Drop down list <bprater@jipes.com>
Re: Help with Drop down list (Martien Verbruggen)
Re: Help..I'm Way Over My Head <richgrise@entheosengineering.com>
Re: macperl problem using Quid Pro Quo warren_a@my-dejanews.com
Re: pattern matching <richgrise@entheosengineering.com>
Re: Perl on Solaris 2.5.1 (#!/opt/LWperl/bin)? <ghersh@bbnplanet.com>
Re: Perl on Solaris 2.5.1 (#!/opt/LWperl/bin)? (Simon Fairall)
Reading a text file & putting into variables <john_z@hotmail.com>
Re: Reading a text file & putting into variables <bprater@jipes.com>
recursive object calling <bprater@jipes.com>
Re: recursive object calling (Martien Verbruggen)
Re: reference problem <richgrise@entheosengineering.com>
regular expr. /w last occurrence? (GEMINI)
Re: regular expr. /w last occurrence? <bprater@jipes.com>
Re: Serial programming question <richgrise@entheosengineering.com>
system() problems on Win32 && infozip <bryan@eai.com>
Re: Why is "... @foo ..." occasionally a syntax error? (Ronald J Kimball)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 1 Dec 1998 21:35:27 -0600
From: "BenJamin Prater" <bprater@jipes.com>
Subject: Re: Affiliate script
Message-Id: <3664b4f5.0@news.mediacity.com>
What Martien is trying to say:
Go to http://www.cgi-resources.com and check it out.
Ben
Steven Edwards wrote in message <3667495a.106049010@news.cchat.com>...
>Hi,
>
>I'm trying to find a good script to run an affiliate program. If
>anyone could help me out, I'd appreciate it.
>
>Thanks,
>Steven Edwards - rand@mindless.com
>Spinal Confusion - http://come.to/SpinalConfusion
------------------------------
Date: Wed, 02 Dec 1998 04:44:37 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Affiliate script
Message-Id: <VA392.101$Fn3.233@nsw.nnrp.telstra.net>
In article <3664b4f5.0@news.mediacity.com>,
"BenJamin Prater" <bprater@jipes.com> writes:
> What Martien is trying to say:
>
> Go to http://www.cgi-resources.com and check it out.
Not exactly :) There was no mention of CGI in the original post. I
said what I meant to say :)
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd. | inexactitude.
NSW, Australia |
------------------------------
Date: Wed, 02 Dec 1998 03:15:12 GMT
From: mikeedmo@voicenet.com (Mike Edmonson)
Subject: Announce: rezrov 0.12, an Infocom game interpreter
Message-Id: <4h292.51740$%X2.13962259@news3.voicenet.com>
This is to announce the third release of "rezrov", an implementation
of a z-code interpreter written in perl (that is to say, it's a perl
program that plays Infocom games, such as Zork). The latest release
features support for Tk, providing nice variable-width fonts and
color. Rezrov is meant to be highly portable, and has separate
interfaces for the Term::Cap, Curses, and Win32::Console modules if
your perl has them; it can also run in a "dumb terminal" mode. The
goal was to write an interpreter which can (hopefully) run wherever
perl runs.
Rezrov is available from http://www.voicenet.com/~mikeedmo/rezrov/
-Michael
------------------------------
Date: Tue, 1 Dec 1998 21:41:29 -0600
From: "Eric Luhman" <smash48@netins.net>
Subject: c:\perl\bin %s %s
Message-Id: <742d12$n5s$1@ins8.netins.net>
Configuring .pl applications in IIS 4.0 to run via c:\perl\bin\perl.exe %s
%s works fantastic for calling perl scripts with the exec cgi= command.
However, after doing this I cannot open a perl script in netscape with
http://my domain/scripts/myscript.pl. Netscape opens up a "save as" dialog
box rather than running the script. IE 4.0 runs the script just fine.
Suggestions for Netscape?
RICK
------------------------------
Date: Wed, 02 Dec 1998 04:55:11 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: c:\perl\bin %s %s
Message-Id: <PK392.106$Fn3.233@nsw.nnrp.telstra.net>
In article <742d12$n5s$1@ins8.netins.net>,
"Eric Luhman" <smash48@netins.net> writes:
> Configuring .pl applications in IIS 4.0 to run via c:\perl\bin\perl.exe %s
> %s works fantastic for calling perl scripts with the exec cgi= command.
> However, after doing this I cannot open a perl script in netscape with
> http://my domain/scripts/myscript.pl. Netscape opens up a "save as" dialog
> box rather than running the script. IE 4.0 runs the script just fine.
> Suggestions for Netscape?
>From your post I can only conclude that the perl script is fine. You
seem to have problems with web server and/or browser configurations.
You should ask those questions somewhere in the comp.infosystems.www.*
hierarchy.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | That's funny, that plane's dustin'
Commercial Dynamics Pty. Ltd. | crops where there ain't no crops.
NSW, Australia |
------------------------------
Date: Tue, 01 Dec 1998 23:33:52 +0000
From: Rich Grise <richgrise@entheosengineering.com>
Subject: Re: Can you suggest a(n) URL?
Message-Id: <36647CE0.4ACD2988@entheosengineering.com>
Steve Fullmer wrote:
[...]
> but my question is how to access the
> PERL program (cgi, .pl, etc) with a web browser. >
> -Steve Fullmer
[...]
Actually, comp.infosystems.www.authoring.cgi might help here - what you
need is a
web server, for example OmniHTTPD. I used it for awhile, and it was
good, 'til I
got linux.
--
Rich Grise
richgrise@entheosengineering.com
(No need to futz with my e-mail: I have a "delete" button!)
------------------------------
Date: Tue, 1 Dec 1998 21:18:55 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Changing Directory Problems
Message-Id: <vib247.pb8.ln@flash.net>
chada@hotbot.com wrote:
: I am having trouble with a perl script I wrote. Its purpose is to add up all
: of the file sizes in your home directory, and up to two directories inward
: from there. I am able to easily add up all of the file sizes in my home
: directory, as well as for all of the first level sub-directories, but going
: two directories inward does not work. It manages to make it into the first
: directory (i.e. /usr/home/directory1/directory2) but it can't get out of it.
: The script follows, any help would be greatly appreciated.
: --- Begin Script ---
: #!/usr/local/bin/perl
You should enable warnings on *every* Perl script.
Really.
All of them.
#!/usr/local/bin/perl -w
: #This is the only thing that needs to be changed.
: $home = "/usr/home/"; ## Change this to your userid.
: ## This is a simple while loop to list all of the files.
: ## Only in the current directory.
: chdir($home);
What will your program do if the chdir() failed?
(hint: it will plow right ahead and sum up stuff in the
*current* directory. Do you even *have* two levels
of subdirs in your current directory?)
chdir($home) || die "could not change to '$home' directory $!";
: while($filename = <*>) {
: $filesize=(-s "$filename") + $filesize;
^ ^ ^^^^^^^^^
1)
That variable has not been given a value on the first loop iteration.
-w complains about it.
2)
the double quotes serve no purpose.
3)
you are also summing sizes for directories, sym links and
other filesystem objects. Is that what you want to do?
4)
You can glob the directory without changing directories, if
you like.
while ( $filename = <$home/*> ) {
5)
a more idiomatic way of writing the above line is:
$filesize += -s $filename;
: }
: print "------------------- Disk Usage -------------------\n";
: print "Home Directory: $filesize Bytes.\n";
: ## This handles all of the first level sub-directories.
: while($x = <*>) {
: if (-d "$x") {
: chdir($x);
: while($filenamex = <*>)
: {
: $filesize=(-s "$filenamex") + $filesize;
: $dirsize=(-s "$filenamex") + $dirsize;
: }
: chdir($home);
Here you go back up to the home dir (maybe. you never checked
to see if it succeeded) ...
: print "$x Directory: $dirsize Bytes.\n";
: $dirsize = 0;
: }
: }
: $maindirsize = $filesize;
: ## This code does not work. ## I am trying to make it go two directories
: inward and add all of those files.
: while($z = <*>) {
: if (-d "$z") {
: chdir($z);
... and here you try to go from the home dir to a second level
dir without specifying the intermediate dir.
Something Bad has happened to your indenting too.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 02 Dec 1998 04:50:20 GMT
From: mvan@sprintmail.com
Subject: Date caluclations in PERL
Message-Id: <3664c6d1.1887391@nntp.a001.sprintmail.com>
I have a bunch of dates in a text file in the form MM/DD/YYYY and wish
to calculate how many dates have elapsed from that date to todays
date.
Help.
------------------------------
Date: Wed, 02 Dec 1998 05:19:31 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Date caluclations in PERL
Message-Id: <D5492.183$Fn3.233@nsw.nnrp.telstra.net>
In article <3664c6d1.1887391@nntp.a001.sprintmail.com>,
mvan@sprintmail.com writes:
> I have a bunch of dates in a text file in the form MM/DD/YYYY and wish
> to calculate how many dates have elapsed from that date to todays
> date.
Do you mean days that have elapsed?
You may be interested in the Date::Calc module, which you can get from
CPAN: http://www.perl.com/CPAN/
Alternatively, you may want Date::Parse, or Time::Local.
You could convert the date to 'seconds since epoch' and compare it to
the output from the time() function.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Unix is user friendly. It's just
Commercial Dynamics Pty. Ltd. | selective about its friends.
NSW, Australia |
------------------------------
Date: Tue, 01 Dec 1998 22:30:15 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Definition of "odd characters" in -T/-B documentation.
Message-Id: <comdog-ya02408000R0112982230150001@news.panix.com>
In article <7420n7$dcg$1@nnrp1.dejanews.com>, dshahin@hotmail.com posted:
> > So "funny" is described as a control chracter other then carriage
> > return, linefeed, backspace, horizontal tab, formfeed, or escape.
> >
>
> this may be a trifle off-topic, but what are the escape characters for
> linefeed and carriage return?
>
> \n = LF or CR?
depends on where you are (and where you came from sometimes). \n
isn't an absolute bit pattern.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 1 Dec 1998 21:22:38 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Definition of "odd characters" in -T/-B documentation.
Message-Id: <upb247.pb8.ln@flash.net>
dshahin@hotmail.com wrote:
: > So "funny" is described as a control chracter other then carriage
: > return, linefeed, backspace, horizontal tab, formfeed, or escape.
: >
: this may be a trifle off-topic, but what are the escape characters for
: linefeed
\n
: and carriage return?
\r
: \n = LF or CR?
LF
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 2 Dec 1998 00:39:14 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Difficult Pattern Matching
Message-Id: <1djdsmf.1ghei73162n9a8N@bay1-549.quincy.ziplink.net>
Erik van Roode <erik@cthulhu.demon.nl> wrote:
> After solving this problem, I have an interesting followup assignment:
Is that "assignment" as in "homework assignment"?
We're not here to do your homework assignments for you.
--
_ / ' _ / - aka - rjk@linguist.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Wed, 2 Dec 1998 06:00:06 +0100
From: Mark <admin@asarian-host.org>
Subject: Re: Does (.*?) do what I think it does?
Message-Id: <199812020500.WAA02654@asarian-host.org>
Bernd Nies wrote in message <36591C31.ED7D26CD@hsr.ch>...
>.* means a character apperars zero or more times (a comma
> is also a charachter)
>.? means a charachter may or may not match.
>.*? useless
Hi, Bernd. For starters, let us correct, and add to the list:
.* match any character zero or as much as you can (greedy)
.*? match any character zero or as much as you can (non-greedy)
.? match any character zero or one time
.+ match any character one or more times (greedy)
.+? match any character one or more times (non-greedy)
Furthermore, I am afraid we do not exactly see eye to eye on the meaning of
uselessness. The ? behind the * denotes a non-greedy variation of the *
symbol. Imagine me at my server processing the following mail-header:
cc: "test user" <firstuser@spamblock.asarian-host.org>, "test user"
<testuser@somecrap.asarian-host.org>, "test user"
<lastuser@mail.asarian-host.org>
Now, watch me unleash the following "useless" Perl-line on the header:
s/\@.*?(asarian-host\.org)/\@$1/gi;
That will correctly search and replace all unwanted crap in front of the
domain name:
cc: "test user" <firstuser@asarian-host.org>, "test user"
<testuser@asarian-host.org>, "test user" <lastuser@asarian-host.org>
Now, let us do it your "useful" way:
s/\@.*(asarian-host\.org)/\@$1/gi;
This would be the shattering result of your action:
cc: "test user" <firstuser@asarian-host.org> !!
That is right: it has correctly replaced everything from the first occurance
of the @-symbol to the last occurance of my domain name, just like you asked
it to; yeah, really useful. :) Also, imagine the following $_:
"That is admin@asarian-host.org to you."
Then using the greedy variation of + would extract my full email-address:
$addy = $1 if (/([\w\.\+\-]+\@asarian-host\.org)/i);
Whereas using the non-greedy variation of +, however, would screw it up:
$addy = $1 if (/([\w\.\+\-]+?\@asarian-host\.org)/i);
cuz $addy would just be "n@asarian-host.org". :)
Well, hope this helps,
- Mark
System Administrator Asarian-host.org
--
For more information about this posting service, contact:
help@asarian-host.org -- for instant general information about our services
admin@asarian-host.org -- for the server's administrator
nclark@asarian-host.org -- for our PR manager
abuse@asarian-host.org -- for abuse of this posting service
If you wish to get an anonymous email/posting account, visit our sign-up page:
http://asarian-host.org/emailform.html
------------------------------
Date: Wed, 2 Dec 1998 00:39:25 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Flushing <>
Message-Id: <1djdtmr.xipoyk66h1l9N@bay1-549.quincy.ziplink.net>
Morgan Curley <mcurley@newscorp.com> wrote:
> I am in the process of writing a module that reads templates and uses the
> magical <>. Unfortuneately, I am finding that I get file overflow - if there
> is any data in the last file read with <> it comes across first. My question
> is, is there any way to flush <>, I am localizing @ARGV each time but that
> doesn't seem to help.
It sounds like your module is reading templates in the middle of
something else in your program using <> to read input.
A) How the heck is your module set up so that this happens?
B) It seems apparent that you should not be using <> in your module.
Just open() the files and use <FH>.
--
_ / ' _ / - aka - rjk@linguist.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Tue, 1 Dec 1998 21:01:01 -0600
From: "BenJamin Prater" <bprater@jipes.com>
Subject: Re: Help with Drop down list
Message-Id: <3664ace4.0@news.mediacity.com>
Derick,
So is the question:
1) How do I write HTML?
2) How do I write Perl?
3) How do I connect to a database?
Ben
Derick A. Jackson wrote in message <3664AC17.12B5A34C@pacbell.net>...
>Does anyone out there have any experience with using Perl with a
>database to populate a drop down list on a HTML page?
>
>Please send info. Thanks.
>
>Derick A. Jackson
>derick@pacbell.net
>
------------------------------
Date: Wed, 02 Dec 1998 04:47:43 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Help with Drop down list
Message-Id: <PD392.102$Fn3.233@nsw.nnrp.telstra.net>
In article <3664AC17.12B5A34C@pacbell.net>,
"Derick A. Jackson" <derick@pacbell.net> writes:
> Does anyone out there have any experience with using Perl with a
> database to populate a drop down list on a HTML page?
Yes. But that information is hardly going to help you.
Tell us:
- What you want
- What you have tried, with code
- What your database is
- Wether you want to use CGI or something else
> Please send info. Thanks.
What info? A complete manual on all database systems, a tutorial on
SQL, documentation on HTML, documentation on CGI, a tutorial on forms,
documentation for and links to all perl modules that can connect to
all the possible various databases?
In other words: be more specific. Show us that you have actually tried
something.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | I'm desperately trying to figure out
Commercial Dynamics Pty. Ltd. | why kamikaze pilots wore helmets - Dave
NSW, Australia | Edison
------------------------------
Date: Tue, 01 Dec 1998 22:41:18 +0000
From: Rich Grise <richgrise@entheosengineering.com>
To: Hunter Padgett <flajobs@gate.net>
Subject: Re: Help..I'm Way Over My Head
Message-Id: <3664708E.6010ADDF@entheosengineering.com>
Hunter Padgett wrote:
>
> I am trying to configure ad-click thrus on my new Web Trends software.
> Our web site has recently attracted advertisers and they require
> click-thru rates to sign up. In order to set-up that part of the
> software, I need to write a custom script (among other things) using
> the Perl 5 language. The script is then housed on my ISP's server. I
> am lost.
>
> I know this is kinda broad, but if anyone has gone through this, I'd
> appreciate your insight.
>
> Thanks,
>
> Hunter Padgett
If I understand your question accurately, I've already done exactly
what you're looking for. E-mail me, and let's talk.
--
Rich Grise
richgrise@entheosengineering.com
(No need to futz with my e-mail: I have a "delete" button!)
------------------------------
Date: Wed, 02 Dec 1998 05:32:25 GMT
From: warren_a@my-dejanews.com
Subject: Re: macperl problem using Quid Pro Quo
Message-Id: <742jda$sjq$1@nnrp1.dejanews.com>
> I've forwarded your inquiry to the MacPerl list. Unfortunately, as
> the email address you give (warren_a@my-dejanews.com) fails, you
> won't see any responses directly. For information on how to join the
> MacPerl list, see the MacPerl Pages <www.ptf.com).
Thanks! Sorry about the address -- I had registered as a dejanews user, but
hadn't filled out the form to start my email account or something. It's
working now, in case anyone wants to email suggestions directly. I'll check
out the MacPerl list as well, and this newsgroup. Thanks for the help!
Warren
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 01 Dec 1998 21:47:56 +0000
From: Rich Grise <richgrise@entheosengineering.com>
Subject: Re: pattern matching
Message-Id: <3664640C.34781000@entheosengineering.com>
ha@canes.gsw.peachnet.edu wrote:
>
> Hi, New to the site but not a novice.
>
> the following statement
>
> if ($file[$counter] =~ /$var/)
> produces "Use of an Unitialized Value"
[...]
I got something similar to that, but when I changed `/$var/' to
`m/$var/', it went away.
--
Rich Grise
richgrise@entheosengineering.com
(No need to futz with my e-mail: I have a "delete" button!)
------------------------------
Date: Wed, 02 Dec 1998 03:48:48 GMT
From: Greg Hersh <ghersh@bbnplanet.com>
Subject: Re: Perl on Solaris 2.5.1 (#!/opt/LWperl/bin)?
Message-Id: <3664B8AF.3233@bbnplanet.com>
Mike Marshall wrote:
>
> On Solaris 2.5.1, I'm loading Perl from the sunfreeware.com site. I
Most of the packages at
http://smc.vnet.net/solaris_2.5.html site including perl
are installed into /usr/local hierarchy. You binaries will go into
/usr/local/bin. If /usr/local is your preference (like mine),
use the packages from that site.
Personally I prefer to keep /opt only with Sun-provided software.
--
Greg
------------------------------
Date: Wed, 02 Dec 1998 05:06:14 GMT
From: Simon.Fairall@hpa.com.au (Simon Fairall)
Subject: Re: Perl on Solaris 2.5.1 (#!/opt/LWperl/bin)?
Message-Id: <3664b709.83071951@news.supernews.com>
On Tue, 1 Dec 1998 16:17:09 -0500, "Mike Marshall"
<removeMike@SinglepointSys.com> wrote:
>On Solaris 2.5.1, I'm loading Perl from the sunfreeware.com site. I'm
>curious.
>
>This package loads into /opt/LWperl. Perl scripts, in general, have a
>sh-bang line (#!/usr/bin/perl) of /usr/bin/perl, or /usr/local/perl, etc...
>
>I understand that /opt on Solaris 2.5.1 is for optional software, but do
>Administrators leave Perl in /opt? Does this mean that they change sh-bang
>lines on perl scripts? Or, Is there typically some sort of linking going on
>to connect the two?
>
>I'm sort of new to Solaris and Perl, and just wondered what the typical
>environment looks like in the real world (if there is one.)
>
>Any comments regarding the typical slicing of drives could help me out, too.
>Lots of slices or just 2 ( / & swap)?
>
>Any help is appreciated...
>
>Mike Marshall
>
>
>
If you are new to Solaris you may not know how to compile from source.
As the c compiler is an optional extra in Solaris, you should first
get the pre-compiled gcc package. With this you can compile all of the
GNU packages from the 'net.
I would install all GNU packages that I need under /usr/local. This
makes it easy to work cross-platform. Typical packages might be Perl,
cpio, make and gcc. The advantage in using the GNU products like cpio
is that the options will be the same on all of your platforms. This
makes writing scripts etc much easier.
------------------------------
Date: Tue, 1 Dec 1998 22:48:52 -0500
From: "John Zeng" <john_z@hotmail.com>
Subject: Reading a text file & putting into variables
Message-Id: <742dgd$muf$1@birch.prod.itd.earthlink.net>
How do I check a text file to see if the user submitted duplicate e-mail
addresses?
I am not sure of what some of these lines do, but more importantly, I need
to know how to check if what the user types in is equal or not equal to each
e-mail address in the file..
-------------<<< PART OF SCRIPT >>>---------------
# $WEBMASTER DEFINED ABOVE
open (LIST, "<$Subscribers");
$umask = umask(0);
open (TMP, ">$TempPass");
umask($umask);
while(<LIST>)
{
### does anything else go here???
chop;
print TMP "$_ ";
# ($tname, $tpass) = split(':');
# $tapass{$tname} = $tpass;
}
close(LIST);
if($webmaster ne ?????) ### what goes in place of the ?????
{
print qq(Thank you for subscribing to our newsletter.<br>
Click <a href="javaScript:history.back\(\);">here</a> to return to the
previous page.<br>\n);
printf (TMP "$webmaster;\n");
close TMP;
rename($TempPass, $Subscribers);
-------------<<< END OF SCRIPT >>>---------------
and say the below is the text file...
-------------
email@host.com; email@host.net; email@isp.com; email@smtp.isp;
-------------
Thanks in advance!
------------------------------
Date: Tue, 1 Dec 1998 23:32:39 -0600
From: "BenJamin Prater" <bprater@jipes.com>
Subject: Re: Reading a text file & putting into variables
Message-Id: <3664d06e.0@news.mediacity.com>
John,
Are you asking one question or two?
Which question do you want the answer to?
Be specific.
Ben
John Zeng wrote in message <742dgd$muf$1@birch.prod.itd.earthlink.net>...
>How do I check a text file to see if the user submitted duplicate e-mail
>addresses?
>I am not sure of what some of these lines do, but more importantly, I need
>to know how to check if what the user types in is equal or not equal to
each
>e-mail address in the file..
>-------------<<< PART OF SCRIPT >>>---------------
># $WEBMASTER DEFINED ABOVE
>open (LIST, "<$Subscribers");
>$umask = umask(0);
>open (TMP, ">$TempPass");
>umask($umask);
>while(<LIST>)
> {
>### does anything else go here???
> chop;
> print TMP "$_ ";
># ($tname, $tpass) = split(':');
># $tapass{$tname} = $tpass;
> }
>close(LIST);
>
>if($webmaster ne ?????) ### what goes in place of the ?????
> {
> print qq(Thank you for subscribing to our newsletter.<br>
> Click <a href="javaScript:history.back\(\);">here</a> to return to the
>previous page.<br>\n);
>
> printf (TMP "$webmaster;\n");
> close TMP;
> rename($TempPass, $Subscribers);
>
>-------------<<< END OF SCRIPT >>>---------------
>and say the below is the text file...
>-------------
>email@host.com; email@host.net; email@isp.com; email@smtp.isp;
>-------------
>Thanks in advance!
>
>
>
------------------------------
Date: Tue, 1 Dec 1998 21:33:53 -0600
From: "BenJamin Prater" <bprater@jipes.com>
Subject: recursive object calling
Message-Id: <3664b498.0@news.mediacity.com>
I've narrowed down a problem I've been having...
Here is the loop in question:
sub loop1 {
my ($tag, $pairs, $text, $data) = @_;
$q->new_handler('loop2');
...
}
This sub is called from within a method in the $q package. The
$q->new_handler method changes an attribute of the object. However, it
'breaks' when I run it. What am I doing wrong in calling the main package
from another and then attempting to change the attribute back in the package
that originally made the call that is breaking it?
Thanks,
Ben
------------------------------
Date: Wed, 02 Dec 1998 04:52:51 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: recursive object calling
Message-Id: <DI392.104$Fn3.233@nsw.nnrp.telstra.net>
In article <3664b498.0@news.mediacity.com>,
"BenJamin Prater" <bprater@jipes.com> writes:
> I've narrowed down a problem I've been having...
>
> Here is the loop in question:
>
> sub loop1 {
> my ($tag, $pairs, $text, $data) = @_;
> $q->new_handler('loop2');
> ...
> }
This is not a loop. It's a sub.
What is $q? Some sort of reference to something blessed I suppose?
What sort of blessed object? Where is it declared and initialised?
> This sub is called from within a method in the $q package. The
$q is an object. Are you saying that this sub is called within the
same package that defines the $q object?
> $q->new_handler method changes an attribute of the object. However, it
> 'breaks' when I run it. What am I doing wrong in calling the main package
> from another and then attempting to change the attribute back in the package
> that originally made the call that is breaking it?
You are calling that method for the actual object $q. if that is not
in scope, or not defined, or not initialised, then you will get odd
things. Saying that 'it breaks' does not tell us anything. What is the
error message? What is the shortest possible piece of code that you
can come up with that displays this problem?
I suspect that you don't understand fully what the issues with these
object thingies are. Have you read the perltoot man page?
# perldoc perltoot
If you still can't work it out with that, please feel free to post a
short piece of code that demonstartes what you _want_ to do, and that
goes wrong. We can then have a look at it, and find out what exactly
goes wrong, and maybe why.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | We are born naked, wet and hungry. Then
Commercial Dynamics Pty. Ltd. | things get worse.
NSW, Australia |
------------------------------
Date: Tue, 01 Dec 1998 21:43:19 +0000
From: Rich Grise <richgrise@entheosengineering.com>
To: kjones@cib.org.uk
Subject: Re: reference problem
Message-Id: <366462F7.7E3339DE@entheosengineering.com>
kjones@cib.org.uk wrote:
>
> I'm faced with the following problem:
>
> If I execute the following:
[...]
> Where test.dat contains
> fred bill $hash{test}\n
>
> Then I get "$hash{test}" output!
>
> I've got two questions on this:
>
> 1. What's going on?
>
when you execute it, the perl interpreter knows that `hash{test}' needs
to be evaluated.
When you load the file, it's just a string.
> 2. How do I get the second one to output the value of $hash{test}?
>
> Thanks,
> Keith
I haven't tried this yet. eval()?
--
Rich Grise
richgrise@entheosengineering.com
(No need to futz with my e-mail: I have a "delete" button!)
------------------------------
Date: 2 Dec 1998 03:18:52 GMT
From: dennis@info4.csie.nctu.edu.tw (GEMINI)
Subject: regular expr. /w last occurrence?
Message-Id: <742bis$mnh$1@netnews.csie.NCTU.edu.tw>
hi all,
if I have a string of 'xxxx var=3 xxxxxxx var=50 xx'
and I'd like to find the value of var= of last occurrence in that
string, how should I write the regular expression?
($v)=/var=(\d+)/ will find the first occurrence only, right?
thanks.
------------------------------
Date: Tue, 1 Dec 1998 21:26:47 -0600
From: "BenJamin Prater" <bprater@jipes.com>
Subject: Re: regular expr. /w last occurrence?
Message-Id: <3664b2ee.0@news.mediacity.com>
Try this:
($value) = $buffer =~ m/.*\s+var=(\d+)/;
Ben
GEMINI wrote in message <742bis$mnh$1@netnews.csie.NCTU.edu.tw>...
>hi all,
> if I have a string of 'xxxx var=3 xxxxxxx var=50 xx'
>and I'd like to find the value of var= of last occurrence in that
>string, how should I write the regular expression?
>
> ($v)=/var=(\d+)/ will find the first occurrence only, right?
>
>thanks.
------------------------------
Date: Tue, 01 Dec 1998 22:52:34 +0000
From: Rich Grise <richgrise@entheosengineering.com>
To: dan_stefura@mad.scientist.com
Subject: Re: Serial programming question
Message-Id: <36647332.1102FA8A@entheosengineering.com>
dan_stefura@mad.scientist.com wrote:
[...]
> The next question is once I find out which pin it is, is it possible to send a
> pulse down any of these? I assume this is possible.
Well, it depends. If you can get your hands on your modem specs, you can
either
find a way to access the actual ports that set and reset the CTS and RTS
lines
- and I think there's another one available, but I forget what it's
called.
But I don't know how to write directly to a port in perl.
> The only other specs is that it's 8-bit, 1 stop bit, no parity, half duplex,
> and asynchronous, and from 9600-115200bps, all the standard stuff.
>
> - dan -
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
--
Rich Grise
richgrise@entheosengineering.com
(No need to futz with my e-mail: I have a "delete" button!)
------------------------------
Date: Mon, 30 Nov 1998 18:50:33 -0600
From: Bryan Hart <bryan@eai.com>
Subject: system() problems on Win32 && infozip
Message-Id: <36633D59.41C6@eai.com>
I'm just wondering if anyone here has any expience running infozip via a
system() under Win32 (5.00502) perl.
I've tried every combination of full paths, relative paths, using/not
using drive letters, forward slashes, back slashes, etc I can think of.
In each case, running the command via a command prompt works, running
from system() exits with code 65280 (Invalid Argument).
Any help would be appreciated,
Bryan
--
------------------------------------------------------------
| Bryan Hart | Phone: (515) 296-5979 |
| Network Products Engineer | Fax: (515) 296-7025 |
| Engineering Animation Inc. | Email: bryan@eai.com |
| | WWW: http://www.eai.com/
|
------------------------------------------------------------
------------------------------
Date: Wed, 2 Dec 1998 00:39:27 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Why is "... @foo ..." occasionally a syntax error?
Message-Id: <1djdvh2.1q2xyco1curfhqN@bay1-549.quincy.ziplink.net>
John Chambers <jc@eddie.mit.edu> wrote:
> All this seems rather irrelevant, because @resource is created at
> run time, and the above error happens during compilation. It is a
> fatal error, and the program dies at the point that the instruction
> is read in. (It's inside a require.)
>
> I can't tell you what the value of $resource[1] is, because the
> program doesn't get run at all.
>
> I thought I made it clear that this was a fatal *syntax* error,
> and the program dies at the point that perl reads in the line.
But in an earlier message John Chambers wrote:
> There doesn't seem anything special here. @resource has been
> used happily by the code, and things like $resource[1] give the
> correct value.
It would be easier to help you, John, if you could settle on a
consistent story.
--
_ / ' _ / - aka - rjk@linguist.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4339
**************************************