[9006] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2624 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 17 23:07:22 1998

Date: Sun, 17 May 98 20:00:31 -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           Sun, 17 May 1998     Volume: 8 Number: 2624

Today's topics:
        500 Server Error: .../somescript.pl contained no blank  <jlampard@quakerstate.com>
    Re: 500 Server Error: .../somescript.pl contained no bl <webmaster@fccjmail.fccj.org>
        Automation For Posting <rborland@erols.com>
    Re: Automation For Posting <webmaster@fccjmail.fccj.org>
    Re: Automation For Posting (brian d foy)
    Re: Automation For Posting <webmaster@fccjmail.fccj.org>
    Re: form data <webmaster@fccjmail.fccj.org>
    Re: IF problems.... <stuartc@ind.tansu.com.au>
    Re: Is if ($a="something") a bad style? (Mark-Jason Dominus)
        Looking for Perl TCP/IP Server Script <mcjason@idirect.com>
    Re: Need help from MacPerl expert! (Paul J. Schinder)
    Re: Nuclear bombing of NEW YORK! Small countries can ta <no_sp.am@agd.nsw.gov.au>
    Re: Nuclear bombing of NEW YORK! Small countries can ta <webmaster@fccjmail.fccj.org>
        perl binary with libraries included <sammy.brodkin@sun.com>
        POP UP window <kira98_98@yahoo.com>
    Re: POP UP window <webmaster@fccjmail.fccj.org>
    Re: POP UP window (brian d foy)
    Re: POP UP window <webmaster@fccjmail.fccj.org>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 18 May 1998 00:07:35 GMT
From: "JD Lampard" <jlampard@quakerstate.com>
Subject: 500 Server Error: .../somescript.pl contained no blank line separating header and data
Message-Id: <01bd81f1$26669380$12e5ced0@jlampard.quakerstate.com>

My script works...
I do some editing--trying to "tweak" it...
Then I get the following error:

500 Server Error
 .../somescript.pl contained no blank line separating header and data.

I'm VERY new to Perl, and this baffles me!  Where's the header?  Where's
the data?  And, why was there a blank line before, but not now???  I
thought i was simply adjusting the look of the script output.

dumbfounded in Dallas,
JD
lampard @ ticnet.com
<><><><><><><><><>


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

Date: Mon, 18 May 1998 02:42:24 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: Re: 500 Server Error: .../somescript.pl contained no blank line separating header and data
Message-Id: <355F9E33.606AA213@fccjmail.fccj.org>

JD Lampard wrote:
> 
> 500 Server Error
> .../somescript.pl contained no blank line separating header and data.
> 

Your server is talking to you :-)

Do this

print "Content-type: html/text\n\n";

Notice two \n up there =)

HTH,
-Sneex- 
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster


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

Date: Sun, 17 May 1998 20:59:35 -0400
From: Randy Borland <rborland@erols.com>
Subject: Automation For Posting
Message-Id: <355F87F7.2181EDE@erols.com>

All:

I have a medium sized Intranet that supports my organization.  There are
a number of technical staff that produce documents at somewhat regular
intervals.  I'd like to give them the ability to directly post these
documents to our Intranet.  Document conversion [assuming that they will
follow style guidelines] will probably be accomplished via Word->HTML,
FrontPage, or PDF print.

My concern is the linking of the documents to the various product
pages.  These documents are topical reports that "fit" under one or more
of the categories on our Intranet.  I've schemed [in my mind] about a
form and CGI script that would let the users identify the sections of
the Intranet that the document should be linked to, and the script would
[through PERL???] create the new links and move the doucment file(s) to
the proper Intranet document directory.

Are there any commercial or share/free-ware products that do this type
of operation?  Does anyone have a pointer to any example CGI or other
scripting examples?

Thanks for any help ... Randy S. Borland



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

Date: Mon, 18 May 1998 02:48:46 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: Re: Automation For Posting
Message-Id: <355F9FB0.489715C8@fccjmail.fccj.org>

Randy Borland wrote:
> My concern is the linking of the documents to the various product
> pages.  These documents are topical reports that "fit" under one or more
> of the categories on our Intranet.  I've schemed [in my mind] about a
> form and CGI script that would let the users identify the sections of
> the Intranet that the document should be linked to, and the script would
> [through PERL???] create the new links and move the doucment file(s) to
> the proper Intranet document directory.

