[8354] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1971 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 25 12:07:29 1998

Date: Wed, 25 Feb 98 09:00:26 -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           Wed, 25 Feb 1998     Volume: 8 Number: 1971

Today's topics:
    Re: CGI.pm a part of Perl (was Re: Cookies) <jdporter@min.net>
        Cookie with Perl <koala1998@hotmail.com>
    Re: dbm files <jdporter@min.net>
        Easy way to "clean" an array <Ruedi.Schwitter@schweiz.org>
    Re: Easy way to "clean" an array <ajohnson@gpu.srv.ualberta.ca>
    Re: Easy way to "clean" an array <cdkaiser@delete.these.four.words.concentric.net>
    Re: Errata in "Perl 5 How-To" (2nd ed) from Waite Group <jdporter@min.net>
    Re: FAQless Forays (was: Code Example Needed) <jdporter@min.net>
    Re: Fill a hash ? (short post) <jdporter@min.net>
    Re: hash data access <jdporter@min.net>
        Help with wSendmail in Perl <dvermes@emerald.tufts.edu>
    Re: Help! How can i show image from HTML files that is  (John Moreno)
    Re: How do I create my own perl libraries? <cdkaiser@delete.these.four.words.concentric.net>
        How to call XSUB recursively <craig@mathworks.com>
    Re: HP-UX compile failure <andrewm@sdl.ug.eds.com>
        Installing ExtUtils Problems (John "Chris" Wren)
    Re: Multiple Sort on Array of Arrays? <friedman@uci.edu>
        OMIGAWD (tm) - The Perl Journal! (Steve Linberg)
        Outputting background color (Qunice)
    Re: Outputting background color (Mike Stok)
    Re: Pattern Match (Hunter Johnson)
    Re: Pattern Matching for parsing tags <friedman@uci.edu>
    Re: Q: obscuring Perl scripts? <cdkaiser@delete.these.four.words.concentric.net>
    Re: Safely running one-liners (Malcolm Beattie)
        Stripping linefeeds <norman.bunn@mci.com>
    Re: The Ineffable Tom C. (Richard Bellavance)
    Re: The Ineffable Tom C. (Nathan V. Patwardhan)
    Re: The Ineffable Tom C. (Billy Chambless)
    Re: Using .exe programs within Perl? <barnett@houston.Geco-Prakla.slb.com>
        Using FileHandle objects recursively (Joseph Bell)
        Why install perl? <defaultuser@domain.com>
    Re: why no Case statment? (John Moreno)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 25 Feb 1998 10:38:28 -0500
From: John Porter <jdporter@min.net>
Subject: Re: CGI.pm a part of Perl (was Re: Cookies)
Message-Id: <34F43AF4.632D@min.net>

$.02:
   perl is the language and the interpreter for that language;
   Perl is the distribution and the culture.
Ergo, some modules are 100% perl, some are partly C.
Some modules are part of Perl, some aren't.  

John Porter


Martien Verbruggen wrote:
> 
> In article <34f445ad.7607057@news.tornado.be>,
>         bart.mediamind@tornado.be (Bart Lateur) writes:
> 
> > CGI.pm is part of the distribution. But it's a module. Modules are NOT
> > part of Perl. They are merely additions, written in plain Perl (= plain
> > text).
> 
> Semantics. If you want to be that precise, you will also have to add
> things like: modules can also partly be written in C.
> 
> You should be even more precise, and talk about them being part of
> perl, not Perl.


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

Date: Wed, 25 Feb 1998 23:26:11 +0800
From: "Martin" <koala1998@hotmail.com>
Subject: Cookie with Perl
Message-Id: <6d1d6l$2j28@lyra.hkstar.com>

Hiall,

I have written a perl script to expire a cookie.  But when i pressed the
back button on the browser, the cookie is set back to its origianl value.
Anyone experienced that?  Can somebody help?

Martin




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

Date: Wed, 25 Feb 1998 10:42:58 -0500
From: John Porter <jdporter@min.net>
Subject: Re: dbm files
Message-Id: <34F43C02.560A@min.net>

Indu Bingham wrote:
> 
> How do I delete a record from the dbm file??

delete should work.  E.g.,

    tie( %h, ... );

    delete $h{ $key };

hth,
John Porter


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

Date: Wed, 25 Feb 1998 16:06:19 +0100
From: Schwitter Ruedi <Ruedi.Schwitter@schweiz.org>
Subject: Easy way to "clean" an array
Message-Id: <34F4336B.141C@schweiz.org>

