[8532] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2149 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Mar 21 00:07:21 1998

Date: Fri, 20 Mar 98 21:00:31 -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, 20 Mar 1998     Volume: 8 Number: 2149

Today's topics:
    Re: Can PERL run in the background? (Abigail)
        Changing Substr's into RegEx... <chasecreek.systemhouse@usa.net>
    Re: Changing Substr's into RegEx... <bholzman@mail.earthlink.net>
        detecting error 404 in perl5 <niksun@intop.net>
    Re: detecting error 404 in perl5 <chasecreek.systemhouse@usa.net>
    Re: dis gotta be a easy one?!?!?! (Jeff Yoak)
    Re: help needed with grep type function for perl script <bholzman@mail.earthlink.net>
    Re: How do you capture command line arguments? <tcfb@tcfb.com>
    Re: How to take the icecream from the trashbox? (Abigail)
    Re: HTML::Element::extract_links not grabbing frame sou <ebohlman@netcom.com>
        is there anything like "geturl()" in perl? <bgrogan@bullfrog-tech.com>
    Re: is there anything like "geturl()" in perl? <ebohlman@netcom.com>
    Re: is there anything like "geturl()" in perl? <chasecreek.systemhouse@usa.net>
    Re: Net::FTP & firewalls? <tory1@mail.idt.net>
    Re: Opening dirs in Win32 <ebohlman@netcom.com>
    Re: Problem with "goto" in Perl <rjk@coos.dartmouth.edu>
    Re: qw (was: Re: Newbie question: using split() while i (Abigail)
    Re: qw (was: Re: Newbie question: using split() while i <zenin@archive.rhps.org>
    Re: qw (was: Re: Newbie question: using split() while i <uri@sysarch.com>
    Re: Stinking lousy $*(@#*$@ cmd lin args-HELP <ebohlman@netcom.com>
    Re: sub-array length? <ebohlman@netcom.com>
    Re: sub-array length? <quentin@jihad.amd.com>
    Re: what is wrong with being a novice ?? <ebohlman@netcom.com>
    Re: what is wrong with being a novice ?? (Jeff Yoak)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 21 Mar 1998 02:20:26 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Can PERL run in the background?
Message-Id: <6ev85a$cu0$3@client2.news.psi.net>

Charles Jaimet (webmaster@netminder.com) wrote on MDCLXII September
MCMXCIII in <URL: news:3512dd2b.0@news.westel.com>:
++ Does anyone know if it's possible to call a PERL script through CGI from a
++ Web page form and not have to return a new page or reload the current one? 
++ 
++ Ideally I'd like the user to stay on the form page after submitting the
++ form.

Yes, that's possible.

Now, what has that to do with Perl?



Abigail
-- 
perl -wle\$_=\<\<EOT\;y/\\n/\ /\;print\; -eJust -eanother -ePerl -eHacker -eEOT


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

Date: Sat, 21 Mar 1998 01:16:46 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
Subject: Changing Substr's into RegEx...
Message-Id: <351313A2.1CD2DE6C@usa.net>

I have written a security piece which uses
substr, rindex, et al, to get parts of
the IP address.  An example of it is
at the end of this post.  It works
as is and is fairly fast, but I would like
to open a discussion about how it
could be done using RegEx...

I have been writing Perl for
a year now - Mar 18th was
my anniversary; and I have
finally decided that I can't
put it off any more...  :-)

Any input, ideas, and comments
would be appreciated :-)

Thx,
Sneex

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

use CGI qw(:all); # CGI.pm (written by Lincoln Stein.)
use strict;
my($fccjPointer) = new CGI;
$fccjPointer->import_names('FCCJ');

# For simplicities sake, here...
print header;

my(%fccjDomains) = ( # Place authorized addr here, follow format...
"24.129.63" => "mediaone.net",  # An Example...
# "127.0.0" => "Denied",        # An Example, Reasons Denied Go Here...
);

#.....Deleted unrelated code.......................

sub checkReferrer { # Check who called us...

    my($removeHostAddr) = substr(remote_addr,
(rindex(remote_addr(),".")));

    if (exists($fccjDomains{substr(remote_addr, 0,
        (length(remote_addr()) - length($removeHostAddr)))})) {

        if ($fccjDomains{substr(remote_addr, 0,
            (length(remote_addr()) - length($removeHostAddr)))} eq
"Denied") {

            $buffer = "'Domain Specifically Denied' " . remote_host(); #
Domain is specifically denied...
    # Do other error stuff...
        }
   }
}

#.....Deleted unrelated code.......................

If you would like to 'play' with a live
site, try here :-)

http://webmaster.fccj.org/cgi/DrSolomons.cgi




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

Date: Fri, 20 Mar 1998 21:07:06 -0500
From: Benjamin Holzman <bholzman@mail.earthlink.net>
To: sneaker@earthling.net
Subject: Re: Changing Substr's into RegEx...
Message-Id: <351320CA.4B3A3385@mail.earthlink.net>

> sub checkReferrer { # Check who called us...
> 
    ...
    remote_addr =~ /^((?:\d+\.??){3})/;
    if (my $domain_info = $fccjDomains{$1}) {
      if ($domain_info eq 'Denied') {
	...
      }
    ...
    }
    ...
>     my($removeHostAddr) = substr(remote_addr,
> (rindex(remote_addr(),".")));
> 
>     if (exists($fccjDomains{substr(remote_addr, 0,
>         (length(remote_addr()) - length($removeHostAddr)))})) {
> 
>         if ($fccjDomains{substr(remote_addr, 0,
>             (length(remote_addr()) - length($removeHostAddr)))} eq
> "Denied") {
> 
>             $buffer = "'Domain Specifically Denied' " . remote_host(); #
> Domain is specifically denied...
>     # Do other error stuff...
>         }
>    }
> }
> 
> #.....Deleted unrelated code.......................
> 
> If you would like to 'play' with a live
> site, try here :-)
> 
> http://webmaster.fccj.org/cgi/DrSolomons.cgi


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