You're looking for clairvoyance =)  You would need several
Wizards, and a magician or two.  And I would still wonder how...

I have wondered about this as well, So...

My question, just to throw some gas on the burner, is "How would the
scripts know where to begin looking for the thoughts about how 
product X is fitting into Intranet distribution Y today?  And
will that still be true tomorrow?"  Just curious =)

In my analysis, why I quit thinking about it, was I would be 
forever changing the script for new linkage - in the end it
was easier to teach the end users to fend for themselves with
regard to publication and site management.

2 Cents,
-Sneex-  =)
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster


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

Date: Sun, 17 May 1998 22:55:40 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Automation For Posting
Message-Id: <comdog-ya02408000R1705982255400001@news.panix.com>
Keywords: from just another new york perl hacker

In article <355F9FB0.489715C8@fccjmail.fccj.org>, bill@astro.fccj.cc.fl.us posted:

>Randy Borland wrote:
>> My concern is the linking of the documents to the various product
>> pages.  These documents are topical reports that "fit" under one or more
>> of the categories on our Intranet.  I've schemed [in my mind] about a
>> form and CGI script that would let the users identify the sections of
>> the Intranet that the document should be linked to, and the script would
>> [through PERL???] create the new links and move the doucment file(s) to
>> the proper Intranet document directory.
>
>You're looking for clairvoyance =)  You would need several
>Wizards, and a magician or two.  And I would still wonder how...

perhap Sneex could talk to my intern who has programmed such a thing.
didn't seem that difficult - that's why i had him do it.

all in Perl, wouldn't you know.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers T-shirts! <URL:http://www.pm.org/tshirts.html>


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

Date: Mon, 18 May 1998 02:54:20 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: Re: Automation For Posting
Message-Id: <355FA0FE.DECE4431@fccjmail.fccj.org>

brian d foy wrote:
> >You're looking for clairvoyance =)  You would need several
> >Wizards, and a magician or two.  And I would still wonder how...
> 
> perhap Sneex could talk to my intern who has programmed such a thing.
> didn't seem that difficult - that's why i had him do it.
> 
> all in Perl, wouldn't you know.

What his/her phone number =)  I am always interested in solutions.

Money is no object!
-Sneex- 
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster


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

Date: Mon, 18 May 1998 02:37:29 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
To: JD Lampard <jlampard@quakerstate.com>
Subject: Re: form data
Message-Id: <355F9D0A.8FC8B7E3@fccjmail.fccj.org>

[Posted and Mailed]

JD Lampard wrote:
> 
> i have a web page containing a form; when the form is submitted i want the
> data to be placed in a text file.  i having a bit of difficulty, but i'm on
> the way to achieving goal.  when the script is called the data is returned
> to visitor for confirmation, yet i can't get the data to go to the text
> file.  CGI has empty output is what the error reads.  what i've achieved
> thus far was done via cgi-lib.pl.  is it a module i'm looking for???


Here is something else to take you another step closer.  =)
(Will prolly need fixing because of wrapping and other 
formatting issues...)

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

use CGI qw(:all);
use strict;

my($sneexPointer) = new CGI;
$sneexPointer->import_names('SNEEX');

#.............................................................................
#print "Content-type: text/html\n\n'Use Diagnostics' - Initialized! &nbsp;";
#use diagnostics;
#print "w/Parameter Tracing enabled...", $sneexPointer->dump;
#.............................................................................

# Set the following to the Class Type you are using...
my $addrClass = 3;

# For example - Set to 1 for Class A, 2 for Class B, 3 for Class C...
# Set it to 4 if you ONLY wish Authorized Hosts to access it...

# Which Domains have access to this script?
# To grant access to specific Hosts, see below...
# If the Domain is NOT in this List, they are Denied...
my(%sneexDomains) = (
"207.203.47"    => "sneex.fccj.cc.fl.us", # Sneex NetBlazer access...
"207.203.61"    => "astro.fccj.cc.fl.us", # Webmaster's domain leg...
"24.129.0"      => "mediaone.net", # Sneaker's private access...
);