Hi

I have a sorted array with duplicated entrys, like

006621
006621
006622
006623
006623
006623
006624  usf.

Witch is the easiest way to check out the duplicated entrys ?

-- 
Regards Ruedi

----------------------------------------------------------------
Ruedi.Schwitter@schweiz.org     	Tel: +41 56 205 59 40
Haselstrasse				Fax: +41 56 205 21 21 
CH-5400 Baden
---------------------------------------------------------------


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

Date: Wed, 25 Feb 1998 09:25:59 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Easy way to "clean" an array
Message-Id: <34F43807.7C35B38E@gpu.srv.ualberta.ca>

Schwitter Ruedi wrote:
> 
> Hi
> 
> I have a sorted array with duplicated entrys, like
> 
> 006621
> 006621
> 006622
> 006623
> 006623
> 006623
> 006624  usf.
> 
> Witch is the easiest way to check out the duplicated entrys ?

the easiest way would be to look in the FAQ,
see perlfaq4:
    "How can I extract just the unique elements of an array?"

regards
andrew

--
#!/usr/bin/perl -w
$_="faufakfacfadfas"; # some arbitrary string.
$not=q=q+q-q-+=;      # q plus q minus q-+= equals one q right?
s$d|u|c|k|s\$$\$not$geese; # seems fowl.
s+.ay?.\++print uc $&+e;   #<ducking>...(sic)


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

Date: 25 Feb 1998 15:49:58 GMT
From: Cameron Kaiser <cdkaiser@delete.these.four.words.concentric.net>
Subject: Re: Easy way to "clean" an array
Message-Id: <6d1ej6$mhh@examiner.concentric.net>

Schwitter Ruedi <Ruedi.Schwitter@schweiz.org> writes:

>006621
>006621
>006622
>006623
>006623
>006623
>006624  usf.

>Witch is the easiest way to check out the duplicated entrys ?

This is a very common algorithm. There are shorter ways, but this is clearest:

	undef %bletch;
	foreach (@array) { $bletch{$_}++; }
	@array = sort keys %bletch;

