[13435] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 845 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 19 01:07:23 1999

Date: Sat, 18 Sep 1999 22:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <937717509-v9-i845@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 18 Sep 1999     Volume: 9 Number: 845

Today's topics:
    Re: An Array of Collumns <madebeer@igc.apc.org>
    Re: Checking for Modules in Perl <gellyfish@gellyfish.com>
    Re: CONTEST: Range Searching <uri@sysarch.com>
    Re: CONTEST: Range Searching <ltl@rgsun40.viasystems.com>
    Re: CONTEST: Range Searching <uri@sysarch.com>
    Re: CRAP Software <ltl@rgsun40.viasystems.com>
        freq count on log files? donturn@fis.utoronto.ca
    Re: How do I print Array of hash? <admin@gatewaysolutions.net>
        How to create files from CGI script? <davids@desertigloo.com>
    Re: How to create files from CGI script? <bwalton@rochester.rr.com>
    Re: List files in a dir (elephant)
    Re: make in Windows 98 (elephant)
    Re: make in Windows 98 <gellyfish@gellyfish.com>
        Parsing HTML Tag by Tag/ Local links to remote bigcheese@my-deja.com
    Re: Parsing HTML Tag by Tag/ Local links to remote <bwalton@rochester.rr.com>
    Re: Perl 5.005_03, BerkeleyDB 2.7.7, BerkeleyDB-0.06, a <elaine@chaos.wustl.edu>
    Re: Perl Challenge (elephant)
    Re: Perl Challenge (Sam Holden)
    Re: PL extension <gellyfish@gellyfish.com>
    Re: Programming Modules for Perl <sjohns17@uic.edu>
        Reading files on a remote server ???????? <stewart@xcs.com.au>
    Re: Reading files on a remote server ???????? (elephant)
    Re: regexp odity with (?s-x:) <bwalton@rochester.rr.com>
    Re: Using a period as a delimiter in the split() functi (Larry Rosler)
    Re: Using a period as a delimiter in the split() functi <geedawgster@hotmail.com>
        What book best supplement's "Robert's" tutorial? <danestrom@poppulse.com>
    Re: What book best supplement's "Robert's" tutorial? <danestrom.spamaway@poppulse.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 18 Sep 1999 17:41:33 -0700 (PDT)
From: Michael de Beer <madebeer@igc.apc.org>
Subject: Re: An Array of Collumns
Message-Id: <APC&1'0'50775db3'a61@igc.apc.org>

tlb wrote:
>open (dfile, "data.dat");
>while (<dbfile>) {
>   @row = split //;
>   push @testans, \@row;
>}

I think there is a problem here.  on each while loop, the values of 
@row is replaced.  The reference to it stays the same, though, so 
@testans will be an array of identical refences to the last line of data.

This would be solved If you used 'my' on each @row.
use strict would help catch problems like this.

Probably there is an better way to do it, but here is my tested program
which does the correct thing. 

#!/usr/bin/perl -w
use strict;

my $i = my $number_of_expected_answers = 5;  # for error checking
my @people;                                  # global list