# Is any one host specifically Allowed?  List them here...
# To allow access to whole domains, see above...
# If the Host is NOT in this list, they are Denied...
my(@sneexAddr) = (
"127.0.0.1", # Local Server has access for testing...
);

# Setup some needed items, Weekday & Date Translation arrays...
my(@longWeekday) = qq(Sunday,
                      Monday,
                      Tuesday,
                      Wednesday,
                      Thursday,
                      Friday,
                      Saturday,);

my(@longMonth)   = qq(January,
                      February,
                      March,
                      April,
                      May,
                      June,
                      July,
                      August,
                      September,
                      October,
                      November,
                      December,);

# Allowed Script Access Dates & Times, etc...
# If you wish to access project 24-hours a day, 7-days a week, set the 
# Beginning and Ending of the Week to 0 and 6; then set the
# Starting and Ending Hours to 0 and 24, respectively...
my($beginWeek) = 0; # Week starts on Sunday=0...
my($endWeek)   = 6; # Friday is day 5....

my($sec,
   $min,
   $hour,
   $mday,
   $mon,
   $year,
   $wday,
   $yday,
   $isdst) = localtime(time()); # The time now...

my($axsStartHr) =  0; # Access start time in 24-hour (Military) Format...
my($axsStopHr)  = 24; # Access stop time in 24-hour (Military) Format...

# Location & Name of Log file...
my($reportLog) = '/drv2/usr/ns-home/docs/wcjReportLog.html';

my($ercType)       = ''; # The Error Type which occurred...
my($ercCode)       = ''; # The Error Code which occurred...
my($buffer)        = ''; # General buffer used to hold things...
my($flag)          =  0; # For testing truth, justice, et al...
#my($remoteServer) = ''; # Not used this time around...
#my($serverAddr)   = (gethostbyname($remoteServer))[4]; # Not used...
my $domain_info    = ''; # For capturing domain/host stuff...

# Run each subroutine...
&logWriter();
&mainArea();

# Could do other tasks as needed...
exit;

#################################################################
#############  The Subroutines are defined here...  #############
#################################################################

#............................................................................
sub mainArea {

    &checkReferrer(); # Always validate where we were called from...

# Get out HTTPd Required Header stuff...
print header;
print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">
<HTML>
<HEAD>
<TITLE>Looks like you're in!</TITLE>
</HEAD>
<BODY BGCOLOR=WHITE>";

print "<P>What I know about your Browser...";
if (accept()) { print "<P>Browser MIME List: &nbsp;", accept() }
if (auth_type()) { print "<BR>Authentication Type: &nbsp;", auth_type() }
if (raw_cookie()) { print "<BR>Raw Cookie: &nbsp;", raw_cookie() }
if (path_info()) { print "<BR>Path Info: &nbsp;", path_info() }
if (path_translated()) { print "<BR>Path Translated: &nbsp;",
path_translated() }
if (query_string()) { print "<BR>Query String: &nbsp;", query_string() }
if (referer()) { print "<BR>Referrer: &nbsp;", referer() }
if (remote_addr()) { print "<BR>Remote Addr: &nbsp;", remote_addr() }
if (remote_ident()) { print "<BR>Remote Ident: &nbsp;", remote_ident() }
if (remote_host()) { print "<BR>Remote Host: &nbsp;", remote_host() }
if (remote_user()) { print "<BR>Remote User: &nbsp;", remote_user() }
if (request_method())  { print "<BR>Request Method: &nbsp;",
request_method() }
if (script_name()) { print "<BR>Script Name: &nbsp;", script_name() }
if (server_name()) { print "<BR>Server Name: &nbsp;", server_name() }
# Buggy! Don't use... if (server_software()) { print "<BR>Server Software:
&nbsp;", server_software() }
if (virtual_host()) { print "<BR>Virtual Host: &nbsp;", virtual_host() }
if (server_port()) { print "<BR>Server Port: &nbsp;", server_port() }
if (user_agent()) { print "<BR>User Agent: &nbsp;", user_agent() }
if (user_name()) { print "<BR>User Name: &nbsp;", user_name() }

print "<P>You arrived here on ", scalar localtime;
print "<P>Done... &nbsp;Please enjoy your stay...";
print "</BODY></HTML>";
}