--
Cameron Kaiser
cdkaiser at concentric dot net (it hasn't helped the spam yet though)
*** visit the Spectre Server at www.sserv.com
*** C64 software lives! www.computerworkshops.home.ml.org


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

Date: Wed, 25 Feb 1998 10:47:20 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Errata in "Perl 5 How-To" (2nd ed) from Waite Group Press
Message-Id: <34F43D08.2C2C@min.net>

Jeff Yoak wrote:
> 
> There is an errata page linked to the website and it can be directly
> accessed at ftp://ftp.waite.com/pub/waite/Perl_5_Interactive_Course/ .

Of course, that should be
    ftp://ftp.waite.com/pub/waite/Perl_5_How-To/

John Porter


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

Date: Wed, 25 Feb 1998 11:20:05 -0500
From: John Porter <jdporter@min.net>
Subject: Re: FAQless Forays (was: Code Example Needed)
Message-Id: <34F444B5.1008@min.net>

Craig Berry wrote:
> 
> OK, folks, that was my last fit of
> resistance.  In my former programming
> life, I approached learning languages
> by building up rules and patterns
> which I could apply in new situations. 
> I see the futility of that now.
> I have been assimilated.  I am Perl.(b)org.

Not at all.  WE are not borg; THEY are borg.
WE are the resistance, the underground, the
rebels, the guerillas, the patriots.  THEY
(the j*** junkies) are the Nazis, the
Bolsheviks, the Storm Troopers, the Redcoats.
They have rules, regulations, "100% Pure",
ivory towers, orthogonality, buzzword-
compliance. We have getting things done,
in more than one way, on any platform,
in one line of code, with a comprehensive
archive network, full gpl'ed source code
distributions.  They have caffeine, we have
the camel.  We shall overcome.

John Porter


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

Date: Wed, 25 Feb 1998 11:31:30 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Fill a hash ? (short post)
Message-Id: <34F44762.1A5B@min.net>

What you're trying to do (apparently) is actually quite simple.

Try this:

#!/usr/local/bin/perl5
$mydata="sort.test";
 
dbmopen (%mydata, $mydata, 0666) || die "$!\n";

my( $name, $age, $height );
 
my %people; # this is the hash to populate; keyed by name.

while ( ( $key, $val ) = each %mydata ) {
    ( $age, $height, $name ) = split( '&', $val );
    print "$name is $age years old and $height feet tall\n";

    # put a new record into the %people hash:
    $people{ $name } = { age => $age, height => $height };
}

dbmclose (%mydata); # we're done reading it.

foreach $name ( sort keys %people ) {
    print "$name is $people{$name}{age} years old and
    $people{$name}{height} inches tall \n";
}


Hope this helps,
John Porter


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

Date: Wed, 25 Feb 1998 11:45:39 -0500
From: John Porter <jdporter@min.net>
Subject: Re: hash data access
Message-Id: <34F44AB3.5F98@min.net>

Dan Boorstein wrote:
>
> did you try it without the quotes? it compiles for me without
> warning. try 'print $xyz{a}' and see what you get. "a => a"
> compiles with a warning.

Ok, now try it with use strict 'subs' in effect.

John Porter


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

Date: 25 Feb 1998 15:23:33 GMT
From: Doug Vermes <dvermes@emerald.tufts.edu>
Subject: Help with wSendmail in Perl
Message-Id: <6d1d1l$57q$1@news3.tufts.edu>

I'm having problems using wSendmail through Perl under NT. I try to open a pipe to wsendmail as
I would with sendmail under UNIX. The problem I have is that when I use the close command to
close the pipe, it doesn't work. The script either hangs or eventually times out trying to close
the pipe. I'm doing something like this:

$sendmail="/cgi-bin/tools/mail2/wsendmail.exe -CGI \"-sTest\" dvermes@emerald.tufts.edu;
open (SENDMAIL, "| $sendmail");
print SENDMAIL "This is a test.\n";
close (SENDMAIL);

Any help on why this isn't working or how to get it working to send e-mail from within a Perl
script under Windows NT would be greatly appreciated.
     Thanks,
        Doug

==========================================
Doug Vermes  --  dvermes@emerald.tufts.edu
Tufts University
==========================================




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

Date: Wed, 25 Feb 1998 11:04:14 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: Help! How can i show image from HTML files that is read in a cgi script ?
Message-Id: <955ACEFC9ECB1BD7.96EEE9F4F898E44C.D5D279930101BAFC@library-proxy.airnews.net>

feri <feri@unitel.co.kr> wrote:

> I have a question in a cgi script..
> 
> I wrote a cgi script like this.

Then look elsewwhere for your cgi answers.  This is a perl newsgroup.

You might want to see comp.infosystems.www.authoring.cgi.  But first
read their faq.

-- 
John Moreno
I am trying to convince the author of YA-NewsWatcher that the latest
version should be released to the public.  He doesn't think there's much
interest in a new version.  Help me prove him wrong.  To do so, send me
mail at <phenix@interpath.com> with a Subject of New YA.  Comments on
what you like or don't in the current version will be appreciated.


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

Date: 25 Feb 1998 15:46:03 GMT
From: Cameron Kaiser <cdkaiser@delete.these.four.words.concentric.net>
Subject: Re: How do I create my own perl libraries?
Message-Id: <6d1ebr$m3o@examiner.concentric.net>

Joey Garcia <bear@pacificnet.net> writes:

>Hello, I'm sort of new but I'm getting the hang of everything here
>pretty quickly.  I've written a few working cgi scripts and I keep
>coming up with more.  The problem I have is that I use alot of the same
>code in each one.  I wanted to know if there was a way I can make my own
>perl libraries or modules that I can include into the actual perl
>execuables.  Also, can I run my personal libraries from the same
>directory that contain the cgi programs?  Thanks for the help.

This is heavily FAQqed but this will get you started.

1. To create Perl modules (.pm) requires more knowledge than you have at
this point.

2. To include snippets of code, create a file with the common functions, and
then

require "filename";

If you do not specify an explicit path to the filename, you must make sure it
is in the @INC array. A "require"d file must return TRUE, so the common
idiom is to put a 1; at the end of it.

Read "require" in "Programming Perl" (p.205).

--
Cameron Kaiser
cdkaiser at concentric dot net (it hasn't helped the spam yet though)
*** visit the Spectre Server at www.sserv.com
*** C64 software lives! www.computerworkshops.home.ml.org


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

Date: Wed, 25 Feb 1998 11:16:14 -0500
From: Craig Ciquera <craig@mathworks.com>
Subject: How to call XSUB recursively
Message-Id: <34F443CE.4EE7759B@mathworks.com>

Hello All,

I am writing an XSUB which I would like to call recursively.  Does
anyone have any examples of doing this.

In the following code I would like to call dirExpand recursively:

i.e., How to pass filenames[i] to dirExpand?????

#ifdef __cplusplus
extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include <string.h>
#include <sys/types.h>
#include <sys/mkdev.h>
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
#ifdef __cplusplus
}
#endif

MODULE = dirExpand  PACKAGE = dirExpand

AV *
dirExpand(dir)
char *dir
PREINIT:
int i;
char *filenames[BUFSIZ];
char *pwd;
DIR *files;
struct dirent *d;
struct stat *pst;
struct stat st;
AV *fArray;
SV *temp;
char fType;
mode_t mode;
SV *a;
SV *sub;
int n;
CODE:
chdir(dir);
pwd = getcwd(NULL,BUFSIZ);
files = opendir(dir);
i = 0;
fArray = newAV();
while ((d = readdir(files)) != NULL) {
     filenames[i] = d->d_name;

     lstat(filenames[i],&st);

     pst = &st;
     mode = pst->st_mode;
switch (mode & S_IFMT) {
case S_IFREG:
fType = 'f';
break;
case S_IFDIR:
fType = 'd';
break;
case S_IFCHR:
fType = 'c';
break;
case S_IFBLK:
fType = 'b';
break;
case S_IFLNK:
fType = 'l';
break;
case S_IFIFO:
fType = 'p';
break;
case S_IFSOCK:
fType = 's';
break;
default:
fType = '?';
break;
}
if (fType == 'f') {
temp = newSVpv(d->d_name,0);
av_push(fArray,temp);
printf("File\n");
}
else if (fType == 'd') {
---->  n = perl_call_pv("dirExpand::dirExpand",G_SCALAR);  <--------
printf("HERE 7\n");
SPAGAIN;
PUTBACK;
LEAVE;
}
i++;
}
closedir(files);
RETVAL = fArray;
OUTPUT:
RETVAL


--
Craig Ciquera                       Tel: (508) 647-7547
The Mathworks, Inc.                 FAX: (508) 647-7002
24 Prime Park Way, Natick MA 01760
mailto:craig@mathworks.com          Web: http://www.mathworks.com




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

Date: Wed, 25 Feb 1998 14:49:58 +0000
From: Andrew Maguire <andrewm@sdl.ug.eds.com>
Subject: Re: HP-UX compile failure
Message-Id: <34F42F96.E6B@sdl.ug.eds.com>

Micheal Mc Evoy wrote:
> 
> >> I'm trying to build perl 5.004_04 on a HP-UX 10.20 server, using the same
> >> source as I used to build it on a Linux box and on an AIX server.
> >>
> >> Configure worked and didn't show any problems, make depend also worked with no
> >> errors or problems.
> >Did you do a make realclean and delete your old config.sh
> >before running Configure?
> 
I've just noticed that you're using gcc. I've been using HP's own
compiler which works straight off (except the DBM stufff I aluded to :(
)
However I guess that as a server you don't have HP's cc
-you could try dropping the optimisation down and see if it is
a bug in gcc.

Andrew


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

Date: Wed, 25 Feb 1998 16:07:56 GMT
From: jcwren@atlanta.com (John "Chris" Wren)
Subject: Installing ExtUtils Problems
Message-Id: <34f43ff3.769201613@nntp.atlanta.com>


	I've installed ActiveStates Perl 5.003_7.  I'd like to install
the libwww kit, but to build it I have to have MakeMaker installed.

	So, I've gotten MakeMaker-5.41, and can't seem to install it.
Seems that it can't find the ExtUtils/Manifest.pm file.  This appears
(to me) to be a chicken and the egg problem.  How am I supposed to
install the ExtUtils (which I don't have), which (seem) to need the
ExtUtils to install?

	Basic directory structure is this:

	c:\perl			(create by install)
	c:\perl\bin			"
	c:\perl\docs			"
	c:\perl\eg			"
	c:\perl\lib				"
	c:\perl\libwww-perl-5.20	(create by un-tar'ing)
	c:\perl\MakeMaker-5.41		"

	I changed into the \perl\MakeMaker-5.41, and per the
instructions, execute 'perl Makefile.PL'.  

	I get the following error:

Checking if your kit is complete...
Can't locate ExtUtils/Manifest.pm in @INC at (eval 1) line 374.

	Should I have placed the MakeMaker-5.41 directory somewhere
else?  The instructions don't seem to indicate what directories are
appropriate.

	Any help will be greatly appreciated.

	- Chris


---
John "Chris" Wren, KD4DTS
jcwren@atlanta.com
770-945-8288 (H)
770-840-9200 x2417 (W)

By US Code Title 47, Sec.227(a)(2)(B), a computer/modem/printer
meets the definition of a telephone fax machine. By Sec.227(b)
(1)(C), it is unlawful to send any unsolicited advertisement to
such equipment, punishable by action to recover actual monetary
loss, or $500, whichever is greater, for EACH violation.


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

Date: 25 Feb 1998 14:46:39 GMT
From: "Eric D. Friedman" <friedman@uci.edu>
Subject: Re: Multiple Sort on Array of Arrays?
Message-Id: <6d1asf$r63@news.service.uci.edu>

In article <4134.1323698977.77890@news.latrobe.edu.au>,
Jason Hellwege <glecjh@luff.latrobe.edu.au> wrote:


<...blah blah blah ...

It would be helpful to know what you have in your data-to-be-sorted.

<push (@$list, @fields);

You say you have an array of arrays, but this will just flatten out
into one array.  Try push @$list, \@fields instead.

<The basic recipe is from the Camel book, but my attempt to 
<transpose it for an array-of-arrays seems to fail. Printing 
<out the array-of-arrays shows that @$list is populated as I 
<expect it to be.

Have you seen any examples of the "Schwartzian Transform" in your
investigations at DejaNews?  It's a neat little maneuver that lets
you sort a multi-dimensional array on some field or other.

Here's the basic gist of it:

my @sorted =
map { $_->[0] }
sort { $a->[1] cmp $b->[1] }
map { [ $_, $_->[4] ] } 
@lol;

Read this from the bottom up.  

1) Take a list of lists
	@lol;
2) map each element into any anonymous array with 2 elements: the original
   list entry and the 5th element inside that list
  map { [ $_, $_->[4] ] }
3) sort on the second element in the anonymous array
  sort { $a->[1] cmp $b->[1] }   
4) use map to return the original (but sorted) list entry to an array of
results.
map { $_->[0] }   

