[11683] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5283 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 2 04:04:45 1999

Date: Fri, 2 Apr 99 01:00:18 -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           Fri, 2 Apr 1999     Volume: 8 Number: 5283

Today's topics:
    Re: Can you return hashes in subroutines? <jackg@aloha.net>
    Re: Easy(?) Riddle (Tad McClellan)
    Re: extracting from text files (Tad McClellan)
    Re: Getting owner of WindowsNT files <xrxoxtxhxdx@xrxoxtxhx.xnxextx>
        How to remove repeated signs ? <beton@topnet.pl>
    Re: multi-d array (Larry Rosler)
    Re: my random doesn't return number!! (Bart Lateur)
    Re: Nothing returned from system call backticks <bill@fccj.org>
    Re: Perl to C <wayne.izatt@myself.com>
    Re: protecting perl scripts <bill@fccj.org>
        Q:Bi-Directional Communication through sockets <bretf@lava.net>
    Re: Q:Bi-Directional Communication through sockets <Tony.Curtis@vcpc.univie.ac.at>
    Re: Reading a line <jackg@aloha.net>
    Re: Retrieving  info after POSTing from a perl script (Tom Mornini)
    Re: Server Side Includes <bill@fccj.org>
    Re: simple HTTP_REFERER script? <bill@fccj.org>
    Re: Simple Program <bill@fccj.org>
    Re: simple request/question (Ronald J Kimball)
    Re: Sun Microsystems Sponsors Perl Mongers (Tad McClellan)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Thu, 1 Apr 1999 21:17:06 -1000
From: "Jack Guyant" <jackg@aloha.net>
Subject: Re: Can you return hashes in subroutines?
Message-Id: <7e1qs3$e6e$1@nuhou.aloha.net>

Have you tried returning a reference to a hash?

Jack Guyant
jackg@aloha.net





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

Date: Thu, 1 Apr 1999 19:41:02 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Easy(?) Riddle
Message-Id: <um31e7.cmb.ln@magna.metronet.com>

Adam (ajones@buildandcompare.com) wrote:

: A seemingly easy problem, my code:

: $var1 = "$5.99";

[snip]

: when I run it I get:

: "The price of the nick nack is $ "

: Q:  How come I get a blank price when I match against the dollar sign, but
: number with the "Z"?


   -w points out something about that line.

   Nobody runs perl without the -w switch.

   You shouldn't either.


: Am I escaping things correctly?


   You are on the right track, you are not escaping 
   where escaping is needed (or, you chose the wrong
   kind of quotes).


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 1 Apr 1999 19:50:06 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: extracting from text files
Message-Id: <u741e7.cmb.ln@magna.metronet.com>

Charlie Fulton (acrfrd1@pebble.sct.ucarb.com) wrote:

: I am trying to use perl do the following. These are my shell commands that work
: for me..
:                  
: 1.) grep -F Stoi $i | cut -d " " -f6 | cut -d "(" -f1 > /tmp/f1               
: 2.) grep "Zero-point correction" $i | cut -d " " -f31 > /tmp/f2

: ######### My attempt with perl so far #########
: #!/usr/bin/perl -w


   You have warnings enabled.

   That is very good.

   Now add a "use strict;" pragma too, and let perl save you
   from your own mistakes even more.


: I am a perl newbie so don't laugh at my code :). the output of this program
: right now just shows as the whole lines mentioned above, i'm not sure how to do
: the equivalent of cut and use the spaces as delimeters, etc. 


   "cut" type things are usually done in Perl with one of:

      pattern match with backreference(s)
      split()
      unpack()
      substr()


: Just looking for some hints, tips, etc. Point me to a faq is necessary.


   See perlfunc.pod for the last three, 
   perlre.pod and perlop.pod for pattern matching.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 1 Apr 1999 22:44:25 -0800
From: "Dave Roth" <xrxoxtxhxdx@xrxoxtxhx.xnxextx>
Subject: Re: Getting owner of WindowsNT files
Message-Id: <dGZM2.5431$fb4.7087@news2.giganews.com>

Chuck Hirstius wrote in message ...
>Check out the docs on the Win32::FileSecurity module  Should give you what
>yer looking for.
>
>Chuck
>
>
>Reiner Fischer wrote in message
><3701B93A.910C61ED@Non-HP-Germany-om4.om.hp.com>...
>>Hello,
>>
>>i have a problem. In WindowsNT, every file has an owner, for example
>>shown in the file properties.
>>
>>Is there a module in Perl, which help me getting the ownername? I tried
>>stat() and File, but i found no
>>possibility.