#............................................................................
sub sneexHeader {
#  Output the FCCJ Standard Header information...

    print header;
    
# Get out HTTPd & FCCJ Required Header stuff...
print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">
<HTML>
<HEAD>
<TITLE>Florida Community College at Jacksonville</TITLE>
        <META NAME=\"GENERATOR\" CONTENT=\"Hand-written Perl5 Code by Bill
Jones; verified using Mozilla/3.01Gold (X11;I;SunOS 5.5.1 sun4u)
[Netscape]\">
        <META NAME=\"Author\" CONTENT=\"Bill Jones, FCCJ Webmaster\">
</HEAD>

<BODY TEXT=\"#002299\" LINK=\"#000066\" VLINK=\"#FF6600\" ALINK=\"#003366\"
BGCOLOR=\"WHITE\" BACKGROUND=\"\">

<CENTER>
<TABLE CELLSPACING=0 CELLPADDING=0>
    <TR>
        <TD colspan=2 valign=top>
        <A HREF=\"http://www.fccj.cc.fl.us\"
onMouseOver=\"window.status='Jump to FCCJ Main Page'; return true\">
        <IMG SRC=\"../fccjTitle.gif\" NAME=\"fccjgif\" ALT=\"FCCJ Welcome\"
BORDER=0 HEIGHT=66 WIDTH=311></A>
        </TD>
    </TR>
</TABLE>
</CENTER>";
}

#............................................................................
sub sneexFooter {
#  Output the FCCJ Standard Footer information...

print "<BLOCKQUOTE><BLOCKQUOTE>
<CENTER><P>
        <A HREF=\"http://www.fccj.cc.fl.us/maps/newSUBindex.map\">
        <IMG ISMAP SRC=\"../wcjPencil0.gif\" ALT=\"New FCCJ WebMap\"
BORDER=0 HEIGHT=47 WIDTH=473></A>
</P></CENTER>

    <UL><CENTER><P>
<A HREF=\"http://www.fccj.cc.fl.us\" onMouseOver=\"window.status='Jump to
FCCJ Home Page'; return true\">FCCJ Home</A>&nbsp; | &nbsp;
<A HREF=\"http://www.fccj.cc.fl.us/general.html\"
onMouseOver=\"window.status='Jump to FCCJ General Information Page'; return
true\">Information</A>&nbsp; | &nbsp;
<A HREF=\"http://www.fccj.cc.fl.us/programs.html\"
onMouseOver=\"window.status='Jump to FCCJ Programs Page'; return
true\">Programs</A>&nbsp; | &nbsp;
<A HREF=\"http://www.fccj.cc.fl.us/group.html\"
onMouseOver=\"window.status='Jump to FCCJ Group Page'; return true\">Group
Pages</A>&nbsp; | &nbsp; <BR>
<A HREF=\"http://www.fccj.cc.fl.us/important.html\"
onMouseOver=\"window.status='Jump to FCCJ Important Information Page';
return true\">Important</A>&nbsp; | &nbsp;
<A HREF=\"http://www.fccj.cc.fl.us/technical.html\"
onMouseOver=\"window.status='Jump to FCCJ Technical Resources Page'; return
true\">Technical Resources</A>&nbsp; | &nbsp;
<A HREF=\"http://www.fccj.cc.fl.us/special.html\"
onMouseOver=\"window.status='Jump to FCCJ Special Events Page'; return
true\">Events</A>&nbsp; | &nbsp;
<A HREF=\"http://www.fccj.cc.fl.us/locations.html\"
onMouseOver=\"window.status='Jump to FCCJ Locations Page'; return
true\">Locations</A>&nbsp; 
    </P></CENTER></UL>
</BLOCKQUOTE></BLOCKQUOTE>

<CENTER><P><FONT SIZE=-1>&nbsp;
<A HREF=\"http://casper.fccj.cc.fl.us\" onMouseOver=\"window.status='Search
for Info within the FCCJ Webspace'; return true\">Search FCCJ Web
Servers</A>&nbsp; | &nbsp;
<A HREF=\"http://webbster.fccj.cc.fl.us/cgi-bin/mail?webmaster\"
onMouseOver=\"window.status='E-Mail the FCCJ Webmaster'; return
true\">Report problems with this site</A>&nbsp;
</FONT></P></CENTER>

</BODY>
</HTML>";
}