You should be able to use this example to add other elements to the
anonymous array in step 2 && then to sort on them in step #3.

HTH,
Eric
-- 
Eric D. Friedman
friedman@uci.edu


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

Date: Wed, 25 Feb 1998 10:44:00 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: OMIGAWD (tm) - The Perl Journal!
Message-Id: <linberg-2502981044000001@pri03-015.oldcity.dca.net>

Wow.  Want to be a wizard?  Want to have your brain stretched in ways you
never dreamed possible?  Want to see full demos and superb articles so
full of insanely useful information it will make your head spin?  Want to
be baffled by gems of obfuscated Perl that do things you just can't
believe (like render the Mandelbrot set, in ASCII, in 2.5 *lines* of
Perl)?

Stop what you're doing and order the back issues of the Perl Journal. 
Subscribe, while you're at it.  Five bucks an issue can't be beat.  Holy
cow.  Dope slaps all around to people who don't know about it - myself
included as of last week.  Best $45 I ever spent (except maybe for the
Camel book).

If you have more than even a passing interest in Perl, you need this.  It
will make you Smart.  Plus, it's great bathroom reading.  My head feels
heavier already.

Off for some hacking, with renewed vigor!
__________________________________________________________________________
Steve Linberg                            National Center on Adult Literacy
Systems Programmer &c                           University of Pennsylvania
linberg@literacy.upenn.edu                   http://www.literacyonline.org


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