You can also check out Win32::Perms. Allows permission, audit, ownership
and primary group management of win32 object. This includes not only
files and dirs but UNCs, network shares, printer shares and registry keys.

dave

--
=================================================================
Dave Roth                                ...glittering prizes and
Roth Consulting                      endless compromises, shatter
http://www.roth.net                     the illusion of integrity
Win32, Perl, C++, ODBC, Training
rothd at roth dot net

Our latest Perl book is now available:
"Win32 Perl Programming: The Standard Extensions"
http://www.roth.net/books/extensions/

>>
>>Bye,
>>
>>--
>>Reiner Fischer
>>
>>--
>>Reiner Fischer
>>
>>Advanced Technology Services Team
>>Application Services Europe
>>Hewlett Packard GmbH
>>
>>Hanns-Klemm-Str. 5
>>71034 Bvblingen
>>
>>Phone: +49 7031 626-1333, Telnet 702-1333
>>Fax:   +49 7031 626-1134
>>E-mail: REINER_FISCHER@Non-HP-Germany-om4.om.hp.com
>>
>>
>
>




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

Date: Fri, 02 Apr 1999 08:34:42 GMT
From: "Robert" <beton@topnet.pl>
Subject: How to remove repeated signs ?
Message-Id: <Ci%M2.4780$_u5.636588@news.tpnet.pl>

Hi,

for example how to:

ABBA -> ABA
WOOOOOOOOOOOOOOOOOOOOW -> WOW

etc.

?

Robert




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

Date: Thu, 1 Apr 1999 23:31:00 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: multi-d array
Message-Id: <MPG.116e120c1ee3ead4989816@nntp.hpl.hp.com>

In article <1dplqhh.n06jz71c74rbqN@[207.60.170.137]> on Thu, 1 Apr 1999 
21:54:44 -0500, Ronald J Kimball <rjk@linguist.dartmouth.edu >says...
 ...
> Yes, you can do that, except that it should be:
> 
> for ($i=0; $i < $max; $i++) {
>   for ($j=0; $j < $max; $j++) {
>     $Lol[$i][$j] = "happy";
>   }
> }
> 
> Now it's valid Perl.  :)

Actually, it's valid Perl 'baby-talk'.  Here's the adult version:

@Lol = ( [ ('happy') x $max ] ) x $max;

<grin>

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 02 Apr 1999 09:53:56 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: my random doesn't return number!!
Message-Id: <3706918b.3779718@news.skynet.be>

Ronald J Kimball wrote:

>>   for (1..50) {
>>     print 1+int(rand 5);
>>   }
>> 
>> There.
>
>Umm...  That works, but it kinda misses the point of comparing the
>meaning of $#foo and scalar @foo, wouldn't you say?

My "whole point" is that the original poster must have took an approach
that's far too complex for his actual need. What his thing did, was:

 * select a random number which is a valid index to an array of keywords
 * get that keyword
 * look it up using a hash
 * get (and return) the value from the hash

The "keyword step" is unnecessary, anyway. The keyword itself is never
retained! Just an array of the *values* of the hash is enough!

	@value = values %hash;
	return $value[int(rand @values)];

n.b. the int()may not be strictly necessary, but I can't find anywhere
in the docs how a non-integer array index is treated. int() "rounds it
down", although TomC doesn't like that terminology. Well alright,
"floor" then.

But the subject line seems to indicate that this is still too complex.
If all he wants is a number, this is all that is needed:

	int(rand $max)

which gives an INTEGER number between 0 (incl.) and $max (excl.).

	Bart.


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

Date: Thu, 01 Apr 1999 21:25:41 -0500
From: "Bill Jones" <bill@fccj.org>
Subject: Re: Nothing returned from system call backticks
Message-Id: <37042ad3.0@usenet.fccj.cc.fl.us>

In article <7e0v0d$95t$1@bashir.ici.net>, "Joe Blow" <Joeblow@nowhere.com>
wrote:


> Hello All,
>
> I've been experiencing an intermittent problem that is becoming pretty
> annoying.
>
> Sometimes, when I use backticks to run a system command, I get nothing
> back (even though I should):
>
> For example:
>
> $ls_result = `ls /etc`;
>
>
> If I put the code in a loop, $ls_results would eventually get set properly:
>
> my $i = 1;
> while (1) {
>             $ls_result = `ls /etc`;
>             last if ( $ls_result ne "" );
>             last if ( $i == 100 );
>             $i++;
> }
>
> I thought it might be a buffering problem, but it still occasionally
> returns nothing with buffering turned off.
>
> Could this be a Perl bug, or is there something else that I'm not
> taking into account??
>
> I'm running Perl 5.004_04 on Digital UNIX 4.0E if that matters.
>
>
> Thanks,
>
> Steve
>
>