Date: Fri, 20 Mar 1998 19:56:38 -0600
From: Niksun <niksun@intop.net>
Subject: detecting error 404 in perl5
Message-Id: <35131E56.B536F48C@intop.net>

I'm processing an html form and part of it is a url a user submits.  I
want to check if that url exists or results in a 404 error (doesn't
exist).  How can I do this?

Niksun


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

Date: Sat, 21 Mar 1998 04:30:54 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
Subject: Re: detecting error 404 in perl5
Message-Id: <35134122.F507857A@usa.net>

Look into LWP and ftp to www.perl.com and lookup 'webmirror';
both will get you started in the right direction...

HTH,
Sneex :-)
------------------
(I am just glad that all I had to do was cut-n-paste ;-)



Niksun wrote:

> I'm processing an html form and part of it is a url a user submits.  I
> want to check if that url exists or results in a 404 error (doesn't
> exist).  How can I do this?
>
> Niksun





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

Date: Sat, 21 Mar 1998 01:50:58 GMT
From: jeff@yoak.com (Jeff Yoak)
Subject: Re: dis gotta be a easy one?!?!?!
Message-Id: <6ev6pl$etk@sjx-ixn8.ix.netcom.com>

ron@farmworks.com (Ronald L. Parker) wrote:

>On Fri, 20 Mar 1998 12:02:23 GMT, Sneex
><chasecreek.systemhouse@usa.net> wrote:

>>First you, need  to create better Subject Lines...
>>(I almost  passed this up...)
>>
>>I am curious, you have access to the cgi-bin on a server via
>>FTP ONLY?   Is it in your personal directory?

>This is common practice for a number of webspace-only providers.