Date: Wed, 25 Feb 1998 14:48:44 GMT
From: q.e.d@usa.net (Qunice)
Subject: Outputting background color
Message-Id: <6d1bcj$898@bgtnsc01.worldnet.att.net>

Can an HTML background color be invoked from a print command?

Example:
   print "<html><head><title></title></head>\n";
   print "<body><center><h1>text</h1></center>\n";

Is there a way to include "background="#000000" after "<body" in the 
above?

TIA



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

Date: 25 Feb 1998 15:06:29 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Outputting background color
Message-Id: <6d1c1l$4b9@news-central.tiac.net>

In article <6d1bcj$898@bgtnsc01.worldnet.att.net>,
Qunice <q.e.d@usa.net> wrote:
>Can an HTML background color be invoked from a print command?
>
>Example:
>   print "<html><head><title></title></head>\n";
>   print "<body><center><h1>text</h1></center>\n";
>
>Is there a way to include "background="#000000" after "<body" in the 
>above?

Yes, you can use some other quotes around the string to be printed, as
you're not interpolating any variables you could use single quotes e.g.

  print '<body background="#000000"><h1>text</h1>', "\n";

or you can use the \ to escape a " in a string enclosed in "" e.g.

  print "<body background=\"#000000\"><h1>text</h1>\n";