Hmmm, is there something wrong with DIRREAD and related functions?

Just wondering,
-Sneex-  :]
________________________________________________________________________
Bill Jones  |  FCCJ Webmaster  |  http://www.fccj.org/cgi/mail?webmaster
FCCJ  |  501 W State St  |  Jacksonville, FL 32202  |  1 (904) 632-3089

         Jacksonville Perl Mongers
         http://jacksonville.pm.org
         jax@jacksonville.pm.org


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

Date: Fri, 02 Apr 1999 08:18:03 GMT
From: Wayne Izatt <wayne.izatt@myself.com>
Subject: Re: Perl to C
Message-Id: <36DF9295.D3739191@myself.com>

perlcc is the animal you're looking for. I believe it is part of the
5.005... distribution.

ta

Hank Miller wrote:
> 
> I am looking for the perl to c compiler... any help would be greatly
> appreciated...
> 
> --
> 
> -Hank...
> 
> http://www.connor-miller.com
> hank@connor-miller.com
> 
> Office:
> (407) 905-0600
> (407) 905-0510 Fax
> 
> Home:
> (407) 654-6031
> (407) 654-6032 Fax


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

Date: Thu, 01 Apr 1999 21:05:09 -0500
From: "Bill Jones" <bill@fccj.org>
Subject: Re: protecting perl scripts
Message-Id: <37042605.0@usenet.fccj.cc.fl.us>

----------
In article <7dalf4$jmh$1@malgudi.oar.net>, "Mr.unix" 
<Mr.unix@mail.excite.com> wrote:


> Is there anyway to protect my scripts from being copied, such as compiling
> to an executable form for distribution?
>
> I have worked hard on a socket program here at work that will allow real
> time information to be passed from our mainframe to a Unix or wintel system.
> Now that some have caught wind of its future potential, they want to use it,
> forgetting about who made it all possible in the first place. They want to
> take credit for the entire endeavor, not just the glossy candy coat they may
> have applied to the surface.
>
> I guess this is my "Welcome to the Business World".
>
>

Um, no ...

Welcome to the 'Open Source' world.

( I've always wrote things that I enjoyed; with the hopes
  that someone would find them useful.  I've always gotten
  paid for everything else.... )

My 2 cents,
-Sneex- :]
________________________________________________________________________
Bill Jones  |  FCCJ Webmaster  |  http://www.fccj.org/cgi/mail?webmaster
FCCJ  |  501 W State St  |  Jacksonville, FL 32202  |  1 (904) 632-3089

         Jacksonville Perl Mongers
         http://jacksonville.pm.org
         jax@jacksonville.pm.org


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

Date: Thu, 1 Apr 1999 20:18:54 -1000
From: "Bret" <bretf@lava.net>
Subject: Q:Bi-Directional Communication through sockets
Message-Id: <7e1n73$8p5$1@mochi.lava.net>

Hi, I'm still learning perl, so any help is appreciated.
Thanks in advance

Q:  How can I get a client and server script to communicate bi-directionaly
through sockets
using
    use Socket;?
I can get the server to send to the client, but can't get the client to send
back to the server.

Thanks for any help





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

Date: 02 Apr 1999 09:00:53 +0200
From: Tony Curtis <Tony.Curtis@vcpc.univie.ac.at>
Subject: Re: Q:Bi-Directional Communication through sockets
Message-Id: <83iubfpkuy.fsf@vcpc.univie.ac.at>

Re: Q:Bi-Directional Communication through sockets,
Bret <bretf@lava.net> said:

Bret> Q: How can I get a client and server script to
Bret> communicate bi-directionaly through sockets
Bret> using use Socket;?  I can get the server to
Bret> send to the client, but can't get the client
Bret> to send back to the server.

perldoc perlfaq
perldoc perlipc

and maybe

perldoc Net::Cmd
perldoc Net::SMTP
perldoc Net::FTP

hth
tony





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

Date: Thu, 1 Apr 1999 21:15:26 -1000
From: "Jack Guyant" <jackg@aloha.net>
Subject: Re: Reading a line
Message-Id: <7e1qov$e5o$1@nuhou.aloha.net>

Try:

while ($line = (<>) {
   # Process ...
}

Do not give an argument to the script. In the absence of an argument, @ARGV
defaults to STDIN. If your running under Unix/Linux, then Ctrl-D will of
course terminate input. Under Win32, Ctrl-Z and Enter.

Jack Guyant
jackg@aloha.net





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

Date: Fri, 2 Apr 1999 07:09:41 GMT
From: tmornini@netcom.com (Tom Mornini)
Subject: Re: Retrieving  info after POSTing from a perl script
Message-Id: <tmorniniF9Jvw5.84C@netcom.com>

Greg McCann (gregm@well.com) wrote:

: > I've been trying to figure out how to POST to a cgi script via perl, but
: > I can't seem to figure it out... I followed the example in the docs but
: > it doesn't seem to work for POST (I can get it to work for GET)...
: >
: > I'd like to post the data the form at this URL is asking for directly to
: > the CGI and retrieve the course listing that is created:
: >
: > https://www.bu.edu/link/bin/uiscgi_studentlink?applpath=univschs.pl
    ^^^^^

: > If you'd like to test it, try FALL 99, CAS, CS, 113, and A2 for your
: > values.  I can see that the form is being POSTed to
: > "https://www.bu.edu/link/bin/uiscgi_studentlink", but how do I define
     ^^^^^
: > the values for the form, etc?

LWP won't work for SSL connections. Get SSLeay or OpenSSL and Net::SSLeay.

-- Tom Mornini
-- InfoMania


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

Date: Thu, 01 Apr 1999 21:31:18 -0500
From: "Bill Jones" <bill@fccj.org>
Subject: Re: Server Side Includes
Message-Id: <37042c25.0@usenet.fccj.cc.fl.us>

In article <37040110.EDC013A@gmx.de>, Lars Plessmann <larsplessmann@gmx.de>
wrote:


> When I want to initialize such a server side includes, it does not work
> in any way!
> The Apche server doesn't include the perl script into the shtml file.
> What have I done wrong?
>
> that are the error messages in the error_log:
>
> Unquoted string "false" may clash with future reserved word at
> /server/domain/cgi-bin/preise.pl line 28.
> Name "main::name" used only once: possible typo at
> /server/domain/cgi-bin/preise.pl line 11.
> Argument "false" isn't numeric in eq at /server/domain/cgi-bin/preise.pl
> line 28.

Going out on a limb here (this is scary :)  I have to assume
that the Apache conf file(s) actually allow CGI and/or SHMTL ?

Assuming that, then your perl script really has a bare word showing;
if you would post the offending code fragment I am sure either I
or someone here will be able to point it out.

Reading from the above error(s) alone say that you have a
coding issue inside your script.  A lack of 'my' usage,
as well as referencing 'vars' inside the main:: package
itself - which, of course, is your script's main logic...

HTH,
-Sneex- :]
________________________________________________________________________
Bill Jones  |  FCCJ Webmaster  |  http://www.fccj.org/cgi/mail?webmaster
FCCJ  |  501 W State St  |  Jacksonville, FL 32202  |  1 (904) 632-3089

         Jacksonville Perl Mongers
         http://jacksonville.pm.org
         jax@jacksonville.pm.org


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

Date: Thu, 01 Apr 1999 20:54:33 -0500
From: "Bill Jones" <bill@fccj.org>
Subject: Re: simple HTTP_REFERER script?
Message-Id: <37042389.0@usenet.fccj.cc.fl.us>

[Mailed and posted...]

In article <37041D9B.EA4683F9@city-net.com>, david <optic@city-net.com>
wrote:


> Hello
>
> I need a simple script that will kick out a list of HTTP_REFERER
> to a log, and then to an HTML page.  I want to keep track of
> hits to my site through search engine queries.
>
> I'm new to Perl.... but I would think that this should be a simple
> enough operation.
>
> Any help?
>
>
> Thanks,
>
> David


Hmmm...  Maybe a long example is needed?  Please correct
for formatting errors as needed.

The following may raise more questions than it answers;
please direct them to me -Sneex-, not the group.  Thx!

You can see this script in action at -
http://www.fccj.org/cgi/process_status.cgi

Then look at the report it makes at -
http://www.fccj.org/wcjReportLog.html

The code -

#!/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 = 4;

# 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.58" => "sneex.fccj.cc.fl.us", # Sneex NetBlazer access...
"207.203.47.7" => "astro.fccj.cc.fl.us", # Webmaster's domain leg...
);

# 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...

# Lcation & 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 $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>Process Status on Astro</TITLE>
<META HTTP-EQUIV=Refresh CONTENT=30;URL=/wcjReportLog.html>
</HEAD>
<BODY BGCOLOR=WHITE>";