while(<DATA>) {
    chomp;
    next unless /\d{$i}/;
    my (@answers) = split (//); # use my or we'll overwrite data
    warn "invalid data $_" unless @answers == $i; #sanity check
    push @people, \@answers;
}

#example of how to 'get at' data
print "the answers to question 3, for example: "; #should output 3343
print map { $people[$_][2] } ( 0 .. @people - 1 );
print "\n";
exit;
__DATA__
12345
21345
12435
12354



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

Date: 18 Sep 1999 19:08:08 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Checking for Modules in Perl
Message-Id: <7s0nuo$84$1@gellyfish.btinternet.com>

On Sat, 18 Sep 1999 14:43:43 GMT Kragen Sitaker wrote:
> In article <37E2F50C.E67DBB77@rochester.rr.com>,
> Bob Walton  <bwalton@rochester.rr.com> wrote:
>>Craig Vincent wrote:
>>> Is there a way to have Perl check to see if particular modules are installed
>>> without doing an exist check in the standard library directories?
>>
>>perl -Mmodulename
> 
> But that works by doing an exist check in the standard library directories.
> 
> From inside perl, you could also try eval { require "Bob.pm" } -- I
> think.  I could be wrong about this.
> 

If you think that you might be wrong about it you really should be more
responsible and test it ...

Of course you need to test $@ after doing the eval ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 18 Sep 1999 19:13:27 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: CONTEST: Range Searching
Message-Id: <x7hfkrak4o.fsf@home.sysarch.com>

>>>>> "RP" == Richard Proctor <Richard@waveney.demon.co.uk> writes:

  RP> Simple, does all 3 jobs before/after/span handles overlapping
  RP> ranges has a few frills (Highlighting the matched line, and line
  RP> numbering - delete if not wanted)

  RP> while (<>) {
  RP>     $_ = "$.\t$_" if $opt_N;
  RP>     if (/$pat/) {
  RP>         print "\n";
  RP>         print @Past; 
  RP>         @Past=();
  RP>         print ">>>>\t" if $opt_m;
  RP>         print;
  RP>         $ToDo = $opt_A;
  RP>     }
  RP>     elsif ($ToDo) {
  RP>         $ToDo--;
  RP>         print;
  RP>     }
  RP>     elsif ($opt_B) {
  RP>         push @Past,$_;
  RP>         shift @Past if ($#Past == $opt_B);
  RP>     }
  RP> }

this is broken in several ways. it does not handle overlaps as you claim
and it has the same bugs as other solutions with late matches and
multiple files.

on this input:

abc
def
abghi
jkl
mno
pqr
stu

and this command:

perl grep1.pl -A 2 ab grep.dat

i get this output:


abc
def

abghi
jkl
mno

which is not what tom asked for regarding overlaps. it should output

abc
def
abghi
jkl
mno

so sorry, try again. merging the overlap and non-overlap logic is not
trivial. i am close to a very elegant solution. but i will test it to
death before i publish it here.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: 19 Sep 1999 03:25:52 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: CONTEST: Range Searching
Message-Id: <7s1l40$skh$1@rguxd.viasystems.com>

In comp.lang.perl.misc Uri Guttman <uri@sysarch.com> wrote:
:>                                            ... but i will test it to
:>death before i publish it here.

Chicken.  :-)

I would be grateful if you would publish your test suite.  That
is of almost as much interest as your solution.

[[I don't post in c.l.p.moderated.  Followups set]]
-- 
// Lee.Lindley   /// Programmer shortage?  What programmer shortage?
// @bigfoot.com  ///  Only *cheap* programmers are in short supply.
////////////////////    50 cent beers are in short supply too.


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

Date: 19 Sep 1999 00:27:37 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: CONTEST: Range Searching
Message-Id: <x77llna5l2.fsf@home.sysarch.com>

>>>>> "ll" == lt lindley <ltl@rgsun40.viasystems.com> writes:

  ll> In comp.lang.perl.misc Uri Guttman <uri@sysarch.com> wrote:
  ll> :>                                            ... but i will test it to
  ll> :>death before i publish it here.

  ll> Chicken.  :-)

your father was a hamster and your mother smells of elderberries.

  ll> I would be grateful if you would publish your test suite.  That
  ll> is of almost as much interest as your solution.

no test suite. i just understnad the problem space very well and look
for all the boundary conditions that are missed by many. several of the
'solutions' to this competition fell apart just by my giving their code
a good look at how they handle boundaries. then a simple test case will
exploit the bug and expose it.

as i said, the combined version which supports overlapped ranges and
plain ranges is not simple. there are many different combination of
states to keep track of. i am working on simplifying the logic to reduce
the special cases and showcase the commonality of the two grep variations
more than their differences. this is what i gather tom wants to see and
i will deliver. too bad he has me killfiled right now.

just to illustrate my design process, i have written the scaffold of the
script with ARGV processing, a usage sub, a print sub (which will handle
various options when printing a match range, and some simple common code
in the main loop. the loop is actually a -n loop as well. but the main
logic to handle the grep ranges is only in my head. i have been
pondering it for two days and i keep solving little boundary issues and
simplifying the logic. i am almost done with it an i may code it
tomorrow and test it out. i will create a couple of data files and grep
lines in all boundary cases, lines early or late in a file, various
values of before and after line counts, and all of those with/without
overlapping ranges enabled. this is how a clean and bug free design is
done, not by coding, debugging, and recoding until it seems to work. it
has to work in my head first and then in the program. it was my early
programming on punch cards and with long batch turnaround times (2+
hours sometimes) that trained me to use my head more and debuggers less.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: 19 Sep 1999 00:57:55 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: CRAP Software
Message-Id: <7s1cej$qj6$1@rguxd.viasystems.com>

Kenny Gardner <Kenny@gapdev.com> wrote:
[snip]
:>Now, why is CRAP software allowed to show up on the Perl Site if CRAP
:>software is not to be used?

Just because some people who post here turn their noses up at
something, that doesn't mean it can't be used.  That CRAP has
served lots of clueless people well over the years.  It works
(after a fashion). The fact that it is inefficient, inelegant,
incomplete and opens them up to security violations is beside
the point.  Without that CRAP, they may have never gotten off
the ground with their web dreams.

:>I find it ironic that the same people or organizations who label
:>software as CRAP provide links to said barnyard dung.

What makes you think it is the same people?  It's true that many
people around here share some common traits (arrogance, pedantry,
occasional brilliance, even helpfulness for people who show they are
really trying, newbie roasting as a sport, a slightly irrational
loathing of George Reese, yes and even revulsion at seeing poorly
written Perl like that labeled as CRAP), but that doesn't mean these
people are all related.  Hell, I'm not even sure most of them (us?)
like each other much.

I think you made a false accusation here.  The CRAP proposal was not
made by the people who run www.perl.com.  I declare shenanigans
on you Kenny.  Prepare for flameage.

:>And Yes, I'll be using the Perl Module for this purpose but the double
:>standard that was discovered is unbearable.

Double entendres are encouraged.  Double standards are a figment of
your imagination.  There is no standard.  This is usenet.  Long live
anarchy. And welcome to the frey.

Good luck with your Perl project.

-- 
// Lee.Lindley   /// Programmer shortage?  What programmer shortage?
// @bigfoot.com  ///  Only *cheap* programmers are in short supply.
////////////////////    50 cent beers are in short supply too.


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

Date: Sun, 19 Sep 1999 02:18:55 GMT
From: donturn@fis.utoronto.ca
Subject: freq count on log files?
Message-Id: <7s1h68$tv1$1@nnrp1.deja.com>

Hi, I'm trying to write a quickie server log analyzer to just count the
frequencies of IP addresses in the log file. I'd like to write to a file
that lists the Ip address and then the total for each IP.

Anyone know of something to help do this?

Thanks,


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Sat, 18 Sep 1999 22:41:34 -0500
From: "Scott Beck" <admin@gatewaysolutions.net>
Subject: Re: How do I print Array of hash?
Message-Id: <ru8mmgbklg773@corp.supernews.com>

What you had there was not an array of hashes. It was a reference to
anonymous arrays with hash anonymous references mixed in.
Here is an example and how to print it.


$ref = [
            'Here', 'is', 'another', 'example',
              [
                'of', 'what', 'you',
                    {had => 'Hope', this => 'helps.'},
                'Looks', 'kinda'
              ],
            'silly', 'though!'
          ];

# Access the value of had

print $ref->[4][3]{had};

#Print the whole thing.
#Only did checks for references 2 deep but
#you could go deeper if you wanted.
for $i(0..$#{$ref}){
 if (ref $ref->[$i] eq "HASH"){
  foreach my $hash(keys %{$ref->[$i]}){
   if (ref $hash{$ref->[$i]} eq "HASH"){
    foreach my $h(keys %{$hash{$ref->[$i]}}){
     print "$h is ${$hash{$ref->[$i]}}{$h}\n";
    }
   }
   elsif (ref $hash{$ref->[$i]} eq "ARRAY"){
    for my $a(0..$#{$hash{$ref->[$i]}}){
     print "${$hash{$ref->[$i]}}[$a]\n";
    }
   }else{
    print "$hash is $hash{$ref->[$i]}\n";
   }
  }
 }elsif (ref $ref->[$i] eq "ARRAY"){
  for $array(0..$#{$ref->[$i]}){
   if (ref $ref->[$i][$array] eq "HASH"){
    foreach my $h(keys %{$ref->[$i][$array]}){
     print "$h is ${$ref->[$i][$array]}{$h}\n";
    }
   }
   elsif (ref $ref->[$i][$array] eq "ARRAY"){
    for my $a(0..$#{$ref->[$i][$array]}){
     print "${$ref->[$i][$array]}[$a]\n";
    }
   }else{
    print "${$ref->[$i]}[$array]\n";
   }
  }
 }else{
  print "$ref->[$i]\n";
 }
}

Hope this helps.



--
Scott Beck

nation <martyr160@yahoo.com> wrote in message
news:37e2d714.10703517@news.pdq.net...
> I'm new to Perl and am completely confused on how to print the records
> in this type of variable.  I need to print the records in a
> subroutine.  Any help would be very appreciated
>
> my $testvar = ['Some', 'data', 'is', 'here',
>             ['an', 'array', 'of', {hash => 'yes', array => 'no'}, 0,
> 1],
>             {how => 'do', I => ()}, [{}]];
>
>
> sub itemCount
> {
> foreach(@_)
> {
> if (ref $_ eq "ARRAY" || ref $_ eq "HASH")
> {
>
> for $i (0 .. $#_)
> {
> # Not sure what to do from here.
> #  $_ turns out to be equal to
> #  -1 so I never can get farther
> # than this.  Not sure what I need
> # to do in here either
> }
> }
> else
> {
> print "\n$_.\n";
> }
> }
> }
>



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

Date: Sat, 18 Sep 1999 20:24:45 -0700
From: "David P. Schwartz" <davids@desertigloo.com>
Subject: How to create files from CGI script?
Message-Id: <37E4577D.36AC0B72@desertigloo.com>

Hi.  I'm fairly new to Perl, having lots of experience in Unix, C/C++, and most
recently Delphi.

I've got a couple of pages I created to collect some weekly statistics data from
people in a class that's nearly 6 months long.  Right now, I'm only working with one
class, but I hope to take it to more of the same classes later on.

When people enter their stats, they get sent to a couple of email addresses.  I also
append the same data to a summary log on the server.  At a minimum, we're looking at
~200 entries (lines) per person, with 20-50 people per class, meaning we've got
4k-10k lines in this log per class.

What I'd like to be able to do is use this like a little database, giving an option
to users to display their current status by quering their records and outputting a
nicely formatted table to their browser.

It seems that running a grep-like function to pull out participant data for one
class might work alright, but when we've got 25 classes all storing data on the same
unindexed log file, it will start to run rather slowly!  This is especially
problematic because people will tend to be using it only on Thursday evenings, when
stats are supposed to be reported.

I see that I can use something like DBM (?) to add persistence to a hash, but I
believe that hashes are inherintly unordered, which means I can't even rely on the
storage ordering (in time-entry sequence) when the data is retrieved.  It doesn't
seem to provide much of an advantage.

I thought about creating a separate log file for each participant, or even each
class, but I don't want to have to pre-define the darned things at the beginning of
a new "school year", so to speak.  So, I have been trying to get the Perl script to
create the needed files if they're not found.  Unfortunately, any attempt to CREATE
a new file raises an "insufficient  permissions" error and fails.

Here is my question: How is it possible to create files from within a Perl script
that's being executed from a web page?

The script is beneath the cgi-bin directory, which has 744 permissions.  My umask
setting is 022.  I've tried turning on the UID bit (chmod +s ...) on the perl
script, but it has no effect.

How the heck can this be done???

Thanks!
-David Schwartz

ps: I'm also open to alternative suggestions :-)



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

Date: Sun, 19 Sep 1999 00:45:06 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: How to create files from CGI script?
Message-Id: <37E46A52.BDF91740@rochester.rr.com>

"David P. Schwartz" wrote:
> 
 ...
> a new "school year", so to speak.  So, I have been trying to get the Perl script to
> create the needed files if they're not found.  Unfortunately, any attempt to CREATE
> a new file raises an "insufficient  permissions" error and fails.

David, most likely, your web server doesn't have write permission in 
the *directory* in which you are attempting to create your file.  
Give that directory world write permission, and it should work fine.  
Recognize the security risk involved if that directory is your cgi-bin
directory.  You should probably make a directory for your data off 
by its lonesome somewhere, containing just your data.

> 
> Here is my question: How is it possible to create files from within a Perl script
> that's being executed from a web page?
> 
> The script is beneath the cgi-bin directory, which has 744 permissions.  My umask
> setting is 022.  I've tried turning on the UID bit (chmod +s ...) on the perl
> script, but it has no effect.
> 
> How the heck can this be done???
> 
> Thanks!
> -David Schwartz
> 
> ps: I'm also open to alternative suggestions :-)
-- 
Bob Walton


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

Date: Sun, 19 Sep 1999 12:41:11 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: List files in a dir
Message-Id: <MPG.124edc2fb9365b7f989cd8@news-server>

Abigail writes ..
>lt lindley (ltl@rgsun40.viasystems.com) wrote on MMCCIX September
>MCMXCIII in <URL:news:7rv4tt$9o5$1@rguxd.viasystems.com>:
>() If this is truly a common idiom, please point me to additional
>() reading material.
>
>Is there a requirement that everything has to be "common idiom"?

the day that Abigail begins posting "common idiom" is the day that I 
download Python

-- 
 jason - elephant@squirrelgroup.com -


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

Date: Sun, 19 Sep 1999 12:47:31 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: make in Windows 98
Message-Id: <MPG.124eddaefba34f72989cd9@news-server>

Kragen Sitaker writes ..
>In article <MPG.124de6894c25a19d989cd1@news-server>,
>elephant <elephant@squirrelgroup.com> wrote:
>>NB: some modules also require a compiler .. unfortunately for you - you 
>>can't get those for free on Microsoft OSs
>
>Actually, you can get gcc for Win32.  I don't know how well it works
>with ActiveWare Perl.

ooh yes .. you're right .. I had edited my response at the last minute 
NOT to include specific references to BC++ and MSVC++ which was what 
that "can't get for free" comment was about

-- 
 jason - elephant@squirrelgroup.com -


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

Date: 18 Sep 1999 19:19:41 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: make in Windows 98
Message-Id: <7s0okd$87$1@gellyfish.btinternet.com>

On Sat, 18 Sep 1999 14:49:24 GMT Kragen Sitaker wrote:
> In article <MPG.124de6894c25a19d989cd1@news-server>,
> elephant <elephant@squirrelgroup.com> wrote:
>>NB: some modules also require a compiler .. unfortunately for you - you 
>>can't get those for free on Microsoft OSs
> 
> Actually, you can get gcc for Win32.  I don't know how well it works
> with ActiveWare Perl.

Unfortunately you cant use  any other compiler to compile extensions on
this platform  - the Activestate Perl is compiled with a Microsoft complier.

Of course one could build ones own using cygwin32 or mingwin or whatever.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sun, 19 Sep 1999 03:12:56 GMT
From: bigcheese@my-deja.com
Subject: Parsing HTML Tag by Tag/ Local links to remote
Message-Id: <7s1kbk$vr1$1@nnrp1.deja.com>

I'm working on a script that goes through HTML documents and changes
the encoding format.

The program structure is basically like this:
# $string is the stuff from the file

while ($i<length($string)) {
 if (substr($string, $i, 2) eq $something_or_other_im_looking_for) {
  $newstring .= $something_to_replace_it_with;
  $i += length($something_or_other_im_looking_for);
 } elsif (something else) {
  add something else to $newstring
  etc, etc, etc
 }
}

The problem I have is that right now, to tell if I'm running into an
HTML tag, I do something like
if (lc(substr($string, $i,3)) eq '<a ') {
 $newstring .= substr($string, $i, index($args{'STRING'}, '>', $i)+1);
 $i=index($args{'STRING'}, '>', $i)+1;
}
which is bad, I know, and it's even worse than using regular
expressions.

So, I'm looking for a reliable way to find out if the the next block of
text after $i is the start of an HTML tag, where the end of the tag is,
and for some tags, what properties it has (I need to modify some tags).

What I may be looking for (I might be wrong) is what the program
htmlsub from the Perl Cookbook (p 731) does. It finds-and-replaces text
that isn't in HTML, and uses HTML::Filter and HTML::Entities. The
source follows:

#!/usr/bin/perl
# htmlsub

sub usage { die "Usage: $0 <from> <to> <file>...\n" }
my $from = shift or usage;
my $to = shift or usage;
usage unless @ARGV;

package MyFilter;
require HTML::Filter;
@ISA = qw(HTML::Filter);
use HTML::Entities qw(decode_entities encode_entities);

sub text {
 my $self = shift;
 my $text = decode_entities($_[0]);
 $text =~ s/\Q$from/$to/go; #important line
 $self->SUPER::text(encode_entities($text));
}

package main;
foreach (@ARGV) {
 MyFilter->new->parse_file($_);
}
# End

I just don't know how to use it in my script ( I don't know how it does
what it does). I also don't know anything about packages. I'll admit
it. They scare me.

And also, I would like a way to change local links and image locations
to remote ("/cat.gif" = "http://www.something.com/cat.gif") (I will
know the URL of the website to change the links to). I got it to work
makeshiftly (like how I "solved" the previous problem), but it isn't
very reliable and fails on pretty much anything. I also need to put
something like "http://www.something.com/process.pl?" in front of the
url, if the URL starts with "http://" and ends
with ".pl, .html, .htm, .cgi,.asp, etc" ( is an html document), and run
the URL through a function that converts all the &'s to %26's and so
on, so I need to be able to work with the URL and not have it just run
through a function that changes everything to remote.

Hope you can help!

Thanks!
- Dan


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Sun, 19 Sep 1999 00:56:23 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Parsing HTML Tag by Tag/ Local links to remote
Message-Id: <37E46CF7.F6F1C50D@rochester.rr.com>

bigcheese@my-deja.com wrote:
> 
> I'm working on a script that goes through HTML documents and changes
> the encoding format.
 ...
> what it does). I also don't know anything about packages. I'll admit
> it. They scare me.
>

Dan, packages are your friends.  Trust me.  They let you do 
incredibly complicated stuff (like properly parse HTML) without 
having to reinvent code that many people have already spent many 
many hours perfecting.  Regarding documentation, try:

perldoc Module::Name

as in, for example:

perldoc HTML::Parser

 ... 
> - Dan
 ...
-- 
Bob Walton


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

Date: Sat, 18 Sep 1999 21:57:10 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: Perl 5.005_03, BerkeleyDB 2.7.7, BerkeleyDB-0.06, and Solaris7
Message-Id: <37E44288.3B58BDEB@chaos.wustl.edu>

[ courtesy cc to original author ]
Trevor Williams wrote:
> Hi,
> 
>     Has anyone successfully installed the above combination and gotten
> it to work?

I have all of the above and got the same output from your code. I did
notice that BerkeleyDB.pm failed all of the t/unknown tests. I ran a
truss of the program too and didn't notice anything terribly odd so it
is possible that something is not quite right  somewhere in there. What
version of gcc and patchlevel? 

http://testers.cpan.org/search?request=dist&dist=BerkeleyDB shows all of
the platforms currently tested for this module.

e.


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

Date: Sun, 19 Sep 1999 12:56:11 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Perl Challenge
Message-Id: <MPG.124edfba15141cbc989cda@news-server>

Jason Reed writes ..
>elephant@squirrelgroup.com (elephant) writes:
>
>> makau@multimania.com writes ..
>> >I challenge you to tell me what this piece of cde does :-)
>> >
>> >$text=~s/('|")/${{"'"=>"\\'",'"'=>'\\"'}}{$1}/eg;
>> 
>> btw - the following does the same thing - only three times quicker
>> 
>>   $text =~ s/['"]/\\$&/g;
>
>And, as an extra bonus feature, possibly slows down the rest of your
>program. Yay $&!

so alarmist !

it actually only slows down other regexes that don't use $& or substring 
capturing

-- 
 jason - elephant@squirrelgroup.com -


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

Date: 19 Sep 1999 04:56:14 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Perl Challenge
Message-Id: <slrn7u8r7e.at3.sholden@pgrad.cs.usyd.edu.au>

On Sat, 18 Sep 1999 11:38:40 GMT, makau@multimania.com wrote:
>I challenge you to tell me what this piece of cde does :-)
>
>$text=~s/('|")/${{"'"=>"\\'",'"'=>'\\"'}}{$1}/eg;
>
>I doubt you'll find out easily :)

*plonk*

You call that a challenge...???


-- 
Sam

The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka!" (I found it!) but "That's funny ..."
	--Isaac Asimov 


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

Date: 18 Sep 1999 18:48:40 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: PL extension
Message-Id: <7s0mq8$63$1@gellyfish.btinternet.com>

On Sat, 18 Sep 1999 01:20:17 -0400 Michel Jacob wrote:
> Hi!
> 
> I know almost nothing on CGI and Perl programming.  I want to use a
> little CGI program that is freely distribute on the WEB to put a
> password access restriction on my WEB site.  In that program, there is
> CGI and PL extension files.  The host server of my site can read CGI
> extension but not PL extension.  Is someone know if in this situation,
> the CGI program will not work, or if the PL file doesn't have to be read
> by a host server? 

Fine then just rename any file with a .pl extension to have a .cgi one -
I would say that this is a question for whoever provides your hosting.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 18 Sep 1999 19:16:01 -0500
From: Seth David Johnson <sjohns17@uic.edu>
To: Frederik bernard <bernard@muenster.de>
Subject: Re: Programming Modules for Perl
Message-Id: <Pine.A41.4.10.9909181910300.1145860-100000@tigger.cc.uic.edu>

On Sun, 19 Sep 1999, Frederik bernard wrote:

> does anybody know a good book or
> a good script in the net which gives
> me some good information
> about programming modules for
> perl?

Two books:

Advanced Perl Programming, Sriram Srinivasan
Effective Perl Programming, Josheph Hall/Randal Schwartz

Both contain info on module programming. Also, take the time to read
the perlmod and perlobj/perltoot (info on Perl's object model) pods.

If you're looking to integrate C code into your module, also look at the
perlxs and perlguts pods.

-Seth



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

Date: Mon, 13 Sep 1999 19:54:37 +1000
From: "Stewart Pitt" <stewart@xcs.com.au>
Subject: Reading files on a remote server ????????
Message-Id: <7riipu$hl5$1@news.eisa.net.au>

 Does any one know if using perl whether or not I can execute a script on
one
 server and open a file to read or write on another server connected only by
the internet?????

Stewart Pitt
X-IT Computer Services P/L
stewart@xcs.com.au



>




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

Date: Sun, 19 Sep 1999 12:38:41 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Reading files on a remote server ????????
Message-Id: <MPG.124edb983ac8e5ac989cd7@news-server>

Stewart Pitt writes ..

> Does any one know if using perl whether or not I can execute a script
>on one server and open a file to read or write on another server
>connected only by the internet?????

yes .. there are hundreds of ways to do this .. start reading with 
perlipc

  perldoc perlipc

-- 
 jason - elephant@squirrelgroup.com -


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

Date: Sat, 18 Sep 1999 23:47:41 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: regexp odity with (?s-x:)
Message-Id: <37E45CDD.72548CDB@rochester.rr.com>



Rick Delaney wrote:
> 
> [posted & mailed]
> 
> Bob Walton wrote:
> >
> > Thanks for the clarification.  I guess I just assumed the paren set
> > in which the "-x" was defined didn't count as an "enclosing" paren set.
> 
> Well, it does.
> 
> > It isn't clear to me from perlre that this isn't actually the case,
> > given the examples with (?i), in which the effect of the (?i)
> > clearly proceeds until the end of the paren group surrounding the (?i).
> 
> Yes, but if you look at both (?imsx-imsx) and (?:imsx-imsx:pattern)
> together you can see that the modifiers in (?:imsx-imsx:pattern) must be
> local to the (?:) group.  Lee has already quoted the relevant sections:
> 

Ah yes, I see what you mean now -- (?imsx-imsx) is different than
(?imsx-imsx:pat) in the way the localization of the effect of the
switches is interpreted, which I didn't catch first time through.  
Sorry for the confusion.

 ...
> --
> Rick Delaney
> rick.delaney@home.com


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

Date: Sat, 18 Sep 1999 17:14:47 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Using a period as a delimiter in the split() function
Message-Id: <MPG.124dcaca27f5b21d989fa4@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <37e41d27@cs.colorado.edu> on 18 Sep 1999 17:15:51 -0700, Tom 
Christiansen <tchrist@mox.perl.com> says...
> In comp.lang.perl.misc, 
>     lr@hpl.hp.com (Larry Rosler) writes:
> :I conjecture that split() originally took a string as the separator, and 
> :then when split() was later enhanced to take a regex as the separator 
> :the string arguments were grandfathered for backwards compatibility in 
> :existing code.  
> 
> I find that unlikely, since awk's split() has always supported a 
> regex at that point.  Certainly perl1 already had it.

Yes, you are surely right.  The pattern came first.  So let's see how 
the string sneaked in, from your quotes.
 
> % man perl1
> [...]
>  1 split(/PATTERN/,EXPR)
>  2 split(/PATTERN/)
>  3 split   
 ...
> That's all it had.  Now compare with:

Not a word about strings.

> % man 3pl split
>  1  split /PATTERN/,EXPR,LIMIT
>  2  split /PATTERN/,EXPR
>  3  split /PATTERN/
>  4  split
 ...
> 69      As a special case, specifying a PATTERN of space (`' '') will
> 70      split on white space just as `split' with no arguments does.
> 71      Thus, `split(' ')' can be used to emulate awk's default behavior,
> 72      whereas `split(/ /)' will give you as many null initial fields
> 73      as there are leading spaces. A `split' on `/\s+/' is like a
> 74      `split(' ')' except that any leading whitespace produces a null
> 75      first field. A `split' with no arguments really does a `split('
> 76      ', $_)' internally.

So here is the only string mentioned, the magic " ".

Not one example of any other string being a valid argument.  So where 
did it suddenly materialize from in people's minds?  All I can think of 
is a false analogy to join 'string' => ...

Certainly the use of any other string than " " (as a literal, however 
quoted) should be warned against, and ultimately rejected.  In other 
words, it should be deprecated.

 ...

> Lots more to read.  Maybe it's time to resurrect the perl1 manpage. :-(

That wouldn't help here.

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


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

Date: Sun, 19 Sep 1999 03:56:09 +0100
From: "Gareth" <geedawgster@hotmail.com>
Subject: Re: Using a period as a delimiter in the split() function
Message-Id: <7s1jfj$70g$1@plutonium.btinternet.com>

Thanks for all the help on this one guys, much appreciated!

Gareth




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

Date: Sat, 18 Sep 1999 17:54:24 -0700
From: Dane Strom <danestrom@poppulse.com>
Subject: What book best supplement's "Robert's" tutorial?
Message-Id: <37E43440.CC7FB9E6@poppulse.com>


I'm just getting started (sorry for the bother) with Perl, using
"Robert's Perl Tutorial" (that's the not Win32-centric one -
http://www.netcat.co.uk/rob/perl/win32perltut.html).  I'm wondering if I
should splurge and go for the _Learning Perl_ book.  Is the online
tutorial sufficient enough so I just need _Programming Perl_ or any
other additional book--what book best supplement's the online tutorial?

Also, _Learning Perl_ is independent of having an internet connection
and telnet access, etc., correct? (Besides downloading the perl
interpreter.)  Otherwise, it would be CGI... I know, an annoying newbie
question.  I just have no access to that and want to do plain Perl. 
Thanks for your time.

Cheers,
Dane

-- 
danestrom@poppulse.com
http://www.popppulse.com


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

Date: Sat, 18 Sep 1999 18:26:58 -0700
From: Dane Strom <danestrom.spamaway@poppulse.com>
Subject: Re: What book best supplement's "Robert's" tutorial?
Message-Id: <37E43BE2.7F9C819@poppulse.com>


Thanks to Lee Lindley for pointing this out to me (via e-mail).

I've had a very basic background in programming.  I've done some
BASIC...Java, and plenty and plenty of HTML.  Hope that helps.

Cheers,
Dane 

Dane Strom wrote:
> 
> I'm just getting started (sorry for the bother) with Perl, using
> "Robert's Perl Tutorial" (that's the not Win32-centric one -
> http://www.netcat.co.uk/rob/perl/win32perltut.html).  I'm wondering if I
> should splurge and go for the _Learning Perl_ book.  Is the online
> tutorial sufficient enough so I just need _Programming Perl_ or any
> other additional book--what book best supplement's the online tutorial?
> 
> Also, _Learning Perl_ is independent of having an internet connection
> and telnet access, etc., correct? (Besides downloading the perl
> interpreter.)  Otherwise, it would be CGI... I know, an annoying newbie
> question.  I just have no access to that and want to do plain Perl.
> Thanks for your time.
> 
> Cheers,
> Dane
> 
> --
> danestrom@poppulse.com
> http://www.popppulse.com


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 845
*************************************


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