or you can use the qq operator to specify an alternate double quote e.g.

  print qq{<body background="#000000"><h1>text</h1>\n};

(see the perlop documentation where it talks about Quote and Quote-like
Operators for a more detailed discussion of this.)

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: 25 Feb 1998 14:12:29 GMT
From: jhunterj@lexis-nexis.com (Hunter Johnson)
Subject: Re: Pattern Match
Message-Id: <6d18sd$7qg@mailgate.lexis-nexis.com>

In article <01bd4164$08062f40$064763a1@amancw15580.anc.xwh.bp.com>,
 <bp@bp.com> wrote:
> I have a series of lines of data that start with

> " D-01    1456"
> " D-02    1500"
> " D-04    1400"

> I want to keep the D-01 as one word.  How would I match this or
> parse it in perl?

/D-01/

or, assuming you meant the first field in general:

/D-\d\d/
/\S+/
/[^ ]+/

and probably countless others.  What had you tried?

Hunter
--
J. Hunter Johnson        | "A little consistent wholesome modeling and
jhunterj@lexis-nexis.com |   costly servanthood are worth millions of
(937) 865-6800 x5385     |    true words harshly spoken."
Lexis-Nexis, Dayton, OH  |                               -- Ron Sider


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

Date: 25 Feb 1998 15:29:24 GMT
From: "Eric D. Friedman" <friedman@uci.edu>
Subject: Re: Pattern Matching for parsing tags
Message-Id: <6d1dck$ssr@news.service.uci.edu>

In article <6d0kmb$8g8$5@client3.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
<
<HTML::Parser parses better than populair browsers, but it doesn't
<fully parse HTML. SGML tools that parse HTML correctly have been
<around for more than a decade (indeed, longer than HTML itself).
<However, I'm not aware of such a beast in Perl.

UC Irvine's best-loved "electronic loiterer" (his .sig), Earl Hood
has just such a beast: perlSGML

http://www.oac.uci.edu/indiv/ehood/perlSGML.html

Even if it doesn't do exactly what you want, it'd still be an excellent
example to study.  That's the great thing about open source code, even
if you don't use somebody else's work directly, you can still climb
up onto the shoulders of giants....

-edf
-- 
Eric D. Friedman
friedman@uci.edu


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

Date: 25 Feb 1998 15:38:29 GMT
From: Cameron Kaiser <cdkaiser@delete.these.four.words.concentric.net>
Subject: Re: Q: obscuring Perl scripts?
Message-Id: <6d1dtl$l3s@examiner.concentric.net>

markw@markwatson.com (Mark Watson) writes:

>Sorry if this is a FAQ (I looked), but are there any
>tools for (slightly) obscuring Perl scripts; something
>simple like converting variable names to a1, a2, etc.?

There's no automagical tool, no. But it's not hard to be opaque:

print pack("H26", "68656c6c6f20776f726c64210a");

and this could be made much worse.