#............................................................................
sub errorReturned { # Was there an error?
    &sneexHeader();

    print <<_erc_EOF_;
    <Center><P>$ercType &nbsp;$buffer &nbsp;$ercCode
    <P>Please report this to the <A
HREF=\"http://webbster.fccj.cc.fl.us/cgi-bin/mail?webmaster\"
onMouseOver=\"window.status='E-Mail the FCCJ Webmaster, include information
about the error...'; return true\">FCCJ Webmaster</A>&nbsp;
    </Center>
_erc_EOF_

    &sneexFooter();
    exit(); # We're outta here!
}

#............................................................................
sub checkReferrer { # Check who called us...

    # Is the access within acceptable project date & time frames?
    # PS - Remember that <,>,=, etc are used to compare numerics!
    #      GT, GE, EQ, NE, etc are used to compare STRINGS Only!
    my($invalid) = 0;
    if ($wday < $beginWeek || $wday > $endWeek) {
        $invalid = 1;
    } elsif ($hour < $axsStartHr) {
        $invalid = 1;
    } elsif ($hour >= $axsStopHr) {
        $invalid = 1;
    }
       
    if ($invalid) {
        $ercType = "Project Closed:";
        $buffer = "<P>Project Hours of Operation are
-<P>".$longWeekday[$beginWeek]." through ".$longWeekday[$endWeek].",
$axsStartHr:00 to $axsStopHr:00, only.";
        $ercCode = "<P>Please utilize this project during regular business
hours...";
        &errorReturned($ercType, $buffer, $ercCode);
    }

    # Check those that may be specifically allowed...
    foreach (@sneexAddr) {
        ($flag = 1) if (remote_addr() eq $_);
        last if $flag;
    }

unless ($flag) {    # From danboo =)
    remote_addr =~ /^((?:\d+\.??){$addrClass})/;
    unless ($domain_info = $sneexDomains{$1}) {
        $ercType = "Unknown Host DENIED at Network: $1<BR>";
        $buffer = "'Anonymous Domain/Host Denied' is &nbsp;". remote_host();
        $ercCode = "<BR>Anonymous Network/Host - Access Denied...<BR><font
color=red>Visit & Error logged</font>";
        &errorReturned($ercType, $buffer, $ercCode);
    }
}

# The following will control Referrer Access to the script...
#       if (referer() && referer() eq "http://www.fromsomeplace.org") { 
#       print "Location: http://www.someserver.org\n\n";
#       return;
#    } else 
#       $ercType = "DENIED:";
#       $buffer = "'Surfer' from &nbsp;<font color=red>" . remote_host() .
"</font> &nbsp;was not authenticated! ";
#       $ercCode = "<P>Prior Authentication is required...<P><A
HREF=\"http://www.someserver.org/index.html\"
onMouseOver=\"window.status='Jump to Some Authentication Page'; return
true\">Authenticate</A> Now?";
#       &errorReturned($ercType, $buffer, $ercCode);
#    }
}

#............................................................................
sub ioError {
        $ercType = "Error: "; 
        $buffer = (shift @_) . " Error " . remote_addr() . " \@ " .
remote_host();
        $ercCode = "<P>A directory or file system error occurred: $!<P>"; 
        &errorReturned($ercType, $buffer, $ercCode);
}

sub logWriter {

    open(outFile, "+>>$reportLog") or
      &ioError("Cannot open $reportLog: $!\n");
#............................................................................
print outFile "<HR NOSHADE>New visitor from ";
(remote_host()) ? print outFile "Host: ", remote_host() 
                : print outFile "Address: ", remote_addr();
if (accept()) { print "<BR>Browser MIME List: &nbsp;", accept() }
if (auth_type()) { print outFile "<BR>Authentication Type: &nbsp;",
auth_type() }
if (raw_cookie()) { print outFile "<BR>Raw Cookie: &nbsp;", raw_cookie() }   
if (query_string()) { print outFile "<BR>Query String: &nbsp;",
query_string() }
if (referer()) { print outFile "<BR>Referrer: &nbsp;", referer() }
if (remote_addr()) { print outFile "<BR>Remote Addr: &nbsp;", remote_addr()
}
if (remote_ident()) { print outFile "<BR>Remote Ident: &nbsp;",
remote_ident() }
if (remote_host()) { print outFile "<BR>Remote Host: &nbsp;", remote_host()
}
if (remote_user()) { print outFile "<BR>Remote User: &nbsp;", remote_user()
}
if (request_method())  { print outFile "<BR>Request Method: &nbsp;",
request_method() }
if (virtual_host()) { print outFile "<BR>Virtual Host: &nbsp;",
virtual_host() }
if (server_port()) { print outFile "<BR>Server Port: &nbsp;", server_port()
}
if (user_agent()) { print outFile "<BR>User Agent: &nbsp;", user_agent() }
if (user_name()) { print outFile "<BR>User Name: &nbsp;", user_name() }
        
print outFile "<BR>Visit logged: ", scalar localtime;
#............................................................................
    close(outFile) or
      &ioError("Cannot close $reportLog: $!\n");

}

