[12155] in Perl-Users-Digest
Perl-Users Digest, Issue: 5755 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 23 00:08:47 1999
Date: Sat, 22 May 99 21:00:14 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 22 May 1999 Volume: 8 Number: 5755
Today's topics:
Re: Dynamic Loading Chen Lim
Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Pe (Ilya Zakharevich)
Help with challenge script (anonymous)
Re: Mac-specific Perl help requested - The Answer <josh@bitwell.net>
Mac-specific Perl help requested <josh@bitwell.net>
Re: Mac-specific Perl help requested (Bob Trieger)
Re: Perl "constructors" zenin@bawdycaste.org
Re: Perl "constructors" zenin@bawdycaste.org
Re: Perl "constructors" zenin@bawdycaste.org
Perl on Win32 - How can I hide the process? <thomas@shurflo.com>
Re: Perl Tutorials <Gened@***spamblocker***ohinter.net>
Re: Secure connection <walton@frontiernet.net>
Using perl to port a telnet session to HTML <hawkwynd@adelphia.net>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 22 May 1999 15:00:21 GMT
From: Chen Lim
Subject: Re: Dynamic Loading
Message-Id: <3746c4f8.2624681@news.mindspring.com>
On 22 May 1999 09:23:02 -0000, Jonathan Stowe
<gellyfish@gellyfish.com> wrote:
>On Wed, 19 May 1999 14:42:04 GMT chenlock99@yahoo.com wrote:
>> I have problem loading DBI module when I tried to run my script. It
>> complaint about dynamic loading not available in this perl. I have to
>> either to rebuild the new perl or statically link the module to it. I
>> have tried rebuilt the perl with dynamic loading but it failed, seems
>> like my complier doesn't support. Any idea how to resolve this ?
>>
>
>What platform are you on ? The hints files for some systems by default
>cause a statically linked Perl to be built although some of thes have been
>changed in more recent versions.
>
>If you are on SCO for for instance the 5.00503 release now builds a
>dynamically linked Perl (as long as you have a version of SCO unix that
>supports that :).
>
>On other systems that have the capability to build a dynamically linked
>perl it may be possible to get it to build dynamic by supplying the
>correct answers to Configure, however as we dont know what system you
>have we cant advise you on that. If all else fails you can edit the
>Config.SH file after having run Configure and then run Configure -S.
>
I am on HPUX 10.20. I have tried to rebuild my perl to run dynamic
link. Seems like every time I configure "yes" for dynmanic link, it
died on me when I run "make". Is it just that my compiler won't
support dynamic link ? Is there any work around ? or should it just
get gcc for HPUX ? Which is a better resolution ? Please advise.
Thanks.
>/J\
>
>--
>Jonathan Stowe <jns@gellyfish.com>
>Some of your questions answered:
><URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
>Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 23 May 1999 02:32:38 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Perl Y2K compliant?
Message-Id: <7i7pc6$5b9$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Uri Guttman
<uri@sysarch.com>],
who wrote in article <x7btfc7j4j.fsf@home.sysarch.com>:
> f> Unfortunately, many of the Y2K problems in Perl applications *is* the
> f> fault of the language.
>
> perl has nothing to do with it. it is defined by the struct tm in the
> libc library. perl just follows that convention.
Perl decided to follow a stupid convention, thus Perl has everything
to do with the fact that the year-return of Perl's localtime has a
brain-dead semantic.
> there is no booby trap, only booby programmers.
Get real! Suppose that localtime() were called s6s5a45fa54f(), and
dump() was called s6s5e45fa54f(). Would not you call such a language
booby-trapped?
I did not read the "critique" you are refering to, but a fact is a
fact: there is no legal usage of $y = (localtime)[5] except as
$y % 100;
and
1900 + $y;
Having localtime() return 1900 + $y would save *a lot* of frustration,
since it is much harder to get *false expectations* how one can use
$y. Quoting Larry, "that's linguistic" in designing programming
languages.
Humans *are* fallible, and one tells good programming languages from
bad programming (or scripting) languages by how much attention they
pay to the fact that programmers are humans. Some sides of Perl are
quite good in this regard. Some other sides of Perl are abyssmal in
this regard. Deciding on which side (localtime)[5] is left as an
exersize to the reader.
Hope this helps,
Ilya
------------------------------
Date: 23 May 1999 02:53:39 GMT
From: anonymous@nouce.net (anonymous)
Subject: Help with challenge script
Message-Id: <7i7qjj$qqk$1@owl.slip.net>
Hello,
>From the past I always got lots of help from this newgroup so maybe I can get some more.
First it will help if I explain what I am looking for. Right now I have Matts wwwboard2.0a
script http://www.worldwidemart.com/scripts http://www.worldwidemart.com/scripts.
This is a message board where people communicate with each other. This program uses perl/cgi
and html tags. Right now the messages are getting way to large. What I am trying to do is to
write a script and use html tags that will do the following:
1)Automatically archive all the messages at the end of each months
2)Place them in a archive directory
3)Let users when they want to look at messages anytime by just clicking at the months.
If this helps the current messages are store in a message directory and a data.txt with a no.
Here is what I got for starters:
The following is the sub_routines:
#!/usr/bin/perl
#------------------------------------------------
# Archive all Submissions
#------------------------------------------------
sub archive_session{
local ($content, $file) = @_;
$DATE = `date`;
$DATE =~ s/\r//g;
$DATE =~ s/\n//g;
if (-e $file) {
&lock_file($file);
#lock file
open (ARC, ">>$file");
print ARC "\n";
#print ARC "===============( The test Archive - $DATE )===============<br>\n";
print ARC "\n";
print ARC "$content";
close (ARC);
&unlock_file($file);
#unlock file
}
else {
&lock_file($file);
#lock file
open (ARC, ">$file");
print ARC "\n";
#print ARC "===============( The test Archive - $DATE )===============<br>\n";
print ARC "\n";
print ARC "$content";
close (ARC);
&unlock_file($file);
#unlock file
}
return(1);
}
#-----------------------------------------------
# [List Archives
#------------------------------------------------
sub list_archive{
local (@files, $file, $type, $fdate);
print "Content-type: text/html\n\n";
print "<hr>";
print "<b>test Archives:</b><br>";
@files = <./archive/*.html>;
foreach $file (@files)
{
$fdate =~ s/$type//g;
print "[ <a href=$file> $fdate </a> ]";
}
print "<hr>";
return(1);
}
Here is what I added to the main wwwboard.cgi (Matt Script)
#Define Variables
$arcdir = "archive"; #changed directory 777
$date = "/usr/bin/date";
The problem that I am having right now is that the date script is a command that runs
automatically from the computer how can I add a snippet that once the date becomes 29th
30th or 31th 2400 (military time) start the archive and send it to the archive directory.
If additional info is need please let me know. Thanks for your help.
------------------------------
Date: Sun, 23 May 1999 03:31:21 GMT
From: Josh Pointer <josh@bitwell.net>
Subject: Re: Mac-specific Perl help requested - The Answer
Message-Id: <37477760.712B@bitwell.net>
The MacPerl documentation says the following:
""\n" on a Mac means ASCII 13, as opposed to Unix, where it means ASCII
10. If you want ASCII 10, write "\012"."
That's it. What it needs to say is this:
"MacPerl, like UNIX, uses "\n" as a record separator. Unlike UNIX,
however, "\n" in MacPerl equals ASCII 13 (\015). "\n" on UNIX equals
ASCII 10 (\012). If you wish to work with files containing non-Mac line
breaks (which is to say, any file created on anything other than a
Mac), you have a couple of choices.
To implement UNIX-style "\n" behavior, set the default line operator
($/) to "\012" ($/ = "\012";)and convert all line breaks in all files to
be processed from \015 to \012 (tr#\015#\012#;).
To implement Mac-style "\n" behavior, convert all line breaks in all
files to be processed from \012 to \015.
Also, keep in mind that DOS/Windows operating systems use the \015\012
sequence as record separators, and as such, will require translation as
well."
I've tried to imagine why the writer of the MacPerl documentation failed
to adequately address this issue, but I just lost three hours of my life
driving to the dark side of the moon in search of the only bookstore in
the region which stocks the obscure tome "MacPerl: Power and Ease." $40.
Did the book answer my question? Yes. Do I believe that it should be
necessary to spend $40 and/or three hours of my life to discover why a
port of a UNIX text processing language doesn't properly handle UNIX
text? Absolutely not.
Josh Pointer
josh@bitwell.net
BTW, I didn't buy the book. I sat there in the store and read it, taking
notes, and then put it right back where I found it. On the other hand,
despite UNIX Perl's extensive, useful documentation, I've bought 4 Perl
books from O'Reilly. There's a lesson in that.
------------------------------
Date: Sun, 23 May 1999 01:13:02 GMT
From: Josh Pointer <josh@bitwell.net>
Subject: Mac-specific Perl help requested
Message-Id: <374756F4.76A8@bitwell.net>
Hi,
Can anybody coherently explain to me the issues involving line breaks
when working with (downloaded) non-Mac files. I'm finding the single
line explaination in the online documentation to be grossly inadequate.
Specifically, I'm using MacPerl to write an app which downloads various
data files from various web sites, pulls relevant data out of those
files, formats that data into a dozen or so reports in separate files,
translates them to Japanese, posts them to another site where they serve
as raw data files for a CGI app that builds trade data reports on
demand, and, finally, archives the files.
The only part I have left to finish is the translation, and the only
thing holding me up is the fact that some of the files' line breaks are
not being respected by MacPerl. This line break mess has plagued me for
the entire project, but I've always seemed to find a way around it until
now.
So I put it to you. Can anyone explain (in enough detail so as to be
useful) the issues involved. Is there any way to make MacPerl respect
line breaks regardless of their specific type (and if not, WHY!?). Or,
is there any way to convert line breaks (specifics, please) to a format
MacPerl will respect, and then convert them back to a format UNIX won't
choke on?
I can't understand why the author of a port of a UNIX-centric text
processing language would fail to address this issue in meaningful
detail, as it would seem central to proper functionality.
Any help would be greatly appreciated. Thanks.
Josh Pointer
josh@bitwell.net
PS - Would it really kill OS makers (commercial or open source) to clue
their OS' in to the fact that there exist in this world more than one
type of linebreak. I'm not saying they have to use every linebreak by
default, but come on. Am I the only one who thinks it's more than a
little silly that, in 1999, I have play nursemaid to a very much less
than intelligent OS?
------------------------------
Date: Sun, 23 May 1999 02:53:27 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Mac-specific Perl help requested
Message-Id: <7i7p1n$qn$1@oak.prod.itd.earthlink.net>
[ courtesy cc sent by mail if address not munged ]
josh@bitwell.net wrote:
>Hi,
>
>Can anybody coherently explain to me the issues involving line breaks
>when working with (downloaded) non-Mac files. I'm finding the single
>line explaination in the online documentation to be grossly inadequate.
Knowing almost nothing about Mac, I think what you want to do is
translate all of the \n and \r\n characters into \r or vice-versa.
Winblows uses "\r\n" as a delimiter, Eunichs uses "\n" and Macintrash
"\r"
PS. Chris Nandor wrote a great book on Macperl and I suggest grabbing it
if you are going to be writing perl on a Mac.
------------------------------
Date: 23 May 1999 01:13:29 GMT
From: zenin@bawdycaste.org
Subject: Re: Perl "constructors"
Message-Id: <927422166.229466@localhost>
Eric The Read <emschwar@rmi.net> wrote:
>snip<
: Okay, that's a neat trick, and one that's likely to get me using eval/die
: more often. But it doesn't change the fact that *Perl* doesn't have more
: than one kind of exception.
It stores it one place, yes. That does not in any way however,
preclude the exception from taking many forms. $@ can hold a
blessed reference, thereby allowing it to hold any form of exception
class (or string) the user sees fit.
: Until something like that's folded into the language itself,
It is. Error.pm was originally built before $@ could hold a
reference, but now it's just a pretty wrapper around the real
internals.
: there's still no way to automatically propagate exceptions.
Sure there is, just don't catch them. When you do catch them by
mistake, rethrowing them is trivial.
: Right now, Perl can't assume that $@ has been blessed at all,
Does it matter? Seriously.
: much less into what hierarchy.
We just spell "catch" as "try":
if ($@->isa("Some::Exception")) {
: And there's *still* no way to automatically die on an uncaught exception.
use Fatal;
--
-Zenin (zenin@archive.rhps.org) Caffeine...for the mind.
Pizza......for the body.
Sushi......for the soul.
-- User Friendly
------------------------------
Date: 23 May 1999 01:38:46 GMT
From: zenin@bawdycaste.org
Subject: Re: Perl "constructors"
Message-Id: <927423683.649671@localhost>
armchair@my-dejanews.com wrote:
>snip<
: For an example:
:
: int a = object.GetHooziwhatzit(); // C++
:
: my $a = $object->GetHooziwhatzit(); # Perl
Or, much more accurately:
Hooziwhatzit a = object.GetHooziwhatzit(); // C++
my Hooziwhatzit $a = $object->GetHooziwhatzit(); # Perl
>snip<
: In Perl I would be tempted to always write
:
: my $a = $object->GetHooziwhatzitNumber(); #or
: my $a = $object->GetHooziwhatzitString(); # or
: my $a = $object->GetHooziwhatzitObject(); # depending on Hooziwhatzit
Then you are going to *hate* Perl.
: if I was writing the methods, or
:
: my $sHoozi = $object->GetHooziwhatzit();
: my $nHoozi = $object->GetHooziwhatzit();
: my $rHoozi = $object->GetHooziwhatzit();
:
: if I was using the object and it's methods.
Or, I don't know, maybe read the API docs for Foo::Object?
You, like many before you, rant and rave up and down that all this
lax style is going to be the death of every app you ever try to
write in Perl, all the while never actually basing any of there
conclusions on real experience, only conjecture and dogma (like much
of the OO world in general). They can't ever understand how or why
Perl could have ever gotten popular in the slightest...
All of that conjecture is completely meaningless however, in the
face of countless peoples' Real World experiences to the exact
contrary.
"In theory, there is no difference between theory and practice.
In practice, there is no relationship between theory and practice."
00 and "strictness" is mostly theory, Perl is completely practical.
--
-Zenin (zenin@archive.rhps.org) Caffeine...for the mind.
Pizza......for the body.
Sushi......for the soul.
-- User Friendly
------------------------------
Date: 23 May 1999 01:50:12 GMT
From: zenin@bawdycaste.org
Subject: Re: Perl "constructors"
Message-Id: <927424370.54516@localhost>
armchair@my-dejanews.com wrote:
>snip<
: That's the point. I have to look into the object _every time_ to find out
: what it's method returns. In C++ I can see that it returns a string,
: number or OBJECT OF SPECIFIC TYPE - not just (void *) which is what a Perl
: reference amounts to.
Bullshit. One word, "typedef".
In any C, C++, Java, <insert any language here> app much larger then
Hello World you'll need to look up the docs for the method in
question.
: I still may have to look at the object to determine (or remember what I
: determined last week) what the method does, but maybe not. And seeing the
: type will help me remember what I already learned about the method.
my Dog $spot = new Canine;
:> So in other words, knowing *only* whether something is a number, a
:> string, or a reference is worthless information by itself. There's
:> therefore no reason to force it to be derivable from the semantics of the
:> language.
:
: It's not worthless information to know that an object of type DateTime is
: being returned, versus a string that holds a date/time versus an int that
: is the seconds since 1/1/1970.
DateTime mytime = TimeObject.getTime();
So tell me, is mytime now an int, pointer to a string, object, a
slice of cherry pie? Is it really "safe" to ever use DateTime in a
way that isn't documented in the API, regardless of how much you
think you know about its current implementation? Hint: it isn't, in
*any* language.
: And when a type is declared, and it doesn't match the expected type -
: compile error in many cases - versus runtime error or bad results.
As I've stated in other posts, you'll need to justify this paranoia
with hard, Real World experience before your theories mean anything.
So far it's your (very) limited Perl experience vs the experience of
*thousands* of long time Perl users. So far you're batting
zero... ('0 zero', '', 0, '0 but true', undef, ?).
--
-Zenin (zenin@archive.rhps.org) Caffeine...for the mind.
Pizza......for the body.
Sushi......for the soul.
-- User Friendly
------------------------------
Date: Sun, 23 May 1999 03:46:46 GMT
From: Thomas/Shurflo <thomas@shurflo.com>
Subject: Perl on Win32 - How can I hide the process?
Message-Id: <37477A2A.5A07C702@shurflo.com>
Anyone know how I can hide the process (dos box) that starts when I run
a Perl script? It could take a while to run and I don't want users
seeing it.
I've been through the manuals and the newsgroups.
------------------------------
Date: Sat, 22 May 1999 22:50:30 -0400
From: Gene Dolgin <Gened@***spamblocker***ohinter.net>
Subject: Re: Perl Tutorials
Message-Id: <6aK13.2629$_c.2888@jump.innerx.net>
Thanks, this is a great tutorial, I will try it!
Neil Edwards wrote:
> On Sat, 22 May 1999 17:03:21 -0400, Gene Dolgin <Gened@ohinter.net>
> wrote:
>
> >I want to jump into learning perl. Right now, I have two books, "Perl
> >in a Nutshell" and "Learning perl" What would be some other
> >books/tutorials for me to look at. I am interested in cgi and database
> >programming mostly. Sql database is my DB of choice.
> >
> >Thanks
> >Gene
>
> The first online tutorial I ever read was roberts perl tutorial, I
> thought it was great and learned a lot from it. The url is:
>
> http://www.netcat.co.uk/rob/perl/win32perltut.html
>
> hope you like it as much as I did.
>
> - - - -
> Neil Edwards Krystal Klear Mods
> http://www.valveworld.com/krystal/
> Get Paid to surf the net:
> http://www.alladvantage.com/go.asp?refid=BIU877
------------------------------
Date: Sat, 22 May 1999 22:14:21 -0400
From: Bob Walton <walton@frontiernet.net>
To: Andrei Karpatchev <akarpatchev@softhome.net>
Subject: Re: Secure connection
Message-Id: <3747647D.1CC3ED1A@frontiernet.net>
Check the docs for the LWP module.
Andrei Karpatchev wrote:
> I'm new in your society...
> With a Perl-script I can generate an "on-fly" document. But is it possible
> to transmit it to the users' browser in the secure mode. I mean, like
> https:\\... (that a lock symbol on the browser is locked), that some
> confidential information could be transfered. Where I can read about such
> stuff?
> Thanks in advance.
------------------------------
Date: Sun, 23 May 1999 03:29:31 GMT
From: "Hawkwynd" <hawkwynd@adelphia.net>
Subject: Using perl to port a telnet session to HTML
Message-Id: <vCK13.723$zB1.8588@server1.news.adelphia.net>
I'm working on a script that (so far) can telnet to a SMAUG mud server, and
perform commands on the server as if it were a human working on the server.
Using the following commands, I can get the script to write commands, and do
waitfor's but I need to be able to access the outout and retreive the
information from the server when it is displayed to the script.
Here's a snippet:
$t=new Net::Telnet (Host =>"$site", Timeout =>90, Prompt =>'/new:/');
#Wait for login prompt :
$t->waitfor('/new:/');
$t->print("username\n");
#Wait for password
$t->waitfor('/Password:/');
$t->print("pasword\n");
# wait for and repsond to announcement pages and press enter to continue...
$t->waitfor('/=---/');
$t->print("\n");
$t->waitfor('/ENTER]/');
$t->print("\n");
# wait for ready prompt, and perform USERS to list users currently online
$t->waitfor('/]/');
$t->print("users\n");
# Do same, except perform WHO
$t->waitfor('/]/');
$t->print("who\n");
It is here that I need to capture the output of the server's response
and save it to file, or update the HTML page to reflect the users online.
Any help with this is GREATLY APPRECIATED!
Scott
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 5755
**************************************