But obfuscation hurts maintainability and reliability (if you do it wrong),
and there's really no reason to. If this is for Win32, check into Perl2Exe
(http://www.demobuilder.com/).
--
Cameron Kaiser
cdkaiser at concentric dot net (it hasn't helped the spam yet though)
*** visit the Spectre Server at www.sserv.com
*** C64 software lives! www.computerworkshops.home.ml.org


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

Date: 25 Feb 1998 13:58:23 GMT
From: mbeattie@sable.ox.ac.uk (Malcolm Beattie)
Subject: Re: Safely running one-liners
Message-Id: <6d181v$8n$1@news.ox.ac.uk>

In article <6cttr7$arm$1@client3.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
>Danny Aldham (danny@lennon.postino.com) wrote on 1638 September 1993 in
><URL: news:6ctlft$3st$1@lennon.postino.com>:
>++ X-Newsreader: TIN [version 1.2 PL2]
>++ 
>++ A lot of posters here have .sigs that include perl one liners.
>++ Is there a safe way to run them, and be assured that they wont
>++ damage and/or erase files?  (or e-mail off my shadow file)
>
>Just make sure you understand it ;)

If it only uses basic Perl features then you could try putting the
one-liner in file foo and doing

  perl -MSafe -e 'Safe->new->rdo("foo"); die if $@'

or if you still want it to be a one-liner

  perl -MSafe -e 'Safe->new->reval(q{' -e 'one_liner' -e '}); die if $@'

Yours uses a module so that's not as easy to constrain. Understanding
is indeed the ideal goal, though.

--Malcolm

-- 
Malcolm Beattie <mbeattie@sable.ox.ac.uk>
Oxford University Computing Services
"I permitted that as a demonstration of futility" --Grey Roger


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

Date: Wed, 25 Feb 1998 16:53:16 GMT
From: "Norman Bunn" <norman.bunn@mci.com>
Subject: Stripping linefeeds
Message-Id: <00YI.8848$pf.884826@news.internetMCI.com>

I'm reading in a colon delimited file as follows:

Doe:John
Smith:Joan
etc.

I'm splitting the file into an array, reversing the order and adding a
domain address (@mci.com) to each one.  This, obviously, creates an e-mail
address.

My problem is that each entry has a linefeed at the end, so instead of:

John.Doe@mci.com

I'm getting:

John
 .Doe@mci.com

Any help on removing the LF?

Thanks,

Norman




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

Date: 25 Feb 1998 09:16:50 -0500
From: charlot@CAM.ORG (Richard Bellavance)
Subject: Re: The Ineffable Tom C.
Message-Id: <6d194i$mpr@ocean.CAM.ORG>

In article <6d1440$jn$1@nnrp1.dejanews.com>,  <shaker@netusa1.net> wrote:
>
>(2) As for online documentation and other online stuff: one has to know
>either where these are located or what all are available in their 'normal
>path'; if I am missing something, please let me know. Let me 'splain'. I know
>that perlfaq and perlfaq1 through perlfaq9 exist. I can
>
>  perldoc perlfaq8 | grep reference
>
>for instance. I also know that several other pieces of documentation (such as
>perlfunc, perlobj, etc.) exist. Recently, I started making a list of these as
>I see them mentioned in various places (different postings and books for
>instance), so that I can 'perldoc' them. I have never tried
>
>  perldoc perl* | grep perl2exe
>
>Maybe this will work.

I doubt it, but try "perldoc perl".

>I want to look at the Perl source code. I don't know
>whether it is available online on our system or not - whether it has been
>installed or not. I certainly don't know where the source is located. I spent
>a small amount of time looking at some /usr areas but did not find it. I
>certainly can get in touch with the people who install these things - this
>has not been a priority yet.

Have you tried asking you system manager (or whoever installed Perl) ?

HTH,
Richard.
-- 
Richard Bellavance -- charlot@cam.org -- http://www.cam.org/~charlot/
    "All along this path I tread  /  My heart betrays my weary head
     With nothing but my love to save / From the cradle to the grave"
                                 (Eric Clapton, "From the cradle")


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

Date: 25 Feb 1998 14:40:52 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: The Ineffable Tom C.
Message-Id: <6d1ahk$sfm@fridge.shore.net>

Ook! (rantNreview@yahoo.com) wrote:

: What I wonder, is if the newsgroup irritates his ilk so damned much, why
: do they read it? And if someone is actually a decent Perl programmer , or

My guess is that they have chosen to educate people here.  Since this
newsgroup has become a helpdesk, it's probably better that they're
here to insure that the answers are correct and that other people
don't make incorrect assertions about the language and what it can do.

: even better yet, a good educator worth listening to, how is it that they
: have time to post a dozen times a day and park on Efnet #perl 24/7/365?

What business is that of yours?  Who cares what they do in their
off-time?  Maybe they enjoy it.

: Given the demand for comptent programmers, well, do the logic puzzle...

So, you're saying that they're incompetent because they post to Usenet
and use IRC?  I wouldn't have learned as much about Tom Christiansen
or Randal Schwartz if not for Usenet.  Their presence here served as
good name recognition when it came time to select Perl books.

--
Nathan V. Patwardhan



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

Date: 25 Feb 1998 15:28:38 GMT
From: billy@cast.msstate.edu (Billy Chambless)
Subject: Re: The Ineffable Tom C.
Message-Id: <6d1db6$jsq$2@nntp.msstate.edu>

In article <34f33e5c.1759735@news.clara.net>, wrdcom@clara.net (Sean Ahern) writes:
|> On Tue, 24 Feb 1998 14:17:44 +0000, Brendan Knox <knoxb@pecc.co.uk>
|> wrote:

|> > If it isn't... well that's a whole other rant
|> > about people being allowed to access programming languages 
|> > and interpreted scriptingtools. :>

|>    Aaaaah, its elitist time....


No, elitism would be more like saying, "We're only going to let CalTech
graduates write programs". That's drastically different from saying,
"People who aren't willing to read shouldn't try to program, and we're
sure not going to help them".
-- 
* "And there _is_ a real world. In fact, some of you
*    are in it right now."  -- Gene Spafford


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

Date: Wed, 25 Feb 1998 08:03:52 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Using .exe programs within Perl?
Message-Id: <34F424C8.1C16C9A7@houston.Geco-Prakla.slb.com>

Scott A. MacMillan wrote:
> 
> I'm trying to write a small utility that will convert image files from
> one format to another using an .exe program that I already have and then
> rename them with padded 0s.
> 
> I've got the renaming portion written and working fine but I can't
> figure out how to get the Perl script to run the executable within the
> while loop.
> 
> Any suggestions for a rookie scripter?
> 
1.  Look into the system, exec, qx//, and `` (backtick) operators in the
Camel book, or in the online documentation.
perldoc -f system
perldoc -f exec
perldoc perlop    (search for qx)
perldoc perlfunc  (some coverage of ` (backtick) operator)


2.  Ditch the address card for newsgroup postings.  Many posters here do
not use Netscape so your address card appears to them as html (mime?)
gibberish and is unuseable.

> Thanks
> Scott
> --
<sig card snipped>

Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


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

Date: 25 Feb 1998 16:09:36 GMT
From: jobell@bnr.ca (Joseph Bell)
Subject: Using FileHandle objects recursively
Message-Id: <6d1fo0$8me@crchh14.us.nortel.com>

I have a program which creates new FileHandle objects, writes to them,
pushes them on a stack, and pops them off later to write more information
to the file.

What I'm seeing is some very strange behavior on printing (->print) to
the filehandle.  I do something like

$currentFileHandle->print ("$somevar blah blah $anothervar\n");
push(@FDs, $currentFileHandle);

and later

$currentFileHandle = pop(@FDs);
$currentFileHandle->print ... ;

if $somevar is "abcde" i might get

abcde blah blah

written to the file, but sometimes I lose stuff and get

cde blah blah

in the file.

very strange.

Thanks for any info.

Joe

-- 
Joseph A. Bell (NOT Cindy Wierschem) jobell@nortel.com
Northern Telecom Wireless Technologies
GSM MSC Tools Development
No funny quotes here.


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

Date: Wed, 25 Feb 1998 09:01:13 -0500
From: Hansen <defaultuser@domain.com>
Subject: Why install perl?
Message-Id: <34F42429.57C31145@domain.com>

Hello

I am just beginning to learn perl.  I did not see in the text I've been
using (Gundavaram's CGI Programming on the WWW) that I need to install
perl on my system.  I find that the online tutorial that I'm going
through says that I need to install it.

I am trying to learn this cgi scripting tool in order to develop forms
for several pages I've developed or maintain.  I work from my home PC
and ftp my stuff to the campus server.

The scripts I've been playing around with have been written on MSWord,
saved as text, and ftp'd to the server.  I then test them with Netscape.

Would installing it allow me to test the scripts without ftp-ing?

Victoria



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

Date: Wed, 25 Feb 1998 11:04:20 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: why no Case statment?
Message-Id: <C49ECAE1F6F763B0.D09099A6848ADD14.EE69626E62405F8F@library-proxy.airnews.net>

Randal Schwartz <merlyn@stonehenge.com> wrote:

> >>>>> "Jarkko" == Jarkko Hietaniemi <jhi@alpha.hut.fi> writes:
> 
> Jarkko> If you can answer these questions, well, then you can write the
> Jarkko> if-elseif-else.
> 
> What's "elseif" ?
> 
> :-)

Maybe he's used to HyperTalk?  It has a elseif test.

-- 
John Moreno
I am trying to convince the author of YA-NewsWatcher that the latest
version should be released to the public.  He doesn't think there's much
interest in a new version.  Help me prove him wrong.  To do so, send me
mail at <phenix@interpath.com> with a Subject of New YA.  Comments on
what you like or don't in the current version will be appreciated.


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

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

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