>The simple solution is, use CGI.pm so it can be tested from the
>command line, and install Perl on your home machine.  If this is
>impractical because the script uses a Unix database or Unix-only
>features like forking, then install Linux, FreeBSD, or the like, or
>resort to testing it on the web server.

Unfortunately, on systems where this is done it is also common to have
no way to change file permissions which makes webserver testing
difficult.  We have a local gem of an ISP here in Tampa Bay that
doesn't allow telnet and requires that you mail them Perl scripts and
*they* install them after reviewing them to make sure they don't do
anything they don't like.  Of course, they don't have anyone who knows
Perl beyond being able to read through the print statements so you can
imagine how much fun can be had...

Seriously, I don't know why people agree to work like that.  There are
so many places that provide better service.

Cheers,
Jeff

-------------------------------
Jeff Yoak         jeff@yoak.com



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

Date: Fri, 20 Mar 1998 21:20:07 -0500
From: Benjamin Holzman <bholzman@mail.earthlink.net>
To: Mark Kucera <kucera@mindsrping.com>
Subject: Re: help needed with grep type function for perl script.
Message-Id: <351323D7.77AE82C1@mail.earthlink.net>

Well, of course, you _could_ use grep.  Or, this:

open(FILE, "<filename") or die "Couldn't open filename: $!";
my $found_it = 0;
my $ip_to_find = '128.0.0.2';
while (<FILE>) {
  if (/$ip_to_find/) {
    print;
    $found_it = 1;
    last;
  }
}
print "Couldn't find [$ip_to_find]." unless $found_it;

Mark Kucera wrote:
> 
> I would appreciate some help from some perl experts out there if
> possible.
> 
> Basically i have a file, or records that contains various information.
> i want to be able to search that file for a particular set of data,
> and if found in the file, return the line found  or if not found,
> return that the text was not in the file.
> 
> example  say i have a data file that contains ip information in the
> form
> 
> room::ip::eth address::nslookup::id
> 
> 204::127.0.0.1:e399800000000s:host@school.edu::1
> 205::128.0.0.2:fe90902340000d:host2@school2.edu::2
> ...
> ...
> ...
> 
> etc  and i want search this ex file for 128.0.0.2  if 128.0.0.2 is in
> the file, then i want all the other informaiton that is on that line,
> but other wise  i want to know that 128.0.0.2 is not in this file...
> 
> can someone give me some suggestions about how to do this particular
> task?
> 
> thanks for your help.
> mark kucera
> kucera@mindspring.com


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

Date: Fri, 20 Mar 1998 23:04:21 -0500
From: Lionel Bourne <tcfb@tcfb.com>
Subject: Re: How do you capture command line arguments?
Message-Id: <35133C45.21DF@tcfb.com>

> "rickryan@ Mindspring" <rickryan@mindspring.com> writes:
> 
> > I'm trying to run a perl script directly from the browser's address line as
> > follows:
> >
> > anyscript.pl?arg1
> >
> > I've tried reading stdin, getopt, and $_[0] with no success.....How do I
> > capture the command line argument "arg1" into a program variable?
I believe what you need is something like this:
anyscript.pl?arg1=yes

where the variable is arg1 and the value is yes to see one in action,
go to yahoo, do a search, and see what your location line looks like:
http://search.yahoo.com/bin/search?p=smart+kid

Stephen
-- 
The Center For Business
http://www.tcfb.com



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

Date: 21 Mar 1998 02:15:27 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How to take the icecream from the trashbox?
Message-Id: <6ev7rv$cu0$2@client2.news.psi.net>