HTH, =)
-Sneex- 
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster


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

Date: 18 May 1998 10:41:03 +1000
From: Stuart Cooper <stuartc@ind.tansu.com.au>
Subject: Re: IF problems....
Message-Id: <yeog1i8h0m8.fsf@kudu.ind.tansu.com.au>

jtbell@presby.edu (Jon Bell) writes:

>  Ali <ampun@bigfoot.com> wrote:
> >I create a script to determine a specific number between a range
> 
> >    if (2 <= $match <= 3) {
> 
> I bet you're a COBOL programmer.  :-)  COBOL is the only language I know
> of that allows one to write conditions like the one above (with different
> syntax, of course).  In Perl, as in most languages, one has to combine two
> individual comparisions using Boolean operators. 
> 
>     if ($match >= 2 && $match <= 3) {
> 
> -- 
> Jon Bell <jtbell@presby.edu>

Actually, I'd write the first conditional in reverse order; to
empahsise that it is a "between 2 and 3" comparison. Here goes:

if ( (2 <= $match) && ($match <= 3) ) {

Most programmers stick the variable name first both times as Jon has;
but I find that my way is easier to read because it's more like the
math version that Ali has.

I think some languages have an "IN" or "BETWEEN" clause that would
acheive what is required here.

Here's some prattle on this idea I posted many months ago:

================================================================
  This is the way I do these things:

  Eg 1) is x between 2 and 5 inclusive?

        Math: 2 <= x <= 5
        Perl: if ( (2 <= $x) and ($x <= 5))
                laying it out like this is superior to
                having $x first both times which most programmers would do.
              if ( ($x >= 2) and ($x <= 5)) # BAD - harder to read

  Eg 2) is x outside of 2 and 5 inclusive?
       Math: x < 2, x > 5
       Perl: if ( ($x < 2) or ($x > 5))
                can we get a nice formatted version of this? Don't think so.
             if ( not ((2 <= $x) and ($x <= 5))) # $x outside of range [2,5]
                $x is *not* in the range between 2 and 5.
                this equates to the or version;
                NOT (A and B) <==> ( (NOT A) or (NOT B)) [A De Morgan law]
                you can employ the Maths range notation in your comments
                 ie [2,5] is 2 <= x <=5 (2,5] is 2 < x <=5 
                    [2,5) is 2 <= x < 5 and (2,5) is 2 < x < 5 
                    although it looks mightily like an ordered pair.
================================================================

Hope this helps,
Stuart Cooper
stuartc@ind.tansu.com.au


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

Date: 17 May 1998 21:05:30 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Is if ($a="something") a bad style?
Message-Id: <6jo1gq$8k2$1@monet.op.net>
Keywords: accomplish hysterectomy phrasemake prescript


In article <comdog-ya02408000R1705981924100001@news.panix.com>,
brian d foy <comdog@computerdog.com> wrote:
>well, one can write stupid comments if one likes, but an effective
>comment would be:
>
># try to connect to the database and assign the reference in $dbh
># if the connect fails, the if() fails since the method returns
># undef
>if( $dbh = Msql->connect() ) { ... }


I disagree very strongly.  I think that is the worst possible comment.
It has all the same problems as the much-reviled

	$i++   # increment $i

It is not the job of the programmer to explain basic language
semantics in the comments.  Such comments are useless and take up
valuable space.  They are often confusing.  If badly maintained (or
badly written to begin with) they contradict the code, which creates
problems for the maintenance programmer, who doesn't know whether to
believe the code or the comment or neither.  In this case, for
example, you said `assign the reference in $dbh'.  To me, this
suggests that there is a reference in $dbh, and that you made an error
in the code, writing $$dbh instead of $dbh.

I suspect we are not going to agree on this.  But my stance is that it
is always useless to explain basic semantics in comments, because if
the code is straightforward, it will speak for itself and an
explanation is superfluous.

Rob Pike says:  ``If your code needs a comment to be understood, it
would be better to rewrite it so it's easier to understand.''  I agree.



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

Date: Sun, 17 May 1998 20:21:56 -0400
From: Jason Mclaughlin <mcjason@idirect.com>
Subject: Looking for Perl TCP/IP Server Script
Message-Id: <355F7F22.76967547@idirect.com>

Okay, I know I've already asked, But I wasn't specific enough.
I've already tried all the example scripts in perlipc and asked in #perl
on irc
What I need is a Perl Script which WILL work with Activestate's Perl32.
I just wanna make a Simple Script which will Send some text to a person
that connects to a certain tcp/ip port, and none of the example scripts
worked. Any help would be greatly appretiated. Thanks alot!
--
What is Windows 95?

Windows 95 is a 32-bit extension for a 16-bit patch for a 8-bit
operating system which was originally coded for a 4-Bit microprocessor
by a 2-bit company that can't stand 1-bit of competition. :)

Jason Mclaughlin <mcjason@idirect.com>
http://webhome.idirect.com/~mcjason




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

Date: 17 May 1998 22:23:46 -0400
From: schinder@leprss.gsfc.nasa.gov (Paul J. Schinder)
Subject: Re: Need help from MacPerl expert!
Message-Id: <6jo63i$5a1@shell.clark.net>

In <6jl8p7$9s7$1@resunix.sickkids.on.ca> ali@genet.sickkids.on.ca (Alex Dong Li) writes:

>Date: Sat, 16 May 1998 19:30:41 -0400 (EDT)
>From: "Dong Li (Alex)" <ali@genet.sickkids.on.ca>
>To: Alex Dong Li <ali@genet.sickkids.on.ca>
>Subject: Forwarded mail....
>Message-ID: 
><Pine.A32.3.91.980516193032.27947A-100000@viola.genet.sickkids.on.ca>
>MIME-Version: 1.0
>Content-Type: TEXT/PLAIN; charset=US-ASCII
>Status:  O


>Dear MacPerl experts, especially experts internet connection,

>I am trying to modify a unix/winNT version of web GET subroutine,
>which acts like a GET client, so that I can use it on Mac.
>When I tried the following script on Mac, I got the following message:
>"Cannot bind. No enough space"
>Could anyone tell me why? And also are "$AF_INET = 1" and 
>"$SOCK_STREAM =1" correct for Mac?

Well, you're in luck, since with every recent version of MacPerl (and
there's no reason you shouldn't be running 5.20r4) you get
libwww-perl-5, so you can say

#!perl
use LWP::Simple;
getstore($url,$file);

It will do most of the common protocols (http, ftp, etc.).  There's no
reason to use ancient Perl 4 code for this.  You can open :MacPerl
f:lib:LWP:Simple.pm with Shuck to read the built in documentation.

>Thanks in advance.

[snip]

>Email: ali@genet.sickkids.on.ca 
>URL: http://www.globalserve.net/~lidong/
-- 
--------
Paul J. Schinder
NASA Goddard Space Flight Center
schinder@leprss.gsfc.nasa.gov


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

Date: Mon, 18 May 1998 11:12:12 +1000
From: Anthony Mandic <no_sp.am@agd.nsw.gov.au>
Subject: Re: Nuclear bombing of NEW YORK! Small countries can target with nukes!
Message-Id: <355F8AEC.E2380C21@comdyn.com.au.x>

Martien Verbruggen wrote:
> 
> In article <3558CD29.12CB@yahoo.com>,
>         gdw <gdw@yahoo.com> writes:
> 
> > "INDIA had developed GLOBAL Destruction weapon". What it means that -
> > "Planet EARTH is NOT ONLY a HUGE bar magnet BUT also is a HUGE ATOM
> > BOMB!!"
> 
> Wow... And we could have known all this time. The spread of FRIDGE
> MAGNETS should have shown us what was going on. After all!!! All
> FRIDGES are made of ATOMS!!!!
> 
> Martien
> --
> Martien Verbruggen                  |
> Webmaster www.tradingpost.com.au    | For heaven's sake, don't TRY to be
> Commercial Dynamics Pty. Ltd.       | cynical. It's perfectly easy to be
> NSW, Australia                      | cynical.


	I see that they're employing morons at the Trading Post now.
	Hey English, you brain is made up of atoms too. So don't
	think too hard or it might just explode.


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

Date: Mon, 18 May 1998 02:25:14 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: Re: Nuclear bombing of NEW YORK! Small countries can target with nukes!
Message-Id: <355F9A2C.F39504AE@fccjmail.fccj.org>

Martien Verbruggen wrote:
> 
> In article <3558CD29.12CB@yahoo.com>,
>         gdw <gdw@yahoo.com> writes:
> 
> > "INDIA had developed GLOBAL Destruction weapon". What it means that -
> > "Planet EARTH is NOT ONLY a HUGE bar magnet BUT also is a HUGE ATOM
> > BOMB!!"
> 
> Wow... And we could have known all this time. The spread of FRIDGE
> MAGNETS should have shown us what was going on. After all!!! All
> FRIDGES are made of ATOMS!!!!


ROTFLOL!  Stop, stop, please!  You're KILLING Me =)

-(Sounds of cylinder spinning, click, spin, click, spin, BANG!)- 
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster


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

Date: Mon, 11 May 1998 20:44:43 -0700
From: Sam Brodkin <sammy.brodkin@sun.com>
Subject: perl binary with libraries included
Message-Id: <3557C5AB.18DA3489@sun.com>

Is it possible to compile perl with the libraries included (so that you
don't have to have a libraries directory?)

Thanks!

Sam



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

Date: Mon, 18 May 1998 10:03:24 -0500
From: Kira Kira <kira98_98@yahoo.com>
Subject: POP UP window
Message-Id: <35605BCC.6B66@yahoo.com>

I have a HTML form. When a user click on the OK button, I would like to
see a POP UP window display. But i do not want the current HTML form to
disappear. 

I know In JAVAscript you can use the "alert()" command. But because i am
using cgi , you need the "content-type:text/html".


Please help!!!


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

Date: Mon, 18 May 1998 02:40:27 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: Re: POP UP window
Message-Id: <355F9DBD.67207E2B@fccjmail.fccj.org>

Kira Kira wrote:
> I know In JAVAscript you can use the "alert()" command. But because i am
> using cgi , you need the "content-type:text/html".

JavaScript is still the correct path...

The world has not changed just because you're off topic!  =)
The answer lies within JavaScript =)

CGI will not pop-up without JavaScript or some such HTML trick =)

You must unlearn what you have learned, 
if you wish to be a Jedi Knight =)
-Sneex- 
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster


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

Date: Sun, 17 May 1998 22:52:11 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: POP UP window
Message-Id: <comdog-ya02408000R1705982252110001@news.panix.com>
Keywords: from just another new york perl hacker

In article <355F9DBD.67207E2B@fccjmail.fccj.org>, bill@astro.fccj.cc.fl.us posted:


>CGI will not pop-up without JavaScript or some such HTML trick =)

not even using Window-target? :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers T-shirts! <URL:http://www.pm.org/tshirts.html>


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

Date: Mon, 18 May 1998 02:49:38 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: Re: POP UP window
Message-Id: <355F9FE4.5569E1DD@fccjmail.fccj.org>

brian d foy wrote:
> 
> In article <355F9DBD.67207E2B@fccjmail.fccj.org>, bill@astro.fccj.cc.fl.us posted:
> 
> >CGI will not pop-up without JavaScript or some such HTML trick =)
> 
> not even using Window-target? :)
> 
> --
> brian d foy                                  <comdog@computerdog.com>
> CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
> Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
> Perl Mongers T-shirts! <URL:http://www.pm.org/tshirts.html>

Still a HTML-related trick :)
-- 
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster


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

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 2624
**************************************

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