print "<P>Warning: &nbsp; All accesses are logged...";
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 "<BR>The current 'netstat -sP tcp' status, 'ps -efl' status, and last
50 accesses on Astro is -<PRE>";
print `netstat -sP tcp`;
print "\n";
print `ps -efl`;
print "\n";
print `last -n 50`;
print "</PRE><P>Done... &nbsp;If you have questions please contact
the <a href=/cgi-bin/mail?webmaster>Webmaster</a>...";
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) {
    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");

}

# End of code...

Notice how little 'perl' there actually is?
Also know that the HTTP_REFER is easily spoofed...

HTH!
-Sneex-  :]
________________________________________________________________________
Bill Jones  |  FCCJ Webmaster  |  http://www.fccj.org/cgi/mail?webmaster
FCCJ  |  501 W State St  |  Jacksonville, FL 32202  |  1 (904) 632-3089

         Jacksonville Perl Mongers
         http://jacksonville.pm.org
         jax@jacksonville.pm.org


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

Date: Thu, 01 Apr 1999 20:59:37 -0500
From: "Bill Jones" <bill@fccj.org>
Subject: Re: Simple Program
Message-Id: <370424b6.0@usenet.fccj.cc.fl.us>

You didn't say 'my' often enough???

:]
________________________________________________________________________
Bill Jones  |  FCCJ Webmaster  |  http://www.fccj.org/cgi/mail?webmaster
FCCJ  |  501 W State St  |  Jacksonville, FL 32202  |  1 (904) 632-3089

         Jacksonville Perl Mongers
         http://jacksonville.pm.org
         jax@jacksonville.pm.org

----------
In article <36F8CD0D.ABD27AFC@saifun.com>, Ophir Marko <ophir@saifun.com>
wrote:


> # /local/perl/bin/perl -w
> $index=0;
> while(<>){
>  $i=0;
>  split;
>  while ($i <= $#_){
>   @array[$i+$index]=$_[$i];
>   i++;
>  }
> $index=$index+$#_+1;
> }
> $t=0;
> open(INFILE, ">new");
> if @array[$t] = ophir{
>  print INFILE @array[$t];
>  $t++;
> }
> close(INFILE);
>
>
> What's wrong?
> 


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

Date: Fri, 2 Apr 1999 01:08:16 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: simple request/question
Message-Id: <1dpm01t.18zwxoerwe4yoN@[207.60.170.137]>

"Jim" <syt@email*@sp\am|@|spa/m@*.com> wrote:

> It's fairly simple, all I want to do is add all the values between %7C and
> %5E together from this string below
> 
> http://www.domain.com/script.cgi?calc=calc&case=pig%7C98.07%5E&cee2u=r+ix%7C
> 12.21%5E&board=22three95%7C12.21%5E&s_u_b_m_i_t=Calculate
> 
> I need to generically be able to add those numbers together without having
> to specify a specific amount of numbers to add together or anything else.

Use a regex to grab all the numbers between '%7C' and '%5E', and then
simply add them together.


$_ = 'http://www.domain.com/script.cgi?calc=calc&case=pig' .
     '%7C98.07%5E&cee2u=r+ix%7C12.21%5E&board=22three95%7C12.21%5E' .
     '&s_u_b_m_i_t=Calculate';

$sum = 0;

while (/%7C([\d.]+)%5E/gi) {
  $sum += $1;
}

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 1 Apr 1999 19:25:53 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Sun Microsystems Sponsors Perl Mongers
Message-Id: <hq21e7.cmb.ln@magna.metronet.com>

brian d foy (comdog@computerdog.com) wrote:
: SUN MICROSYSTEMS SPONSORS PERL MONGERS

: Perl Mongers [1] and Sun Microsytems [2] recently inked
: contracts arranging for the California-based hardware
: company to sponsor the New York based non-profit to the tune
: of a quarter of a million dollars 


   Cool!

   Little alligators on Monger T-shirts. 

   Perl commercials during the Superbowl.

   Maybe the Executive Director can even get a new 
   keyboard with a working shift key and everything?



   But,

      How can I round that off to two decimal places?

      How can I output that number with commas added?


: said industry spokesperson
: Tim O'Reilly, whose technical book publishing house O'Reilly
: & Associates [3] recently purchased all rights to Perl 6,
: and will rename it Java 1.3. 


      What's the difference between "java" and "Java"?


: "These changes had been in the
: works for a long." said O'Reilly, "You didn't think JPL
: [Java-Perl Lingo] was for Perl's benefit, did you?"

: As part of the deal, Perl Mongers will be known as Java
: Mongers, and the affiliate groups, whose names typically
: ended in ".pm" as a play on the Perl module system, will now
: end with ".class", 


   Mongers with class?

   Bit of a stretch there...


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

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

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