schwern@starmedia.net (schwern@starmedia.net) wrote on MDCLXII September
MCMXCIII in <URL: news:6euciv$okl$1@nnrp1.dejanews.com>:
++ Look at the perlfunc man page and read about "split", and get yourself a copy
++ of Learning Perl, 2nd edition.
++ 
++ Or if you're blessed with perl 5.004, "perldoc -f split" from your shell will
++ tell you about split.
++ 
++ The perlre man page will also be of some future help.
++ 
++ 
++ In article <351276EF.305F3D56@hikari-jhs.yamaguchi-u.ac.jp>,
++   Rossen Mikhov <rossen@hikari-jhs.yamaguchi-u.ac.jp> wrote:
++ >
++ > Hello. I have a problem and I would very much appreciate an advice.
++ >
++ > I have a long string and I want to get only a part of it. This is my
++ > script
++ >
++ > #Start
++ > $trashbox =":trash:trash:chocolate-icecream:arrow:trash:trash:trash";
++ > #The location of the icecream is just behind the ':arrow'
++ > $icecream_only = #What?
++ > #End


I've noticed that the following works:

perl -wle '$_ = ":trash:trash:chocolate-icecream:arrow:trash:trash:trash";
           $i = 10;
           print grep {$i = 0 if /chocolate-icecream/; 2 == $i ++} split /:/;'



Abigail
-- 
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
           print+Just (), another (), Perl (), Hacker ();'


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

Date: Sat, 21 Mar 1998 01:33:22 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: HTML::Element::extract_links not grabbing frame sources
Message-Id: <ebohlmanEq5Azn.74z@netcom.com>

Brock Sides <opus@magibox.net> wrote:
: I've been writing a web client that uses HTML::Element to pull links out
: of pages. Anyway, I'm running into a problem grabbing the sources of
: frames. Here's a snippet of code to demonstrate the problem. I'm using
: Element.pm v. 1.35.

: #!/usr/local/bin/perl

: use HTML::Parse;

: $html = '<img src="foo.jpg"><frame src="http://www.foo.org" name="foo">';

: $parsed_html = HTML::Parse::parse_html($html);

I don't think HTML::Parse understands <frame> elements yet, so it has no way 
of knowing that they contain attributes that refer to URLs (even if it 
did, it would have trouble with that example because it isn't well-formed 
HTML; <img> and <frame> can't occur in the same context).  Someone (I'm 
not volunteering) ought to write a module that parses HTML according to a 
supplied DTD (yes, I know there are modules that interface to spgrove, 
but they're overkill for a lot of applications).



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

Date: Fri, 20 Mar 1998 18:59:37 -0700
From: Bill Grogan <bgrogan@bullfrog-tech.com>
Subject: is there anything like "geturl()" in perl?
Message-Id: <35131F08.3DFC7287@bullfrog-tech.com>

I am attempting to write a little program to monitor the availability of
a web site.

Is there any way to have perl try and open a url?

I have been look and havn't come up with anything yet. Any ideas?

Thanks,
Bill



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

Date: Sat, 21 Mar 1998 02:33:54 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: is there anything like "geturl()" in perl?
Message-Id: <ebohlmanEq5DsI.BtB@netcom.com>

Bill Grogan <bgrogan@bullfrog-tech.com> wrote:
: I am attempting to write a little program to monitor the availability of
: a web site.

: Is there any way to have perl try and open a url?

: I have been look and havn't come up with anything yet. Any ideas?

You need to look a little further, specifically at the LWP module.



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

Date: Sat, 21 Mar 1998 04:29:10 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
Subject: Re: is there anything like "geturl()" in perl?
Message-Id: <351340BB.769F3912@usa.net>

Look into LWP and ftp to www.perl.com and lookup 'webmirror';
both will get you started in the right direction...

HTH,
Sneex :-)

Bill Grogan wrote:

> Is there any way to have perl try and open a url?





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

Date: Fri, 20 Mar 1998 22:06:49 -0800
From: tory1 <tory1@mail.idt.net>
Subject: Re: Net::FTP & firewalls?
Message-Id: <351358F8.F107EEEF@mail.idt.net>

I am using two large scripts to transfer files
bewtween servers over the internet through
fire walls with pgp ascii armour with no
problems with fire walls....



Jerry Talkington wrote:

> Not sure I know what you mean by "socksified", but I have
> used it to
> access files through a netware Ukaih firewall (IP masq.
> type), with no
> problems...
>
> On Mon, 16 Mar 1998 12:27:20 -0700, "Jeffrey W. Kehoe"
> <kehoe@fc.hp.com> wrote:
>
> >Does anyone know if the Net::FTP code works transparently
> with a
> >"socksified" ftp installed.  We're trying to utilize ftp
> to transfer
> >files, but we don't want to have to deal with firewalls,
> etc.   We're
> >telling our users that they need to provide a
> "socksified" ftp if they
> >want to transfer through a firewall.  Is anyone using the
> Net::FTP in
> >this manner?
> >
> >Thanks in advance,
> >Jeff





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

Date: Sat, 21 Mar 1998 01:45:12 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Opening dirs in Win32
Message-Id: <ebohlmanEq5BJC.7uG@netcom.com>

Beau Giles <giles@agentware.com> wrote:
: I've got an odd little bug that's hit me in porting a cgi script from Unix
: to Windows.  I've got a variable passed through STDIN representing a
: directory in a file system ($PWD).

: I've massaged it with the following lines:

: $PWD =~ s/%3A/:/g;
: $PWD =~ s/%5C/\\/g;

You really shouldn't be writing your own code to decode URL-encoded 
parameters, or even be thinking about "passed through STDIN."  Try using 
CGI.pm and you'll probably find that your problem vanishes.  And if you 
change servers again, or have to change the request method you're using, 
you won't have to change your script again.

If you have a truly valid reason for not using CGI.pm, at least use 
URI::Escape to do URL-decoding.



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

Date: Fri, 20 Mar 1998 22:30:10 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: Problem with "goto" in Perl
Message-Id: <35133443.E7790D7A@coos.dartmouth.edu>

dave wrote:
> 
> $loveConcerts and
>   goto ( ELVIS, FABFOUR, ELTON, MICHAEL, GARTH )
>     [ ( $yourBirthDate - 1930 ) / 10 ];
> 
> I like gotos :)

$loveConcerts and
  &{(\(&elvis, &fabfour, &elton, &michael, &garth))
    [ ( $yourBirthDate - 1930 ) / 10 ]};

I don't.  :-)

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 21 Mar 1998 02:26:21 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: qw (was: Re: Newbie question: using split() while ignoring regexps)
Message-Id: <6ev8gd$cu0$4@client2.news.psi.net>

Uri Guttman (uri@sysarch.com) wrote on MDCLXII September MCMXCIII in
<URL: news:x767l9hrcm.fsf@sysarch.com>:
++ 
++ because qw IS a quoting mechanism, not a parser!
++ it doesn't call split or any perl level regex.

Really? Care to explain why:

   perl -we 'qw /foo bar baz qux/'

gives the error message

   Use of implicit split to @_ is deprecated at -e line 1.

if qw// doesn't call split?


     qw/STRING/
             Returns a list of the words extracted out of STRING,
             using embedded whitespace as the word delimiters.
             It is exactly equivalent to

                 split(' ', q/STRING/);




Abigail
-- 
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT


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

Date: 21 Mar 1998 04:14:12 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: qw (was: Re: Newbie question: using split() while ignoring regexps)
Message-Id: <890454033.496448@thrush.omix.com>

Uri Guttman <uri@sysarch.com> wrote:
: Jan Krynicky <jkry3025@comenius.ms.mff.cuni.cz> writes:
: > Taking into account how often do you need something like this
: > and how easy is it to split values on a whitespace 
: > I wonder why qw works the way it does instead of taking quotes into
: > account.

	If you want to use quotes, use quotes.  qw() is a shortcut to not
	have to use quotes...so why would it allow them?  In fact, qw() is
	explicitly writen to spit out compile time warnings if you try to
	use quotes (single only, for some reason double quotes are not
	checked for...) inside a qw() string.

