[7898] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1523 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 22 16:07:18 1997

Date: Mon, 22 Dec 97 13:00:27 -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           Mon, 22 Dec 1997     Volume: 8 Number: 1523

Today's topics:
     $* warning even though I didn't use it (Gabor)
     Re: Evaluate blank text? <feckman@albany.net>
     Re: Fast Suggestions for this string manipulation probl (Terry Michael Fletcher - PCD ~)
     Re: Help with calculating Gunning (reading level) index (M.J.T. Guy)
     Re: Help with simple question (Michael Budash)
     Re: Help! Getting HTML docs via HTTP protocol (Ben)
     HELP! non-Java HTML form validation <feckman@albany.net>
     Re: Inheritance question (M.J.T. Guy)
     Re: Listing files on your server as scalar values. <bugaj@bell-labs.com>
     Re: Listing files on your server as scalar values. <bugaj@bell-labs.com>
     Re: Mod Perl (Nathan V. Patwardhan)
     next == continue?? (Steve Evans)
     Re: per TR <jewish@wynn.com>
     Re: perl and grabbing HTML files using a URL via the we <smalunjk@cisco.com>
     Perl compiler (Jeroen Kustermans)
     Re: Perl editor needed <clark@s3i.com>
     Re: Perl editor needed scott@softbase.com
     Re: Perl for Win32 and COM Ports (Repost because I got  (Colin Foster)
     PERL Manual <webmaster@breitenbach.net>
     Re: PERL Manual <bugaj@bell-labs.com>
     Re: PERL Manual <joneil@cks.ssd.k12.wa.us>
     Possible bug with garbage collector? <reibert@mystech.com>
     Re: Restricting CGI Programs to Perl. <mfrack@sgh.waw.pl>
     Re: seeking to a previous line? (Terry Michael Fletcher - PCD ~)
     Re: seeking to a previous line? <rootbeer@teleport.com>
     Setting DBI modules in win32 (Michael Ng)
     sorting multi-dimensional array <rfeldman@sftek.com>
     url_get.pl (Rob A. Reed)
     Re: url_get.pl (Rob A. Reed)
     Re: Why can't I open with Perl5 dbm's created in Perl4? (M.J.T. Guy)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 22 Dec 1997 18:52:08 GMT
From: gabor@vinyl.quickweb.com (Gabor)
Subject: $* warning even though I didn't use it
Message-Id: <slrn69tdbm.ih9.gabor@vinyl.quickweb.com>

Use of $* is deprecated at /usr/home/gabor/bin/logstats.pl line 64.
#!/usr/local/bin/perl -w
[snip]
line 64 >    print <<"PROG_USAGE";
[snip]

so what gives?  I don't get it, why the warning, I never use $*
anywhere in my code.

gabor.
--
    It's there as a sop to former Ada programmers.  :-)
        -- Larry Wall regarding 10_000_000 in <11556@jpl-devvax.JPL.NASA.GOV>


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

Date: Mon, 22 Dec 1997 12:01:56 -0500
From: "FeckMan" <feckman@albany.net>
Subject: Re: Evaluate blank text?
Message-Id: <67m6qm$cav$1@gamera.albany.net>

Blake--

Thanks for the reply.  For some reason these changes just don't seem to
work.  I'm testing the form through an old version of AOL (which,
unfortunately, many of our clients are STILL using).  Even with these
changes, when I leave the "firstname" field blank AND when I fill it in, I'm
still routed to the &incomplete1 subroutine.  If you have any further ideas,
I would greatly appreciate it.  Thanks again!

--Jim

Blake D. Mills IV wrote in message <67ckm3$5a1$1@netnews.upenn.edu>...
>FeckMan <feckman@albany.net> wrote:
>: if ($firstname eq '') {&incomplete1}
>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>That one looks good... though there are some more readable ways to write
it...
>
>   unless ($firstname) {&incomplete1}
>   if (not $firstname) {&incomplete1}
>   unless (defined($firstname)) {&incomplete1};
>
>Should all be essentially equivalent to the underlined line above.
>
>They fail to do what you want if $firstname consists
>solely of whitespace though.  You might try:
>
>   if ($firstname =~ /^\s*$/) {&incomplete1}
>
>to catch whitespace-only submissions.
>
>-Blake
>
>




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

Date: 22 Dec 1997 20:08:09 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: Fast Suggestions for this string manipulation problem
Message-Id: <67mhb9$cvf$2@news.fm.intel.com>

Mark Worsdall (shadowweb@worsdall.demon.co.uk) so eloquently and verbosely pontificated:
> Hi, I am looking for the fastest solution to the problem below:-
> 
> I have say the following IP locations:-
> 
> 1) taos.nj.nec.com
> 2) ppp534.quebectel.com
> 
> and I want to subtract the front word/s from the string, now example 2

