[7918] in Perl-Users-Digest
Perl-Users Digest, Issue: 1543 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Dec 28 15:07:23 1997
Date: Sun, 28 Dec 97 12:00:25 -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 Sun, 28 Dec 1997 Volume: 8 Number: 1543
Today's topics:
Re: Beginner HELP needed :) (Michael Budash)
Can't make www::search kk@netsources.com
Re: DOS & Perl <andy.stowell@virgin.net>
Re: Finding the TITLE to a HTML page (warn unpack 'u*','5<V%M=65L;$!C:7,N=6%B+F5D=0T*')
Re: Finding the TITLE to a HTML page <joseph@5sigma.com>
Re: Finding the TITLE to a HTML page <ebohlman@netcom.com>
Re: Finding the TITLE to a HTML page <use@reply.address.com>
HELP !!! Attachment with sendmail (Perl under linux) <tkonink@horizon.nl>
Re: overloading in function <merlyn@stonehenge.com>
Re: Passing shell objects as arguments to perl scripts (Tad McClellan)
Perl-To-C translation ... Help, please. chad
Problem in psmulti install script ( in perl ) due to "r <ksasan@cup.hp.com>
Programmer needed <info@bulcom.net>
Re: Sorting files <merlyn@stonehenge.com>
Re: Sorting files (Gabor)
SQL and PERL <pesalomo@online.no>
Re: SQL and PERL <ebohlman@netcom.com>
Using HTML::parser/formatter? (Michael Schuerig)
Using the 'my' option in 'for' loops mashas@amdocs.com
Re: Using the 'my' option in 'for' loops <joegottman@nospam.worldnet.att.net>
Re: Which language pays most 17457 -- C++ vs. Java? <rsailors@wyoming.com>
Re: Which language pays most 17457 -- C++ vs. Java? <mck9@swbell.net>
Re: Which language pays most? Smalltalk, not C++ nor Ja (Kurt Watzka)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 28 Dec 1997 11:22:29 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: Beginner HELP needed :)
Message-Id: <mbudash-2812971122290001@d170.pm5.sonic.net>
In article <349C6C08.5825@buffnet.net>, terrymcc@buffnet.net wrote:
>> I keep on getting the error telling me
>> "contained no blank line separating the header and data
>> most likely a broken CGI program"
>>
>> I have looked at the [source] and there is a blank line there.
>>
The error doesn't mean you need a blank line in the _source_, it means the
script needs to be sending a blank line to the browser...e.g.:
print "Content-type: text/html\n\n"; # note the 2 \n's
- or -
print "Content-type: text/plain\n\n"; # note the 2 \n's
- or -
print "Location: http://www.domain.com\n\n"; # note the 2 \n's
or others...
HTH
--
Michael Budash, Owner * Michael Budash Consulting
mbudash@sonic.net * http://www.sonic.net/~mbudash
707-255-5371 * 707-258-7800 x7736
------------------------------
Date: Sun, 28 Dec 1997 09:01:15 -0600
From: kk@netsources.com
Subject: Can't make www::search
Message-Id: <883320717.46333959@dejanews.com>
Keywords: Perl www::search
I've installed Perl for win32 version 5.004 in NT 4.0 server. When
install www::search 1.012, perl makefile.pl work fine and generate
makefile. Inside the makefile "MakeMaker installbin section:" there are
two parts beginning with ":" and return error "missing target or
attribute in rule" by dmake and return error "syntax error : ':'
unexpected" by nmake.
: bin/WebSearch Makefile .exists
@$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e rm_f
$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e cp
bin/WebSearch
$(FIXIN)
: bin/AutoSearch Makefile .exists
@$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e rm_f
$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e cp
bin/AutoSearch
$(FIXIN)
Is there anything missing before ":" or where can I get the binaries to
escape from building the files ?
Thank you for your help!
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Sun, 28 Dec 1997 15:53:42 +0000
From: Andy <andy.stowell@virgin.net>
Subject: Re: DOS & Perl
Message-Id: <34A67605.F2C4A988@virgin.net>
Hi
The best way I have found to run a Perl script from a web page is to
download
some web server software and configure this so your machine effectivly
acts as
both the client and the server.
OmniHttpd is a pretty good one and is available from:
http://www.fas.harvard.edu/~glau/httpd/
The documentation that comes with this download explains how to set it
up
to run on your PC.
To run Perl scripts locally you simply set up the omnihttpd server s/w
to point
to your Perl interpreter and also set up a local cgi-bin.
If you have any problems you can email me directly.
andy.stowell@virgin.net
Thanks
Andy
Andrew Spiers wrote:
> I running PERL under DOS to do my development before putting the
> script
> on the server (save on phone bills). Can I run a DOS perl script from
> a
> web page ? If so how ?
>
> Many Thanks
------------------------------
Date: Sun, 28 Dec 1997 16:26:24 GMT
From: i@non.org (warn unpack 'u*','5<V%M=65L;$!C:7,N=6%B+F5D=0T*')
Subject: Re: Finding the TITLE to a HTML page
Message-Id: <883326042.3284@209.138.26.234>
In article <681kas$t8g$2@news.stlnet.com> on Sat, 27 Dec 97 00:59:57 GMT,
psullivan@stlnet.com (psullivan) wrote:
> How would I find the title from a html file?
perl -0777ne "$T='title';s#<($T\b.*?>.+?)</$T>#print++$N,\"\n$1\n\"#sieg;"
I have found that the above one-liner followed by the filename works
for many HTML files.
Also, if you re-assign $T='a', it can be used to enumerate anchors
or re-assign to other tag-names to enumerate other tag-pairs like
<B>...</B>, <U>...</U>, etc.
------------------------------
Date: Sun, 28 Dec 1997 10:33:33 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Finding the TITLE to a HTML page
Message-Id: <34A68D59.1DE5673D@5sigma.com>
I *know* that, but it's pretty close.
How often do you think a comment containing an
ersatz title tag will appear before the document's real
title tag?
-joseph
Abigail wrote:
> Eeck. That goes wrong as soon as the page does something like
> <!-- <title>Got you</title> -->
>
> You can't extract information from HTML documents with simple regexes.
------------------------------
Date: Sun, 28 Dec 1997 18:02:19 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Finding the TITLE to a HTML page
Message-Id: <ebohlmanELwvFw.Gu8@netcom.com>
Joseph N. Hall <joseph@5sigma.com> wrote:
: I *know* that, but it's pretty close.
: How often do you think a comment containing an
: ersatz title tag will appear before the document's real
: title tag?
Imagine an HTML document filled out from a template intended for people
not terribly familiar with HTML, one that goes like:
<HTML>
<HEAD>
<TITLE>
<!--Insert the title of the document after this line but before the line that
says </TITLE>-->
</TITLE>
...
------------------------------
Date: 28 Dec 1997 19:30:55 GMT
From: "John Bokma" <use@reply.address.com>
Subject: Re: Finding the TITLE to a HTML page
Message-Id: <01bd13c7$5fc35b60$02521e0a@tschai>
Eric Bohlman <ebohlman@netcom.com> wrote in article
<ebohlmanELwvFw.Gu8@netcom.com>...
> Joseph N. Hall <joseph@5sigma.com> wrote:
> : I *know* that, but it's pretty close.
>
> : How often do you think a comment containing an
> : ersatz title tag will appear before the document's real
> : title tag?
>
> Imagine an HTML document filled out from a template intended for people
> not terribly familiar with HTML, one that goes like:
>
> <HTML>
> <HEAD>
> <TITLE>
> <!--Insert the title of the document after this line but before the line
that
> says </TITLE>-->
> </TITLE>
> ...
weblint warns agains the use of mark up in comments. It is bad practice
to do so. And yes, we all can think up numerous of examples that fail a
regex.... If it works in 90% of the cases, it works for me 8-)
John
--
------------------------------------------------------------------
C A S T L E A M B E R Software Development (Java/Perl/C/CGI)
http://www.castleamber.com/ john@castleamber.com
------------------------------
Date: Sun, 28 Dec 1997 13:10:16 +0100
From: "T. de Konink" <tkonink@horizon.nl>
Subject: HELP !!! Attachment with sendmail (Perl under linux)
Message-Id: <34A641A8.9A1B4226@horizon.nl>
Hi,
I want a file from an server (linux) sended to me automaticly by mail.
Therefore I want to
make a Perl-script that uses "sendmail", to send me the file. But I
don't know how to
attach a file whitin the mail using sendmail.
QUESTION :
How can I attach a file to a mail-message using a Perl script under
linux. I know how to
send a mail (see below), but I don't know how to attatch an file. If you
know how to do
it, I would be glad to hear from you.
Thanks in advance,
Thomas de Konink
mailto:tkonink@horizon.nl
PS: As far as I am:
open(MAIL, "|/usr/lib/sendmail tkonink@horizon.nl");
print MAIL "Reply-to: $in{'email'} ($in{'naam'})\n";
print MAIL "Subject: Aanmelding Email Lijst\n";
print MAIL "Datum : $date1 Tijd: $time1 \n\n";
print MAIL "E-mail adres: $in{'email'} \n\n";
print MAIL "Remote IP address: $ENV{'REMOTE_ADDR'}\n";
close(MAIL);
------------------------------
Date: 28 Dec 1997 08:31:41 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: joseph@5sigma.com
Subject: Re: overloading in function
Message-Id: <8cius9o55u.fsf@gadget.cscaper.com>
>>>>> "Joseph" == Joseph N Hall <joseph@5sigma.com> writes:
Joseph> No humanitarian purpose is served by the following snippet, but here
Joseph> it goes (5.004 only):
Joseph> sub way_too_much_technology_here {
Joseph> (${{
Joseph> 1 => sub { print "One argument! (@_)\n" },
Joseph> 2 => sub { print "Two arguments! (@_)\n" },
Joseph> 3 => sub { print "Three arguments! (@_)\n" },
Joseph> }}{@_} or sub { print "I'm sorry Dave. I can't do that.\n" })->(@_);
Joseph> }
Joseph> way_too_much_technology_here 1;
Joseph> way_too_much_technology_here 1,2;
Joseph> way_too_much_technology_here 1,2,3,4;
Joseph> way_too_much_technology_here;
Or, slightly easier to read, perhaps, but still too much technology:
sub way_too_much_technology_here {
([
undef,
sub { print "One argument! (@_)\n" },
sub { print "Two arguments! (@_)\n" },
sub { print "Three arguments! (@_)\n" },
]->[@_] or sub { print "I'm sorry Dave. I can't do that.\n" })->(@_);
}
way_too_much_technology_here 1;
way_too_much_technology_here 1,2;
way_too_much_technology_here 1,2,3,4;
way_too_much_technology_here;
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 247 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Sun, 28 Dec 1997 09:10:19 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Passing shell objects as arguments to perl scripts
Message-Id: <r4q586.ct.ln@localhost>
Harry Mills (smills@lewiston.com) wrote:
: I expect this is a dumb question for this esteemed company, but...
: You can pass arguments from perl scripts into shell scripts with the
: system command, e.g., you could have the following line in a perl
: script:
: #!/usr/local/bin/perl
You're missing the -w switch there...
: $foo="Pamela";
: $bar="Anderson"
: system("/path/to/progname $foo $bar");
You should check the return value:
system("/path/to/progname $foo $bar") && die "progname failed";
... assuming that an exit value of zero from progname means OK.
: , which passes "$foo" and "$bar" to the unix script "progname," and
: executes progname, which might look like the following:
You left out the first step. It first forks another process, then
does the above in the new process (shell).
: #!/bin/sh
: foo="$1" # Assign $foo to the 1st argument
: bar="$2" # Assign $bar to the 2nd argument
: echo "You passed \"$foo\" and \"$bar\" to this script.\n"
: And now "$foo" and "$bar" hold the requisite values (in the shell). I
^^^
It depends on when "now" is ;-)
If "now" is in your sh script above (or its subprocesses), then yes.
If "now" is in your Perl script after the system() call (or after
the Perl script finishes), then no.
If you don't know why, then you might want to see this Perl FAQ:
"I {changed directory, modified my environment} in a perl script.
How come the change disappeared when I exited the script?
How do I get my changes to be visible?"
Anyway, to answer your question, here is a Perl replacement for your
sh script:
------------------------
#!/usr/bin/perl -w
$foo=$ARGV[0]; # or use shift(@ARGV)
$bar=$ARGV[1];
print "You passed \"$foo\" and \"$bar\" to this Perl script.\n"
------------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 28 Dec 1997 10:05:24 -0800
From: chad
Subject: Perl-To-C translation ... Help, please.
Message-Id: <6864d4$7uf@drn.zippo.com>
I read that there where a Per-To-C translators but where I read it, it gave no
resources to help me use or find it. Does anyone know anything about this and
could you please give me links (URLS).
thanks,
-chad
------------------------------
Date: Wed, 24 Dec 1997 11:14:46 -0800
From: "Khelender K. Sasan" <ksasan@cup.hp.com>
Subject: Problem in psmulti install script ( in perl ) due to "require"
Message-Id: <34A15F26.4AEC572B@cup.hp.com>
Hi all,
I'm installing the psmulti from following Web-site to my HP
workstation. But its giving me problem due to require. ( Its hanging
up at a particular require clause, on the second nested require
statement
perhaps.)
http://lune.csc.liv.ac.uk/hppd/hpux/PostScript/psmulti-2.6/
Can anybody tell me whether this is a problem with the
environment,
or with this install ( perl script ) itself. And what is the possible
solution to it?
And if there is any other site, from which i can get a working
copy of psmulti, please let me know.
Thanks in advance,
Sasan.
------------------------------
Date: Sun, 28 Dec 1997 12:23:55 -0500
From: Vladimir Geshanov <info@bulcom.net>
Subject: Programmer needed
Message-Id: <34A68B2B.1A21@bulcom.net>
This is a multi-part message in MIME format.
--------------291C57E74F94
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hey there!
Need some perl script. Description is attached in txt format.
Thanks
--------------291C57E74F94
Content-Type: text/plain; charset=us-ascii; name="help.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="help.txt"
MAKEPAGE.PL
-----------
When called as "/cgi-bin/makepage.pl?ID":
- Should open 'template.html' which contains <!data 01>, <!data 02>, etc.
- Should read 'data.txt' which contains 'ID|data 01|data 02|etc.'
- Should replace <!data 01>, <!data 02>, etc. with 'data 01|data 02|etc.'
according to the 'ID' called.
Sample 'data.txt':
00|no|no|no|no|picture.jpg;
01|John|john@home.com|www.home.com/john|(000) 000-0000|john.jpg;
02|Nick|nick@home.com|www.home.com/nick|(000) 000-0000|no;
03|Paul|paul@home.com|no|(000) 000-0000|paul.jpg;
*If <!data 01> = no, returns nothing
Customized variables at the beginning
$referers = ('bulcom.net','209.21.129.162'); #nobody else uses the script
$base_url = "http://www.bulcom.net/;
$base_path = "/opt2/bulcom/httpd/htdocs/";
$template = "template.html"; #i.e. 'http://www.bulcom.net/template.html'
$data_src = "members/data.txt"; #i.e. 'http://www.bulcom.net/members/data.txt'
$img_src = "images/"; #i.e. 'http://www.bulcom.net/images/'
$border = "0"; #used if image is included
$window = "0"; #0=no; 1=yes #opens 'template.html' in new window
$toolbar=0; #used if $window = "1"
$location=0; #used if $window = "1"
$status=0; #used if $window = "1"
$menubar=0; #used if $window = "1"
$scrollbars=1; #used if $window = "1"
$resizable=1 #used if $window = "1"
$width = "450"; #used if $window = "1"
$height = "150"; #used if $window = "1"
In general
If called as "/cgi-bin/makepage.pl?00" should open 'template.html' and include
'picture.jpg' in the same or new window according to $window;
If called as "/cgi-bin/makepage.pl?01" should open 'template.html' and replace <!data>
with real data:
Name: John
Email: john@home.com
Home page: www.home.com/john
Phone: (000) 000-0000
Picture: john.jpg
Note:
'john@home.com' should be returned as
<a href="mailto:john@home.com">john@home.com</a>
'www.home.com/john' should be returned as
<a href="http://www.home.com/john">www.home.com/john</a>
If more information is needed email me at info@bulcom.net
--------------291C57E74F94--
------------------------------
Date: 28 Dec 1997 08:38:09 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: andrew.spiers@virgin.net
Subject: Re: Sorting files
Message-Id: <8c67o9o4v2.fsf@gadget.cscaper.com>
>>>>> "Andrew" == Andrew Spiers <andrew.spiers@virgin.net> writes:
Andrew> I have 5 files. I would like to read them in with the oldest
Andrew> file first.
Well, suppose you have them in the @ARGV array. If not, ask again. :-)
@ARGV = sort { -M $b <=> -M $a } @ARGV;
Now, if it's more than about 20 names or so, you should step up to
a Schwartzian Transform (or some other technique). See examples
of this in my "sorting" column from UnixReview at:
http://www.stonehenge.com/merlyn/UnixReview/
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 247 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 28 Dec 1997 16:48:06 GMT
From: gabor@vinyl.quickweb.com (Gabor)
Subject: Re: Sorting files
Message-Id: <slrn6ad0be.erd.gabor@vinyl.quickweb.com>
In comp.lang.perl.misc, Andrew Spiers <andrew.spiers@virgin.net> wrote :
# Heres the scenario ;
#
# I have 5 files. I would like to read them in with the oldest file first.
#
# Any ideas ?
#
# Many Thanks
#
opendir DIR,"somedir" or die "$!";
@files = sort {(-M "somedir/$b") <=> (-M "somedir/$a")}
grep {!/^\.\.?$/} readdir DIR;
closedir DIR;
gabor.
--
Well, enough clowning around. Perl is, in intent, a cleaned up and
summarized version of that wonderful semi-natural language known as
"Unix".
-- Larry Wall in <1994Apr6.184419.3687@netlabs.com>
------------------------------
Date: 28 Dec 1997 12:45:33 GMT
From: "Peter Salomonsen" <pesalomo@online.no>
Subject: SQL and PERL
Message-Id: <01bd138f$4ab6ffc0$e5684382@peterhome>
Does anyone know an easy and efficient way to connect Perl and a
SQL-database in an unix/linux environment? Is there any free code
available?
Please CC your answer to pesalomo@online.no
Peter
------------------------------
Date: Sun, 28 Dec 1997 18:16:44 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: SQL and PERL
Message-Id: <ebohlmanELww3x.HDq@netcom.com>
Peter Salomonsen <pesalomo@online.no> wrote:
: Does anyone know an easy and efficient way to connect Perl and a
: SQL-database in an unix/linux environment? Is there any free code
: available?
The usual way of doing this is to do your database access through the DBI
module (available from CPAN) which then uses a DBD module specific to
your database engine (DBDs for the more popular engines are also
available at CPAN).
------------------------------
Date: Sun, 28 Dec 1997 15:34:47 +0100
From: uzs90z@ibm.rhrz.uni-bonn.de (Michael Schuerig)
Subject: Using HTML::parser/formatter?
Message-Id: <1d1z9sd.6a3ibfxltpmuN@rhrz-isdn3-p36.rhrz.uni-bonn.de>
I'm looking for examples of using HTML::parser and HTML::formatter. What
I need in particular is a script that allows me to process the "normal"
text of a HTML page and leave the markup as is.
Michael
--
Michael Schuerig Contests between male toads over females are
mailto:uzs90z@uni-bonn.de often settled by the depth of the croak.
http://www.uni-bonn.de/~uzs90z/ -John Maynard Smith
------------------------------
Date: Sun, 28 Dec 1997 07:32:07 -0600
From: mashas@amdocs.com
Subject: Using the 'my' option in 'for' loops
Message-Id: <883313514.2071396361@dejanews.com>
Hello,
I wrote a recursive subroutine using two independent
'for' loops.
In the first loop I defined a local variable using the
'my' option ,like : 'for (my $i = 0; ...)'. In the other
loop I used the same variable without the 'my' option.
When the program was executed it didn't ran well :
the recurse didn't stop !!
When I used the 'my' option outside the 'for' loop
everything was just fine as it should.
I wonder what is the difference between the two styles ?!
thank you,
Mashas.
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Sun, 28 Dec 1997 11:12:57 -0500
From: Joe Gottman <joegottman@nospam.worldnet.att.net>
Subject: Re: Using the 'my' option in 'for' loops
Message-Id: <685u2a$fb2@bgtnsc02.worldnet.att.net>
mashas@amdocs.com wrote:
>
> Hello,
> I wrote a recursive subroutine using two independent
> 'for' loops.
> In the first loop I defined a local variable using the
> 'my' option ,like : 'for (my $i = 0; ...)'. In the other
> loop I used the same variable without the 'my' option.
> When the program was executed it didn't ran well :
> the recurse didn't stop !!
> When I used the 'my' option outside the 'for' loop
> everything was just fine as it should.
> I wonder what is the difference between the two styles ?!
> thank you,
> Mashas.
>
When you use 'my' within a for loop like that, the localized
variable is local
to that loop. Thus, in the second loop you were using a global variable,
which got
clobbered by the second loop in the recursive call. When you declared
the 'my'
variable outside the loops, the variable is local to the subroutine (or
at least
to a block containing both loops) so both loops use the 'my' variable.
You could also
have declared the variable as 'my' within both for loops. This would
also have
kept everyting local, but in this case you would in effect be using two
different
variables in the two loops, which might be a problem if you wanted the
second loop to
start where the first loop ended.
--
Joe Gottman
joegottman@nospam.worldnet.att.net
[Remove nospam to reply]
------------------------------
Date: Sun, 28 Dec 1997 06:09:10 -0700
From: "Skip Sailors" <rsailors@wyoming.com>
Subject: Re: Which language pays most 17457 -- C++ vs. Java?
Message-Id: <685iur$beu$1@horn.wyoming.com>
Except the guy who had to write it in the first place :)
------------------------------
Date: Sun, 28 Dec 1997 07:39:17 -0600
From: "Michael C. Kasten" <mck9@swbell.net>
Subject: Re: Which language pays most 17457 -- C++ vs. Java?
Message-Id: <34A65685.42B@swbell.net>
Charles F Hankel wrote:
>
> Just to add to this debate, I had to look into the winsock.h file on
> my PC the other day and the first glance showed why COBOL is so much
> more easy to maintain. Anyone with a grain of sense would prefer the
> sheer readability of COBOL to the mess that I saw.
In all fairness, header files like winsock.h are typically not
intended much for human consumption -- so readability is a minor
consideration. They are mainly targeted at the compiler, to declare
global variables, function prototypes, and macros. They may be
cluttered with directives for conditional compilation to accommodate
different environments. COBOL has nothing comparable.
A fairer comparison would be COBOL vs. winsock.c, or whatever other
procedural code #includes winsock.h.
(It is also possible that winsock.h in particular is badly written,
but that's not the fault of the language as such.)
Michael C. Kasten mck9@swbell.net
http://home.swbell.net/mck9/cobol/cobol.html
------------------------------
Date: 28 Dec 1997 14:07:10 GMT
From: watzka@stat.uni-muenchen.de (Kurt Watzka)
Subject: Re: Which language pays most? Smalltalk, not C++ nor Java.
Message-Id: <685mee$5d4$1@sparcserver.lrz-muenchen.de>
Guillermo Schwarz <gschwarz@netup.cl> writes:
>Kaz Kylheku wrote:
>> Although 'memcpy' is not a reserved keyword by any means,
>> it is a reserved 'external name'.
>It is the first time I see reserved external.
Well, looks as if there still is something to learn about C for you.
The exact wording is "are reserved as identifiers with external
linkage", but "reserved external name" looks close enough to me.
>> A strictly conforming program may not define any external
>> name that begins with 'mem' followed by any combination of letters,
>> digits or underscores.
>Ok. Define void memfoo() { } and see if it compiles.
>It does.
The behaviour of a program that declares or defines an identifier with
the same name as an identifier reserved in that context is undefined.
Undefined behaviour means: "No diagnostic required, and whatever the
implementor chooses to do is correct behaviour as far as the definition
of the C programming language is concerned".
>> Define memcpy, if you write such a static function, you must not
>> include the <string.h> header in
>> the same translation unit, else undefined behavior results.
>Wrong. The compiler points out two different implementations.
>The executable can't be generated.
If memcpy is not defined as a function with external linkage, and
if <string.h> is not included, an implementation that does not
sucessfully translate the program in question is at error. Did
you actually _try_ it, and if yes, which implementation did
"point out two different implementations"?
--------8<--------8<--------8<--------8<--------8<--------8<--------
#include <stdio.h>
static void *memcpy(void *to, const void *from, size_t n)
{
char *cto = to;
const char *cfrom = from;
while (n--)
*cto++ = *cfrom++;
}
struct foo
{
int fred;
char wilma[32];
double barney;
};
int main(void)
{
struct foo bar = { 0 }, baz = { 42, "Hello", 3.14159 };
memcpy(&bar, &baz, sizeof baz);
printf("%d, %s, %f\n", bar.fred, bar.wilma, bar.barney);
return 0;
}
--------8<--------8<--------8<--------8<--------8<--------8<--------
is a valid C program, because the header associated with the file scope
identifier memcpy() is not included, and because memcpy() is not defined
as a symbol with external linkage.
>> There is no such thing as ``overriding'' in C. Each external name must
>> have exactly one definition if it is used anywhere in the program.
>That's true. C is not object oriented. C++ is just an Smalltalk
>wannabe.
The object model and design ideas behind C++ are completely different
from Smalltalk. You could probably call C++ a Simula wannabe (If you
are prepared to call a Mustang a Modell T wannabe), but calling
it a Smalltalk wannabe indicates that you either don't know Smalltalk
or you don't know C++.
Kurt
--
| Kurt Watzka Phone : +49-89-2178-2781
| watzka@stat.uni-muenchen.de
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 1543
**************************************