: because qw IS a quoting mechanism, not a parser!
: it doesn't call split or any perl level regex. it JUST makes a list of
: tokens that were separated by white space in the SOURCE code. 

	Check toke.c.  Correct me if I'm wrong, but it really looks to me
	like it's transforming itself at compile time directly into a
	split(' ', q/STRING/) op code. -Grep toke.c for KEY_qw.

: useful? if you wanted ('what','ever you','want'), why not just enter it?
: qw is a shortcut to save typing quote chars and commas for simple tokens.

	Agreed.

: > If we could then specify a different "input_field_separator" by some
: > $whatever,
: > the solution to his question would be :
: > 	while (<INPUT>) {
: > 		$INPUT_FIELD_SEPARATOR=',';
: > 		@row = eval "qw{$_}"; # suppose that the data do not contain a closing
: > brace

	Oh good, yet another global to trip people up...

	This is the same mentality that actually uses operator overloading in
	C++ on a regular basis...

: you just want split or some fancier parser. see CPAN::Text for others.

	Bingo.  If you want a parser, use a parser.  qw() is not a parser,
	it's just a shortcut for split()ing on whitespace.

	qw == 'Quote on Whitespace', not 'Quote on Whatever'.

: > And if perl would be so kind to provide us with
: >  qqw()  =  interpolate the variables in the script and then split by 
: >            $INPUT_FIELD_SEPARATOR taking quotes into account.
: >  we wouldn't have to do the dangerous eval(). That would be cool.

	What dangerous eval()?  What are you coding...?

	Ugh...you're looking for Text::CVS.  It's already been done, without
	needed using globals that quickly let you shot yourself in the foot.

	And without eval()...

	Oh, but you'll have to spend time typing in commas...I feel for
	you... ;-}

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: 20 Mar 1998 23:17:26 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: qw (was: Re: Newbie question: using split() while ignoring regexps)
Message-Id: <x71zvwiso9.fsf@sysarch.com>

abigail@fnx.com (Abigail) writes:

> Uri Guttman (uri@sysarch.com) wrote on MDCLXII September MCMXCIII in
> <URL: news:x767l9hrcm.fsf@sysarch.com>:
>    perl -we 'qw /foo bar baz qux/'
> 
>    Use of implicit split to @_ is deprecated at -e line 1.

> ++ 
> ++ because qw IS a quoting mechanism, not a parser!
> ++ it doesn't call split or any perl level regex.
> 
>      qw/STRING/
>              Returns a list of the words extracted out of STRING,
>              using embedded whitespace as the word delimiters.
>              It is exactly equivalent to
> 
>                  split(' ', q/STRING/);

i stand corrected.

even so, the original request to have it do more that just split on
white space was off base. the fact that qw uses split ' ', internally
doesn't mean it has full split semantics, as you cannot select the regex
to split with. it is a syntactically and semantically different from
split. it is used at compile time and not run as in split. perl probably
uses split internally for should be hidden and the error you show
shouldn't be printed. it is a legal quoted string which is not an error
or needs a warning.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----  8 Years of Perl Experience, Available Immediately
uri@sysarch.com  ---------  Resume and Perl Example at http://www.sysarch.com
Use the Best Search Engine on the Net  --------  http://www.northernlight.com


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