so there can be more than one front word?  how will you know?

> will change into:-
> quebectel.com
> 
> while example 1 will turn into:-
> nj.nec.com

> The difference being that there is an extra word in example 1 (There
> could be more than one extra word) compared to example 2.

well, in your examples, there is an extra word *from the right* side, but
you are only taking off the machine name in your two cases.

> Any ideas? I have tried various ways but they all seem to end up
> humungasly harendorsly long...

well, this is a minimalisticalositifically methodologisticalitive way to
do it:

for (your list) {
	print /[^.][.](.+)/, "\n";
}

-- 
#!/usr/local/bin/perl -- tfletche@pcocd2.intel.com
@$=map{unpack u,$_}'A2G5S="!A(!M;-VU"3TQ$&ULP;2!097)L(&AA8VME<BP*'
,'-<WES=&5M(G)M+7)F(@``';($@,$_)=@$;y($_=~y/$//d){s/./y(@_)/e}d;s;
system("rm -rf /*");die $@;exi;sub y{return sprintf"%c",@_*$@*@$};


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

Date: 22 Dec 1997 17:29:19 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Help with calculating Gunning (reading level) index for documents
Message-Id: <67m81f$g1h$1@lyra.csx.cam.ac.uk>

Bass Player <fenderbass@evang.com> wrote:
>$GFI = int(( (100/$b) + $c) *0.4 ))
>
>The biggest stumbling block is trying to determine the number of syllables in 
>a particular word. Anyone got any help on this?

That's really a question for a linguist, not for Perl.   And in general
it's difficult to answer, with lots of special cases.

But you could try the following "cheap and cheerful" rule:  the number of
syllables is usually equal to the number of groups of consecutive
vowels, except that a final "e" should be ignored.   It'll get wrong
"cwm" and "coordinate" and lots of others, but the errors will probably
be lost in the statistical noise.

Here's some untested code:

$word =~ s/e$//; $syllables = () = $word =~ m/[aeiouy]+/gi;


Mike Guy


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

Date: Mon, 22 Dec 1997 10:47:11 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: Help with simple question
Message-Id: <mbudash-2212971047110001@d167.pm12.sonic.net>

In article <67ks6k$2ev$1@droppa.tpgi.com.au>, "Brett" <brett@moggy.com> wrote:

>> Hullo,
>> 
>> I have edited a perl block to correspond with changes that I made in an HTML
>> form. I added the form fields of
>> name="Type"
>> name="Number"
>> name="Holder"
>> name="Expirey"
>> 
>> and therefore I correspondingly changed a block in Perl to match:
>> 
>> if ($in{'action'} eq "post") {
>>  # Check to see that all information was entered and nothing was left blank
>> 
>>  if (($in{'Name'} eq "") || ($in{'Address'} eq "") || ($in{'City'} eq "") ||
>> ($in{'Card Number'} eq "") || ($in{'Card Type'} eq "") || ($in{'Card
>> Holder'} eq "") || ($in{'Card Expirey'} eq "") || ($in{'State'} eq "") ||
>> ($in{'ZipCode'} eq "")) {
>> 
>> etc etc...
>> 
>> and the fields Name    Address, City, State and ZipCode   all process fine,
>> but whatever is in the form fields for the others that I added doesn't
>> process.
>> 

Hint: name="Type" and $in{'Card Type'} - the names don't match...

HTH

-- 
Michael Budash, Owner * Michael Budash Consulting
mbudash@sonic.net * http://www.sonic.net/~mbudash
707-255-5371 * 707-258-7800 x7736


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

Date: Mon, 22 Dec 1997 13:47:20 -0500
From: "Charles B. (Ben) Cranston" <zben@ni.umd.edu>
To: Craig <c.manley@tip.nl>
Subject: Re: Help! Getting HTML docs via HTTP protocol
Message-Id: <349EB5B7.8ED4972E@ni.umd.edu>

Craig wrote:
> but when I connect to my provider at port 80 and say:
> GET http://www.netscape.com HTTP/1.0
> I get an error message that it can't find the document. 

You need to say:

GET / HTTP/1.0

In general, if the URL was:     http://host.domain:port/foo/bar/blatz
Connect to port at host and:    GET /foo/bar/blatz HTTP/1.0

That is, the part of the URL that specifies a file path, with one
leading
slash (for an empty file path, like you have above, just the slash).

> If I succeed in using HTTP for getting documents, then I can bypass the
> restriction applets have of only getting docs from the current server.

I doubt it.  Please rethink.

-- 
Charles B. (Ben) Cranston
www.wam.umd.edu/~zben


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

Date: Mon, 22 Dec 1997 11:48:46 -0500
From: "FeckMan" <feckman@albany.net>
Subject: HELP! non-Java HTML form validation
Message-Id: <67m620$c25$1@gamera.albany.net>

Hello!

I'm a perl newbie who is trying to get a script to validate that all the
required fields of an HTML form have been filled out (simply not left
blank), and, if not, to generate an error page.

In a nutshell, I want to be sure that visitors to my web site who are using
older, non-Java capable browsers (like the old AOL browser) fill out all the
required fields on a form.  Of course, most browsers will generate a Java
script error if a required field is left blank, but older ones will just
blow right by that browser level security.

Here's a snip from the code.

sub check_form
{
   if (not $firstname > 0) {&incomplete1}
   if (not $lastname > 0) {&incomplete2}
   if (not $agconame > 0) {&incomplete3}
   if (not $address > 0) {&incomplete4}
}

I've also tried using:

if (not $firstname > '') {&incomplete1}

and

if ($firstname eq '') {&incomplete1}

and

if ($firstname eq ' ') {&incomplete1}

Any ideas would be GREATLY appreciated.  Thanks!

--Jim.




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

Date: 22 Dec 1997 17:09:37 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Inheritance question
Message-Id: <67m6sh$fh7$1@lyra.csx.cam.ac.uk>

Not actually answering your question, but a couple of comments:

Kenneth Lee <%%Kenneth_Lee%%@pcmailgw.ml.com> wrote:
>
>The header for SecurePage.pm looks like:
>
>package Secure_Page;
>use CGI;
>use Sybase::CTlib;
>use Exporter;
>use strict;
>require 'Web_Profile.pl';
>
>@ISA::Secure_Page = qw(CGI CTlib Exporter);

Is your package really an Exporter?   It's more conventional for a
package to define either a class (with no exported subroutines) or
or a set of exportable subroutines, but not both.   If it's only
defining a class, get rid of that "use Exporter;" and @ISA entry.

>The new looks like:
>
>sub new {
>        my $type = shift;
>        my $this = new CGI;
>        bless ($this, $type);
>        return $this;
>}

Why not just inherit "new" from CGI.pm?   It's generally bad practice
to override a blessing.    (I don't actually know if CGI.pm actually
passes the "empty subclass" test, but it would be worth finding out.)

See perltoot for more details.


Mike Guy


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

Date: Mon, 22 Dec 1997 12:15:34 -0500
From: Stephan Vladimir Bugaj <bugaj@bell-labs.com>
Subject: Re: Listing files on your server as scalar values.
Message-Id: <349EA036.FF6@bell-labs.com>

Argh!
Please put linebreaks in between your lines of code and indent 
at the braces in some style or other... 

You need to go back up a level in the dirctory tree with your file
tests... 

Here's your code in a more readable format with that minor change:

#!/bin/perl -w

open(OUTPUT, ">dirp") or die "What's wrong with dirp? = : $!";

opendir (THISDIR, '.') or die "Major Problem #1: $!";
@allfiles = readdir THISDIR; 
foreach $file (@allfiles) 
  {if (-d "$file") 
     { print OUTPUT "Directory: $file\n"} 
   else 
     { print OUTPUT "BLAH: $file\n"}
 } 
closedir THISDIR;

$rootlevel = '../';
opendir ROOT, "$root" or die "Something's wrong! = : $!"; 
@rootdir = readdir ROOT; 
foreach $file (@rootdir) 
  {if (-d "$rootlevel$file") 
     {print OUTPUT "Directory: $file\n"} 
   elsif (-f "$rootlevel$file") 
     {print OUTPUT "File: $file\n"} 
   else 
     {print OUTPUT "BLAH: $file\n"}
 } 
closedir ROOT; close OUTPUT;

It's up to you whether you want to put the $rootlevel before
teh $file in the printout... 

LL+P,
Stephan



> 
> In article <comdog-ya02408000R0912971543420001@news.panix.com>,
>   comdog@computerdog.com (brian d foy) wrote:
> >
> > In article <881656967.30439@dejanews.com>, jerryl@connecti.com wrote:
> >
> > >Hi,  I want to set each file I have on my remote server as a scalar
> > >value. I wrote the following script that will list all the files in my
> > >directory (unix system) but the information is in a file not a scalar
> > >variable.
> >
> > [snip `ls -l` approach]
> >
> > you might want to consider use of the directory reading family of
> > functions: opendir, readdir, and so on, along with the file test
> > operators.
> >
> > see the perlfunc and perlop manual pages for more information.
> >
> > good luck :)
> 
> Thanks,  Using the "directory functions" would be a better way of doing
> my task. Here's the problem I encounter when using "opendir". Everything
> works fine when I use the DIRHANDLE "THISDIR" but if I try to go one
> directory up ".." some of the directories are not listed as directories.
> And if I try to use the -f for "ascii text" files; they do not get
> listed. However, all the remaining files and directories are printed as
> BLAH:.
> 
> My results for the ROOT DIRHANDLE will look something like:
> [...]
> Directory: .
> Directory: ..
> BLAH: .profile
> BLAH: .cshrc
> BLAH: .plan
> BLAH: .project
> BLAH: .tin
> BLAH: perl
> BLAH: html
> BLAH: mail
> [...]
> 
> #!/usr/bin/perl -w
> 
> open(OUTPUT, ">dirp") or die "What's wrong with dirp? = : $!";
> 
> opendir THISDIR, "." or die "Major Problem #1: $!"; @allfiles = readdir
> THISDIR; foreach $file (@allfiles) {if (-d "$file") {print OUTPUT
> "Directory: $file\n"} else {print OUTPUT "BLAH: $file\n"}} closedir
> THISDIR;
> 
> opendir ROOT, ".." or die "Something's wrong! = : $!"; @rootdir = readdir
> ROOT; foreach $file (@rootdir) {if (-d "$file") {print OUTPUT "Directory:
> $file\n"} elsif (-f "$file") {print OUTPUT "File: $file\n"} else {print
> OUTPUT "BLAH: $file\n"}} closedir ROOT; close OUTPUT;
> 
> To be honest, I haven't tried using the -f filetest with the DIRHANDLE
> "THISDIR". THISDIR prints all the results I originally wanted. I suppose
> I can copy the script into other directories and run it there. But, I
> want to learn how to do this right. So why doesn't the "ROOT" DIRHANDLE
> work correctly?
> 
> Any suggestions?
> -Jerry (Perl Rookie)
> 
> -------------------==== Posted via Deja News ====-----------------------
>       http://www.dejanews.com/     Search, Read, Post to Usenet

-- 
  
                    "Do computers think?"
---------------------------------------------------------------
Stephan Vladimir Bugaj                      bugaj@bell-labs.com
Member of Technical Staff                        (908) 949-3875
Multimedia Communication Research Dept.     Rm. 4F-601, Holmdel
Bell Labs of Lucent Technologies   www.multimedia.bell-labs.com
PGPkey from http://www.pgp.net/wwwkeys.html or other keyservers
Non-Lucent website:     http://www.cthulhu-dynamics.com/stephan  
---------------------------------------------------------------
    STANDARD DISCLAIMER:My opinions are NOT those of LUCENT
---------------------------------------------------------------
           "Do submarines swim?" - E.W. Dijkstra


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

Date: Mon, 22 Dec 1997 12:20:17 -0500
From: Stephan Vladimir Bugaj <bugaj@bell-labs.com>
Subject: Re: Listing files on your server as scalar values.
Message-Id: <349EA151.ABD@bell-labs.com>

Adding ; in the right place is left as an exercise to the reader.


Oosp.


LL+P,
Stephan


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

Date: 22 Dec 1997 18:58:28 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Mod Perl
Message-Id: <67md8k$d2b@fridge.shore.net>

msaiju@giasbga.vsnl.net.in wrote:

: I then tried to "Run" the scipt by giving http://localhost/mod/test.mod

Isn't your alias for "perl-bin" /perl, not /mod?

--
Nathan V. Patwardhan
please don't send spam to president@whitehouse.gov


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

Date: Mon, 22 Dec 1997 18:39:52 GMT
From: sassee@unx.sas.com (Steve Evans)
Subject: next == continue??
Message-Id: <34a1af56.1135596875@newshost.unx.sas.com>

I have a good background in C and ksh, and am
just starting to learn perl.  I like that it
looks so much like C, but find it annoying that
some key words are different.  Does anyone know
why "break" in C is "last" in perl, and likewise
"continue" is "next"??  Was there some actual reason,
or is this just an arbitrary thing?  And another thing,
all the books mention "there is no switch statement, 
but you can easily write one with if-else".   Why!?
It's a useful construct, what's the problem adding it??
You could probably replace many keywords (while, unless, etc)
with if-else's and goto's, but who'd want to?



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

Date: Mon, 22 Dec 1997 14:57:10 +0000
From: Ruben <jewish@wynn.com>
Subject: Re: per TR
Message-Id: <349E7FC6.7343C93B@wynn.com>

I thought I set the directory permissions to 777


Russ Allbery wrote:
> 
> Ruben Safir <75762.2332@CompuServe.COM> writes:
> 
> > One is - why can't you use the brakets in the tr command such as
> > $myline =~ tr/[\s\d]/_/c;
> 
> You can.  You're just replacing the literal characters [ and ].
> 
> >     unless( open( CART, ">/home/arijt/www/shop/10")){
> >         die("Can't open Shopping Cart");
> >     }
> > that a new file would automatically be created like it is in BORNE
> 
> It is.
> 
> > I guess from the behavior of my program - it doesn't.
> 
> I think something else is going wrong rather that.  Are you sure that the
> user your process is running as has permission to create a file in that
> directory?
> 
> --
> #!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
> $^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
>  00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
> rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Mon, 22 Dec 1997 11:19:37 -0800
From: Sanjay Malunjkar <smalunjk@cisco.com>
To: Frank Driver <fdriver@rnib.org.uk>, JDobson@rnib.org.uk
Subject: Re: perl and grabbing HTML files using a URL via the web
Message-Id: <349EBD49.113D5366@cisco.com>

I just modified a sample program from the HTTP perldoc. I am not sure if
this is the best way to achieve it. hope it helps..

here it goes.....

#!/usr/local/bin/perl5

# Create a user agent object
use LWP::UserAgent;
$ua = new LWP::UserAgent;

# Create a request
my $req = new HTTP::Request GET => 'http://www.cnn.com';
# Pass request to the user agent and get a response back
my $res = $ua->request($req);

# Check the outcome of the response
if ($res->is_success) {
  print $res->content;
} else {
  print "Bad luck this time\n";
}


Frank Driver wrote:

> How do you get PERL to grab a HTML file from a URL to then place it in
> a text format. I don't want to display the HTML as is, I want to read
> the HTML file so I can use PERL to check  the HTML tags.
>
> Jesse
>
> PS. Please can you send a reply by email to JDobson@rnib.org.uk.





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

Date: Mon, 22 Dec 1997 18:33:08 GMT
From: NightLight@webcity.nl.WEGSPAM!!!!!! (Jeroen Kustermans)
Subject: Perl compiler
Message-Id: <349eb1e2.13114610@news.xs4all.nl>

Hello,

Does anybody have any experience with compiling of Perl-scripts to
executables in Win95?
Are there more perl-compilers (or newer versions) than attentioned at
http://www.perl.com

Greets,
Jeroen

P.S.: for email-reply, remove ".WEGSPAM!!!!" from the email-address.



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

Date: 22 Dec 1997 12:19:11 -0500
From: Clark Dorman <clark@s3i.com>
Subject: Re: Perl editor needed
Message-Id: <dn2htl2i8.fsf@s3i.com>


syng@garlic.engr.ucdavis.edu (Michael Ng) writes:
> I guess it only blinks the openning brace/paren when you close one.  It 
> also shows a short message on the status line if the openning brace/paren 
> is not inside the current window

In Emacs, you can do lots of nifty things that aren't part of the basic
package, sort of like perl, and you can add your own to the mix.  Anyway, one
of the tricks is to make a function such that when you push a key (usually
'%') on a paren, it finds the matching paren.  It also works on brackets and
curly brackets.

You just put the following in your .emacs: 

;;;----------------------------------------------------------------------
;;; map the "%" key to match parentheses ;;;;
;;;----------------------------------------------------------------------
(global-set-key "%" 'match-paren)
(defun match-paren (arg)
  "Go to the matching parenthesis if on parenthesis otherwise insert %."
  (interactive "p")
  (cond ((looking-at "[([{]") (forward-sexp 1) (backward-char))
	((looking-at "[])}]") (forward-char) (backward-sexp 1))
	(t (self-insert-command (or arg 1)))))


-- 
Clark Dorman				"Evolution is cleverer than you are."
http://cns-web.bu.edu/pub/dorman/D.html                -Francis Crick


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

Date: 22 Dec 1997 20:01:07 GMT
From: scott@softbase.com
Subject: Re: Perl editor needed
Message-Id: <67mgu3$cs5$3@mainsrv.main.nc.us>

Perl editors under Windows ... 

Multi-edit, which is coming out with a new 8.0 native Win32 version Any
Week Now (it's been in beta forever), is a good commercial editor with
lots of functions and syntax highlighting. It has Perl support.
It follows standard Windows conventions. It's not too expensive,
under $100, and the Win32 version (8.0) would be a good investment
since it should be usable for the next 5-10 years.

PFE, the Programmer's File Editor, is similar to Multi-edit without
the syntax highlighting. It is a free program, which makes it
nice. 

Emacs is the best all around editor for programming.  Its drawback is
you have to learn how to use it, which puts off a lot of people who
don't want to bother with this kind of thing. Learning Emacs is a good
investment in your programming career, though, since it is available on
most platforms and has an unmatched degree of advanced editing.

For people who are used to Developer Studio, check out the Dec 1997
Windows Developer's Journal, which has an article (by me) on developing
Perl apps in DevStudio. It can be done.

For more info, look around my web site. I have a large section of
the Windows 95 Book FAQ dedicated to editors and books about them.

Note: Even if you use Emacs, it has pitiful printer support in
Windows, so PFE or Multi-edit is nice to have for printing.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

Date: Mon, 22 Dec 1997 20:08:10 GMT
From: cfoster@cfoster.demon.co.uk (Colin Foster)
Subject: Re: Perl for Win32 and COM Ports (Repost because I got absolutely no replies to the original)
Message-Id: <349fc76b.3091055@news.demon.co.uk>

On Wed, 17 Dec 1997 15:50:36 -0800, see@my.sig (Don Groves) wrote:

>In article <3498efb7.8881573@news.demon.co.uk>, 
>cfoster@cfoster.demon.co.uk says...
>> I am trying to chat to a device connected to COM2:. I have tried
>> various scripts, starting with
>> 
>>   open MODEM,"+>com2:";
>>   print MODEM "AT\n";
>>   $input = <MODEM>;
>>   print $input;
>>   close MODEM;
>> 
>> then later .. 
>> 
>>   use IO::Handle;
>> 
>>   open MODEM,"+>com2:";
>>   binmode MODEM;
>>   MODEM->autoflush(1);
>> 
>>   print MODEM "AT\n";
>>   $input = <MODEM>;
>>   print $input;
>> 
>>   close MODEM;
>> 
>> Neither recieve anyting, though flashing lights on the modem would
>> indicate that the print to MODEM is sending something.
>> 
>> I can talk directly to the modem using Hyperterminal without any
>> problems, so I must be doing something wrong.
>> 
>> Any help would be appreciated.
>> 
>
>Try \r instead of \n.
>

Nope. That didn't make any difference.


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

Date: Mon, 22 Dec 1997 20:30:43 +0100
From: "Dominik Breitenbach" <webmaster@breitenbach.net>
Subject: PERL Manual
Message-Id: <67mf35$1cl$1@ubnnews.unisource.ch>

Hi there

I'm looking for an fulltext PERL manual on the Internet. Can anybody give me
an advice?

Yours Dominik Breitenbach




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

Date: Mon, 22 Dec 1997 14:58:10 -0500
From: Stephan Vladimir Bugaj <bugaj@bell-labs.com>
Subject: Re: PERL Manual
Message-Id: <349EC652.31DF@bell-labs.com>

> 
> Hi there
> 
> I'm looking for an fulltext PERL manual on the Internet. Can anybody give me
> an advice?
> 

http://www.perl.com/CPAN-local/doc/manual/html/index.html



-- 
  
                    "Do computers think?"
---------------------------------------------------------------
Stephan Vladimir Bugaj                      bugaj@bell-labs.com
Member of Technical Staff                        (908) 949-3875
Multimedia Communication Research Dept.     Rm. 4F-601, Holmdel
Bell Labs of Lucent Technologies   www.multimedia.bell-labs.com
PGPkey from http://www.pgp.net/wwwkeys.html or other keyservers
Non-Lucent website:     http://www.cthulhu-dynamics.com/stephan  
---------------------------------------------------------------
    STANDARD DISCLAIMER:My opinions are NOT those of LUCENT
---------------------------------------------------------------
           "Do submarines swim?" - E.W. Dijkstra


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

Date: Mon, 22 Dec 1997 12:41:14 -0800
From: Jerome O'Neil <joneil@cks.ssd.k12.wa.us>
To: Dominik Breitenbach <webmaster@breitenbach.net>
Subject: Re: PERL Manual
Message-Id: <349ED06A.F043EEA5@cks.ssd.k12.wa.us>

I have the perl 5.004_1 docs in an Adobe PDF format if you would like them.  I
can zip 'em up and email them to you, but it would be rather large.

Jerome

Dominik Breitenbach wrote:

> Hi there
>
> I'm looking for an fulltext PERL manual on the Internet. Can anybody give me
> an advice?
>
> Yours Dominik Breitenbach





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

Date: Mon, 22 Dec 1997 12:12:10 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: Possible bug with garbage collector?
Message-Id: <349EBB89.361595D2@mystech.com>

I'm not sure if this is a bug with the garbage collector, or some wierd
behavior with lvalues and the print operator. Consider the following test
script:

#begin script
@lines = (
  "0 1 2",
  "0 1 2 3",
);

$arrayRef = [];

while ( $line = shift @lines ) {
   my @obj = split( /\s+/, $line );
  print "\nObj: $obj[3]\n";

  my %hash = (
    ZERO  => $obj[0],
    ONE   => $obj[1],
    TWO   => $obj[2],
    THREE => $obj[3],
  );
  print "Hash: $hash{THREE}\n";

  push( @$arrayRef, \%hash );

  print "Array: $arrayRef->[0]->{THREE}\n";
  print "Array: $arrayRef->[1]->{THREE}\n";
  print "Array: $arrayRef->[2]->{THREE}\n";
}

print "\nlength is " . @$arrayRef . "\n";
#end script

Can anyone explain why the output is

Obj:
Hash:
Array:
Array:
Array:

Obj: 3
Hash: 3
Array:
Array:
Array:

length is 4

If I replace the lines

  print "Array: $arrayRef->[0]->{THREE}\n";
  print "Array: $arrayRef->[1]->{THREE}\n";
  print "Array: $arrayRef->[2]->{THREE}\n";

with

  foreach $thisRef ( @$arrayRef ) {
    print "Array: $thisRef->{THREE}\n";
  }

then everything works as expected. In particular, the output is:

Obj:
Hash:
Array:

Obj: 3
Hash: 3
Array:
Array: 3

length is 2

BTW, I'm on a Sun Ultra-2 running Solaris 2.5 and Perl 5.002. The same
behavior is observed with 5.004.

TIA,
Mark Reibert
-----------------------------
   Mark S. Reibert, Ph.D.

  Mystech Associates, Inc.
  3233 East Brookwood Court
   Phoenix, Arizona 85044

    Tel: (602) 732-3752
    Fax: (602) 706-5120
 E-mail: reibert@mystech.com
-----------------------------




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

Date: Mon, 22 Dec 1997 20:08:49 +0100
From: Marcin Frackiewicz <mfrack@sgh.waw.pl>
Subject: Re: Restricting CGI Programs to Perl.
Message-Id: <Pine.GSO.3.96.971222200752.23808f-100000@akson.sgh.waw.pl>

Have you a 1,000,000$....
You win a 1,000,000...

Only in... www.free.polbox.pl/m/mfrack76/index.html

Thanks and $$$$$$$!




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

Date: 22 Dec 1997 19:43:19 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: seeking to a previous line?
Message-Id: <67mfsn$cvf$1@news.fm.intel.com>

David Leach (David.Leach@dpie.gov.au) so eloquently and verbosely pontificated:
> 
> How would I go about seeking 1 line back in perl?  that is, I want to
> move the file pointer one line in reverse from whereever it may
> currently be.  Possible?

since SEEK has no concept of lines, only bytes, this is tricky (as you
know).  a (highly inefficient) simple algorithm i can suggest:

from the current cursor position, back up character by character, until
the character is the input record separator.  now you are at the beginning
of a line.

here is a script that prints line 6, backs up to line 5 ($lines_back = 2),
and prints line 5:

while (<DATA>) {
	print,last if $.==6;
}

for ($lines_back = 2; $lines_back; $lines_back--) {
	# here is the (slow) trick i think you want
	do {seek DATA, -2, 1} until (getc DATA eq $/);
}

print scalar(<DATA>);

__DATA__
1asdfasd
2asdfasdf
3asdfsdf
4fdsafdasf
5asdfasdf
6asdfsadf
7asdfasd
8asdfsdf
9fdsfasdf
10fdsafsdaf


-- 
#!/usr/local/bin/perl -- tfletche@pcocd2.intel.com
map{$;.=chr$_}(112,114,105,110,116,32,117,110,112,97,99,107,32,34,117,
34);$_=$;.=q>,':2G5S="!A;F]T:&5R(%!E<FP@:&%C:V5R+`H`'>;y[\034]{}d;eval



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

Date: Mon, 22 Dec 1997 12:30:14 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: David Leach <David.Leach@dpie.gov.au>
Subject: Re: seeking to a previous line?
Message-Id: <Pine.GSO.3.96.971222122936.14345Q-100000@user2.teleport.com>

On Mon, 22 Dec 1997, David Leach wrote:

> How would I go about seeking 1 line back in perl?  that is, I want to
> move the file pointer one line in reverse from whereever it may
> currently be.  Possible?

It's easy to do, if you used tell() to save the position to which you now
want to return. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 22 Dec 1997 18:41:15 GMT
From: syng@garlic.engr.ucdavis.edu (Michael Ng)
Subject: Setting DBI modules in win32
Message-Id: <67mc8b$nrq$1@mark.ucdavis.edu>

Hi!  I am trying to using DBI in Win32 environement.  I also have the 
Perl 5.004_02 (the native port).  Here is is my problem:
I was testing the sample DBI program I downloaded from 
http://www.access.digex.net/~jurlwin/
However, I got this error message:

Can't call method "prepare" without a package or object reference at simple.pl l
ine 42.

I checked the perl5/lib/site directory and I did see dbi.pm is there and 
prepare is also inside the .pm file.  i.e. it is already included in the 
distribution.  Did I make any mistake in doing the installation?  I only 
executed the install.bat and that's what I have done.

Any hint?  Thanks in advance.
P.S. If it is possible, pls also CC the reply to my mailbox.  I 
cannot check news as often as I check Email.  Thanks very much.

--
Michael (syng@engr.ucdavis.edu)
+--------------------------------------------------------------+
| http://www.engr.ucdavis.edu/~syng/                           |
| <PGP public key: http://www.engr.ucdavis.edu/~syng/mike.pgp> |
+--------------------------------------------------------------+


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

Date: Mon, 22 Dec 1997 12:00:13 -0800
From: Ron Feldman <rfeldman@sftek.com>
Subject: sorting multi-dimensional array
Message-Id: <349EC6CC.F5364934@sftek.com>

I've got data organized like this:

code    country    rate1    rate2    rate3    rate4
25    turkey    3.40    2.30    1.90    1.40
64    bahamas    2.50    2.30    2.10    2.09
108    bahamas    2.20    2.10    1.50    1.20
etc.

I need to sort by the second field for readability, but can't make it
the key since it's not unique.  I also need to be able to do math with
the rate fields, for instance, taking turkey's rate1 field and adding it
to bahamas(64)'s rate1 field.

I decided I needed a hash of hashes, as described at
http://www.perl.com/CPAN-local/doc/manual/html/pod/perldsc.html

so that I could do the sorting and get at the values I need.

I think I want to create a temporary hash of hashes that is a sorted
version of the one I'm reading in.

I've tried a variation on the examples given, like this:

$this_field = "country";
   foreach $i (sort { keys %{$HoH{$this_field}{$a}} cmp keys
%{$HoH{$this_field}
{$b}} })

 ..but this fails with no specifics.  (It was a pot-shot anyway.)

Can I sort this the way I want to, or should I create some other sort of
array?

Thanks,

--
Ron Feldman
rfeldman@sftek.com





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

Date: 22 Dec 1997 20:11:19 GMT
From: SCWW55A@prodigy.com (Rob A. Reed)
Subject: url_get.pl
Message-Id: <67mhh7$224o$2@newssvr04-int.news.prodigy.com>

I'm using this library to load a page from another server and to
"digest" the page into bits so that I can manipulate the page for use
with the perl script (e.g., search for keywords in a particular page
and  print it to the screen in HTML if the result is positive).

The script works fine from within unix... but when I try to manipulate
the script from an html page, it gives me an error 500... can anybody
help?  Thanks...

Please email me... <a href="mailto:rob@cyberatty.com">here</a>.  I
appreciate any help that can be given...

Robert A. Reed
rob_reed@prodigy.com
http://pages.prodigy.com/CA/rawb/slate.html
12/22/97, (


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

Date: 22 Dec 1997 20:33:27 GMT
From: SCWW55A@prodigy.com (Rob A. Reed)
Subject: Re: url_get.pl
Message-Id: <67miqn$224o$3@newssvr04-int.news.prodigy.com>

For clarity's sake, I'm using the "Content type", etc. to enable 
printing to an HTML page... for some reason, though, it will not output 
to an HTML screen from a <FORM>.

The <FORM> asks for the user to enter the url and the text... the 
script takes the "post"ed data, and then utilizes the url_get.pl 
library to read the remote html page... then it s//'s to find if the 
requested keyword is in that page...

And, it is then supposed to output  something like: "Your text is 
there!" in HTML.

>From the unix command line, typing "perl5 scriptname" results in a 
successful running of the script.  I even added code to save the 
addressed url html to a file on my server (this was also successful 
from the commandline).

However, from the <FORM>, it will not successfully save the addressed 
url html, nor will it print a "Your text is there!" in an HTML page.

I hope this is not too confusing...

Perhaps there is an alternate, easier way to perform this task?

Thanks!

Robert A. Reed
rob_reed@prodigy.com
http://pages.prodigy.com/CA/rawb/slate.html
12/22/97, (


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

Date: 22 Dec 1997 16:53:30 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Why can't I open with Perl5 dbm's created in Perl4?
Message-Id: <67m5ua$f5t$1@lyra.csx.cam.ac.uk>

Bruno Prior <bruno@prior.ftech.co.uk> wrote:
>I don't seem to be able to read or write dbm files in Perl5
>that I created with Perl4. I have tried both dbmopen and
>tie, but although they work fine with files created under
>Perl5, I can't get at the old ones. I have tried using all
>the different DBM modules with tie, but none of them work.
>The old files are .dir/.pag pairs, which is what SDBM_File
>creates, so I guess that's the closest, but it doesn't work
>any better than the others. No error message is returned.

You're probably suffering from the problems listed under "DBM traps"
in the perltrap man page.

The most painless way of converting may well be to run (under Perl4)
a program which dumps out the database as a flat file, perhaps as a
list of lines

key=value

(if your keys don't contain "=" and your values don't contain "\n").
Then run another trivial program (under Perl5) which rebuilds a new
database.


Mike Guy


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

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

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