Date: Sat, 21 Mar 1998 01:23:34 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Stinking lousy $*(@#*$@ cmd lin args-HELP
Message-Id: <ebohlmanEq5AJA.6IJ@netcom.com>

Phil Hanna <> wrote:
: I assume that you are talking about a CGI perl script, not a perl
: script invoked from a command line.  In that case, what follows the
: "?" is passed one of two ways, depending on how you have invoked it.
: Check the environment variable REQUEST_METHOD (available to you as
: $ENV{'REQUEST_METHOD'})

[snip]

: Note that in either case you need to translate the raw input to
: separate the key/variable pairs, decode the %hh hex strings, etc.
: Check http://hoohoo.ncsa.uiuc.edu/cgi/interface.html
: for details.

The majority of CGI programmers (certainly all the novice ones) would be 
much better off if they used CGI.pm and treated parameter-passing as a 
black box.  I'm normally all for fully understanding what you're doing, 
but I see too many CGI programmers reinventing the wheel for the 
millionth time, and too many of the wheels they reinvent are out of true.



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

Date: Sat, 21 Mar 1998 02:32:01 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: sub-array length?
Message-Id: <ebohlmanEq5DpD.Bo4@netcom.com>

Sidney Tupper <sid@mda.ca> wrote:
: How can you get the length of an array that's an element of another
: array?

: For example, the naive approach doesn't work (prints 581688):

: #!/usr/local/bin/perl

: @test = (["eggs","bacon","juice"],
: 	 ["sandwiches","cheese"],
: 	 ["tofu"],
: 	 ["apple pie"]);

: $length = @test[0];		# how many elements in the first row? 

You want "@{$test[0]}" which means "take the scalar found in the first 
element of @test and dereference it to an array."  What you wrote means 
"build an array slice consisting of the first element of @test" which 
gives you an array slice containing a reference.  The slice gets 
converted to a scalar.

Reading perldsc and perllol will help with this sort of confusion.



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

Date: 20 Mar 1998 20:52:35 -0600
From: Quentin  Fennessy <quentin@jihad.amd.com>
Subject: Re: sub-array length?
Message-Id: <xim4t0s4ux8.fsf@jihad.amd.com>

>>>>> "ST" == Sidney Tupper <sid@mda.ca> writes:

    ST> How can you get the length of an array that's an element of
    ST> another array?

    ST> $length = @test[0]; # how many elements in the first row?
    ST> printf("%d\n",$length);

You must explicitly dereference it as a list, then
evaluate it as a scalar.

  DB<16> @t2 = ( [ 'eggs', 'bacon', 'juice' ] )

  DB<17> print scalar @t2
1
  DB<18> print scalar @{ @t2[0] }
3

See line DB<18> - @t2 is the list of lists, @t2[0]
is the first list in the list of lists, and the
beautiful construct @{ @t2[0] } is the first list in the
list of lists, evaluated as a list.

  $length = @{ @test[0] }; # how many elements in the first row?

Check out perlref and the Panther book.  APP.

-- 
Quentin Fennessy			AMD, Austin Texas
Secret hacker rule #11 - hackers read manuals


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

Date: Sat, 21 Mar 1998 01:14:50 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: what is wrong with being a novice ??
Message-Id: <ebohlmanEq5A4q.5yx@netcom.com>

Jason Gloudon <jgloudon@manitoba.bbn.com> wrote:
: That's the real problem, most of the FAQ question askers didn't want/know/think
: to look in the FAQ, so they aren't going to want/know/think to look anywhere 
: else, Usenet being the easiest way out.

You mean "*perceived* easiest way out."  For any reasonable definition of 
"easy," looking up a FAQ in the FAQ is easier than firing up a 
newsreader, composing a question, sending it, waiting for a response and 
reading the response.  The problem is that people seem to have a mental 
block about doing the former.  It's almost as if they found it somewhat 
intimidating.  Some psychology student could probably get a good PhD 
dissertation out of investigating why this happens.

One thing that comes to mind is that some people grew up with parents who
severely restricted the availability of matter in which they could look
things up, for fear that their kids would learn things that would corrupt
them (which is often a euphemism for the fear that their kids would learn
things the parents didn't understand, which is perceived as a threat to
the parents' superiority over the kids).  But the phenomenon is too 
widespread for that to be the only explanation.

Another possibility is that some of these people have never seen *useful* 
documentation and have therefore given up on the idea that reading 
documentation can be helpful.

Then there's the "I'm paying for my Internet account, so I deserve an 
answer" attitude, but I think only a small percentage of users are that 
far gone.

Whatever the cause is, finding it out and fixing the problem would 
accomplish a lot more than just uncluttering this group.




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

Date: Sat, 21 Mar 1998 01:24:52 GMT
From: jeff@yoak.com (Jeff Yoak)
Subject: Re: what is wrong with being a novice ??
Message-Id: <6ev58o$ot@dfw-ixnews3.ix.netcom.com>

[posted and emailed]

tim@maroney.org wrote:

>You are quite correct in your concerns. Theoretically the justification for
>flaming newbies is that repeated questions that could easily be resolved from
>the FAQ or other online documentation waste everyone's bandwidth.

I'd be very surprised if many would claim that the bandwidth is a
major concern.  The concern is the time.  The questions in question
waste very precious time.  They waste the time of novices and
intermediates who are trying to learn by creating such a load to wade
through.  More importantly these questions are abusing the time of the
intermediates and experts who generously contribute so much here.

Randal doesn't need to be asked how to sort the keys of a hash.  Chip
shouldn't have to explain how to print out a number with two decimal
places, nor should he have to explain constantly that he shouldn't
have to explain it.  This behavior would be unacceptable IMO even if
the community were completely comprised of Saintly Tom Pheonix types
that don't seem to mind too much being asked for the 8,000th time how
to "make a directory on the server."  It goes from unacceptable to
unimaginable when the experts collectively spend hundreds, probably
thousands, of hours preparing documentation, lists of frequently asked
questions for a quick fix to most problems, and make sure all of us
have easy access to this work in several formats and then ask that we
please just *look* at it before asking them.  That's all.  If we don't
get it or it isn't covered there I honestly believe *anyone* in here
will help, or at least not have a negative attitude in not helping.

>If the flamers actually wanted to change the behavior of these people, they
>would send them _private_ messages pointing them to the FAQs and other online
>resources. The fact that they post in _public_ shows that they are actually
>more concerned with engaging in braggadoccio -- "hey look, everybody, I know
>more than this loser!" This behavior is immature and obnoxious, wastes
>everyone's time, and makes all the technical groups far less usable.

It's just not true.  The "flamers," as you call them, aren't wasting
anyone's time except arguably their own at times.  I have never
learned anything from the posts of those who don't bother and don't
care, but have at least learned something about accessing the
documentation in a more efficient fashion from the flamers.  I'm being
quite serious here, not tongue in cheek.

I don't know how I would react to the current state of affairs if I
were in the position of being one of the experts in a position mostly
to give, rarely receiving more than the gratification of helping and
perhaps the occasional thank you, and I was faced with so many who
think nothing of the effort and time and the gift being given.  My
best guess is that I'd be politer than some and ruder than others, but
I would definately agree with those in that position now that the
behavior is unacceptable and I would do my complete and utmost to make
sure that the culture that is here wasn't killed.

Even if you allow that most of the problems come from first-time
posters who know little of the Internet and less of Usenet and thus
aren't aware that they are being rude, how can it be that there are
always people defending their activity as acceptable?  That's the part
I really don't get.

And even though this would, perhaps, be better said elsewhere the only
period I can find for the end of this rant is that this is why I'm
voting for the newsgroup proposed in the current RFD.  Squabling about
peculiarities of robo-moderation and propriety of requiring valid
email addresses aside, that RFD is the equivalent of those who built
the whole damn palace pointing a finger and telling us that some of us
have made a mess of the anteroom.  That's fine, they tell us, but
they're building another entrance, still public, but they're setting
up a gatekeeper to make sure you're housetrained before you enter.  I
honestly don't care what methods they feel are necessary to accomplish
that.  I just hope they succeed in creating a place worthy not only of
their presence, but that of those who are respectful and appreciative
of the effort.

Sigh.  After I finish learning Perl I promise to learn brevity.  :)

Cheers,
Jeff

-------------------------------
Jeff Yoak         jeff@yoak.com



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

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

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