[18270] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 438 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 7 18:11:03 2001

Date: Wed, 7 Mar 2001 15:10:25 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <984006625-v10-i438@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 7 Mar 2001     Volume: 10 Number: 438

Today's topics:
    Re: Grokking map and grep (Abigail)
    Re: Grokking map and grep <uri@sysarch.com>
    Re: HELP needed: using regular expressions (regex; rege <ekliao@pacbell.net>
    Re: Help to Install Perl <mischief@velma.motion.net>
    Re: How do I combine filehandles, refs and strict? <Jonathan.L.Ericson@jpl.nasa.gov>
    Re: How to convert morse to ascii using perl? <iltzu@sci.invalid>
        if($array1[1]  eq $string1) DOESN'T WORK?? <donotreply@interbulletin.bogus>
    Re: Installing IO::pty on Win32 <gellyfish@gellyfish.com>
    Re: Is Perl right for me? <gellyfish@gellyfish.com>
        Newbie:  How do I substitute a range of lines in a doc? <jm.wood@home.com>
    Re: Perl for System V <gellyfish@gellyfish.com>
    Re: Perl Internals <gellyfish@gellyfish.com>
    Re: pi day <iltzu@sci.invalid>
    Re: pi day (Greg Bacon)
    Re: pi day (John McNamara)
    Re: PostgreSQL vs MySQL <agnew@hsc.vcu.edu>
    Re: PostgreSQL vs MySQL <Jonathan.L.Ericson@jpl.nasa.gov>
    Re: print abstract ('blah'); # subroutine or file handl <joe+usenet@sunstarsys.com>
    Re: PWS and Perl <pyuson@yahoo.com>
    Re: Reading a file nobull@mail.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 7 Mar 2001 20:33:05 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Grokking map and grep
Message-Id: <slrn9ad6o1.q1s.abigail@tsathoggua.rlyeh.net>

Chris Stith (mischief@velma.motion.net) wrote on MMDCCXLV September
MCMXCIII in <URL:news:tad0dtlf38kbf1@corp.supernews.com>:
:} Randal L. Schwartz <merlyn@stonehenge.com> wrote:
:} >>>>>> "Philip" == Philip Lees <pjlees@ics.forthcomingevents.gr> writes:
:} 
:} > Philip> .. and of course, when I go back to the docs, I now find that I
:} > Philip> understand the Schwartzian Transform example there, too.
:} 
:} > Good, then can someone explain it to me?
:} 
:} > :-)
:} 
:} Someone once emailed me a detailed description of it. Maybe he
:} can help you. His address is merlyn@stonehenge.com  :-/
:} 
:} I'm surprised I don't hear more about many algorithms being named
:} after people in the Perl community. The flexibility of the language
:} allows many neat approaches to problems. Perhaps the Open Source
:} nature of the community, with the modules and everything being
:} handed out so freely, partially precludes the publishing of papers
:} about new ways to do things. It's widely known, Randal, that you
:} aren't the one who named the Schwartzian transform after you.
:} 
:} Perhaps it's the centralization of reusable implmentations with the
:} author's names that reduces the need of people to label the specific
:} algorithms? I can't believe that the Perl community develops
:} substantially fewer new algorithms than the C or Java communities.
:} There must be some social explanation. Perhaps ESR could shed some
:} light on this.


Well, there are the Guttman-Rosler Transform, the Orcish Maneuver
and Abigails Length Horror.

They are just barely "algorithms" though.


Abigail
-- 
perl -wle'print"Κυστ αξοτθες Πεςμ Θαγλες"^"\x80"x24'


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

Date: Wed, 07 Mar 2001 21:15:53 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Grokking map and grep
Message-Id: <x77l21e0vt.fsf@home.sysarch.com>

>>>>> "A" == Abigail  <abigail@foad.org> writes:

  A> Chris Stith (mischief@velma.motion.net) wrote on MMDCCXLV September

  A> :} Perhaps it's the centralization of reusable implmentations with the
  A> :} author's names that reduces the need of people to label the specific
  A> :} algorithms? I can't believe that the Perl community develops
  A> :} substantially fewer new algorithms than the C or Java communities.
  A> :} There must be some social explanation. Perhaps ESR could shed some
  A> :} light on this.


  A> Well, there are the Guttman-Rosler Transform, the Orcish Maneuver
  A> and Abigails Length Horror.

  A> They are just barely "algorithms" though.

i wouldn't classify any of them as algorithms. they are pretty much
language specific which makes them techniques, idioms or 'transforms'.

as abigail would probably agree, a true algorithm is language
independent. that is why knuth is useful even if he created his own
language to express all the algorithms.

but translating a given algorithm to quality/efficient code in a given
language is not always trivial. that is where those transforms and
idioms come in.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: 7 Mar 2001 15:29:05 -0600
From: Eric Liao <ekliao@pacbell.net>
Subject: Re: HELP needed: using regular expressions (regex; regexp) or Parse::RecDescent to isolate Java/C++ statements <==== code inside, pls help :-)
Message-Id: <gb8dat4n8amvbp2u6b3oplvd2rq9ikmovh@4ax.com>

### START OF CODE
# perl version = activePerl v5.6.0 build 623
use strict;
use Parse::RecDescent;
undef $/;
my $text = @ARGV ? <> : <DATA>;
{	# start-up action
	print "PRORAM:\n\n";
	print "$text\n";
	print "PARSE RESULTS:\n\n";
}
$::grammarRegex = <<'EOF';

program	:	statement(s)

statement	:	expression delimiter

delimiter	:	'{'
			|	'}'
			|	';' '}'
			|	';'

expression	:	hasdqstring
				{print "has string: $item[1]\n";}
			|	nodqstring
				{print " no string: $item[1]\n";}

nodqstring	:	/[^"{;}\\\\]+/

hasdqstring:
/([^"{;}\\\\]+)*("[^"\\\\]*(\\\\.[^"\\\\]*)*"([^"{;}\\\\]+)*)+/

#this rule is equiv. to the following three but can be accessed
# thru $item[1]

#hasdqstring	:	normal(s?) (special normal(s?))(s)
					# how do i print this whole thing out?
					# this follows the "unrolling the loop" technique
					# described in Friedl's book
#normal	:	/[^"{;}]+/
			# the non-doublequoted-string part of a statement that
			# contains doublequoted strings

#special	:	/"[^"\\\\]*(\\\\.[^"\\\\]*)*"/
				# a doublequoted string, allowing escaped characters
				# (from Friedl's book)
				# this is itself another "unrolling the loop"
				# construct where
				# normal is /[^"\\\\]/
				# special is /\\\\./
				# so the whole thing is "(normal)*(special(normal)*)*"
			         
EOF

my $parser = new Parse::RecDescent($::grammarRegex) or die "invalid
grammar";
defined $parser->program($text) or die "malformed program";
__DATA__
1	public class Test {
2		public static void main(String[] args) {
3			"string1" + method(args) + "string2";
4			for (init; cond; incr) {
				"doThis; doThat;";
				method();
			}
5			char this_doesnt_work_yet = ';';
6			concat_multiline_string = "string3" + var1
				"string4";
7			"delimiters in string: OK ; { } ; }";
8			"escaped backslash OK \\ string";
9			"escaped doublequote BUG \" string";
10			"escaped anything else BUG \n string";      
		}
	}
===============================================================
ACTUAL OUTPUT

PROGRAM:
 ... ...

PARSE RESULTS:

 no string: 1   public class Test
 no string: 2           public static void main(String[] args)
has string: 3                   "string1" + method(args) + "string2"
 no string: 4                   for (init
 no string: cond
 no string: incr)
has string: "doThis; doThat;"
 no string: method()
 no string: 5                   char this_doesnt_work_yet = '
 no string: '
has string: 6                   concat_multiline_string = "string3" +
var1
                                "string4"
has string: 7                   "delimiters in string: OK ; { } ; }"
has string: 8                   "escaped backslash OK \\ string"
 no string: 9
================================================================
EXPECTED OUTPUT

 no string: 1   public class Test
 no string: 2           public static void main(String[] args)
has string: 3                   "string1" + method(args) + "string2"
 no string: 4                   for (init; cond; incr)
has string: "doThis; doThat;"
 no string: method()
 no string: 5                   char this_doesnt_work_yet = ';'
has string: 6                   concat_multiline_string = "string3" +
var1
                                "string4"
has string: 7                   "delimiters in string: OK ; { } ; }"
has string: 8                   "escaped backslash OK \\ string"
has string: 9					"escaped doublequote BUG \" string";
has string: 10					"escaped anything else BUG \n string";
================================================================
PROBLEM DESCRIPTIONS

1. Statement 4: The for loop is a known issue, since it has not been
implemented in the grammar.

2. Statement 5: I don't know how to add the rules for the following
singlequoted characters: ';', '{', '}'.  So this has not been
implemented in the grammar either.

3. For some strange reason, statements 9 and 10 are not printed out.
I suspect it's because they contain \" and \n (actually, anything
other than \\).  I really have no idea why.  Statement 8 has \\ and it
was recognized correctly and printed.  I wonder if this subtle bug is
because I _nested_ the

	normal*(special(normal)*)*

construct in the grammar, in the inside for matching a doublequoted
string, and on the outside for matching an entire statement that has
doublequoted strings.

Any idea, input, suggestion?

Thanks,
Eric

On 6 Mar 2001 20:05:11 -0600, Eric Liao <ekliao@pacbell.net> wrote:

>Problem:
>Given any valid Java (or c++) source code file, I need to separate it
>into an array of statements.  The delimiters used are:
>
>	a left curly brace: /\{/
>or	a semicolon followed by a right curly brace: /;\s+\}/
>or	a semicolon: /;/
>or	a right curly brace, not preceded by a semicolon: /\}/
>
>A statement can be several lines, such as:
>
>	methodA("string1" +
>		methodB + "string2");
>
>The difficulty is, these four delimiters can appear in the statement
>as characters or inside doublequoted strings and should not be treated
>as delimiters:
>
>	char a = '}';
>	String b = "this is a semicolon => ; ";
>
>Also, the semicolon can appear in for loop and should not be treated
>as delimiter:
>
>	for (exp1; exp2; exp3) { statement(s) }
>
>I have tried either a regexp-only approach or a Parse::RecDescent
>approach, but neither was error-free for me.  There must be subtle
>bugs in my code, but for a start, I'd like to ask a top-level
>question: can a problem of such nature be solved entirely by regular
>expressions?  Which is a better approach?  Does a solution already
>exist somewhere?
>
>Any input is greatly appreciated.  I'll follow up by posting my code
>later.
>
>Thank you,
>Eric



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

Date: Wed, 07 Mar 2001 22:56:55 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Help to Install Perl
Message-Id: <tadf5nbdm83v59@corp.supernews.com>

Suzanne <suzanne@campustech.com> wrote:
> The last time I checked, I paid my bills for Internet service, and I lived
> in a free country .... and I can ask questions and get answers in newsgroups
> like any other red-blooded American .... and you are not the boss of the
> Internet, unless someone promoted you and didn't tell me ...  UNDERSTAND!?

Manners, traditions, and cust have little to do with employment status.
Spamming is rude. Top-posting is rude. Your response to nobull, who is
a valued regular poster here, is rude. You are apparently a rude person.

I can deal with an occaisional bit of rudeness. The regulars here can
vouch that there are people who post here who are a little bit rude
now and again, but whom many of us still deal with mostly politlely,
because they have redeeming posts as well. I see no posts from you
which redeem all the rude things you have done.

I've never killfiled anyone in all the 8 years I've been using Usenet
newsgroups. Hopefully you can take pride in being the first.

*plonk*

Chris

-- 
Christopher E. Stith
Disclaimer: Actual product may not resemble picture in ad in any way.



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

Date: 07 Mar 2001 22:14:22 +0000
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: How do I combine filehandles, refs and strict?
Message-Id: <86d7btdy69.fsf@jon_ericson.jpl.nasa.gov>

Svein Tore Opdal <stop@statoil.com> writes:

> But this does not work if I use 'strict', and I have not been able to
> figure out how to modify tjhe program to
> get around it.
> I know that I can avoid the problem by being more lenient  (exlude
> 'refs' from strict) , but that does not sit well with me.
> 
> perl error message is
> Can't use string ("fh01") as a symbol ref while "strict refs" in use at
> .//testOpen.pl line 15.
> 
> What is  a  'proper' solution for this?

1) You are probably better off using a hash.

2) You may be able to get away with using lexical file handles:

  open my $file, $filename or die "can't open $filename: $!";

3) If you _really_ need symbolic references (and I don't think you
do), you can turn of strict "refs" lexically.

Basically symbolic references are evil and unnecessary in day-to-day
perl.

Jon


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

Date: 7 Mar 2001 20:18:13 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: How to convert morse to ascii using perl?
Message-Id: <983996200.15737@itz.pp.sci.fi>

In article <%jfp6.19924$V6.75693@news1.gvcl1.bc.home.com>, Andy wrote:
>I am new to perl and am learning how to convert a morse code to acsii.  Any
>suggestions where to look to get started?

  perl -lne'print+grep{$_=pack"b*",$_.1;y/\1-z/ ETINAMSDRGUKWOHBLZFCP VX Q YJ/}split$"'

That's based on a JAPH I posted to the Fun With Perl list some months
ago, further shortened by Ton Hospel.  For the original output, enter:

  .--- ..- ... -  .- -. --- - .... . .-.  .--. . .-. .-..  .... .- -.-. -.- . .-.

Adding numbers, punctuation and accented letters is left as an exercise.

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
"You have to type something else, which is documented in the booklet that
 comes with the server, and which your predecessor threw away."
                                         -- Florian Weps in the monastery

Please ignore Godzilla / Kira -- do not feed the troll.


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

Date: Wed, 07 Mar 2001 22:10:01 +0000
From: Wannabe Perl Guru <donotreply@interbulletin.bogus>
Subject: if($array1[1]  eq $string1) DOESN'T WORK??
Message-Id: <3AA6B1B9.56610105@interbulletin.com>

I have @array1 filled with strings, and have $string1 = "somestring";
But when I use this statement:

  if($array1[1]  eq $string1) 
      print "yes";

Then Perl throws up!
Why can't I do this this Perl?
What alternatives are there to the above statement??

TIA


_______________________________________________
Submitted via WebNewsReader of http://www.interbulletin.com



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

Date: 6 Mar 2001 22:43:40 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Installing IO::pty on Win32
Message-Id: <983p6s$3k8$1@orpheus.gellyfish.com>

On Tue, 06 Mar 2001 14:21:19 GMT Ben Kennedy wrote:
> 
> "jibbering poster" <rob_lundXOXO@pacbell.net> wrote in message
> news:O7Wo6.193$p_3.104533@news.pacbell.net...
> 
>> Gee... It sure is tough to use the Expect module in a Windwos environment.
>> If anyone has Successfully run the expect module in Windows, can you
> PLEASE
>> email me the method you used to install it at:
> 
> Assuming you are using ActiveState's Perl, you can use their ppm tool to get
> the Win32 binary from their site - at a command line (and while connected to
> the Internet), type
> 
> ppm
> 
> then
> 
> install Expect
> 
> Should work fine - hope this helps
> 

That Expect works at all on Windows comes as some surprise :)

/J\
-- 
Jonathan Stowe                      |     
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: 6 Mar 2001 22:30:02 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Is Perl right for me?
Message-Id: <983oda$3bu$1@orpheus.gellyfish.com>

On Tue, 06 Mar 2001 10:16:15 GMT Gwyn Judd wrote:
> I was shocked! How could Martien Verbruggen <mgjv@tradingpost.com.au>
> say such a terrible thing:
>>On Tue, 06 Mar 2001 06:15:06 GMT,
>>	Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
>>> I was shocked! How could Jonathan Stowe <gellyfish@gellyfish.com>
>>> say such a terrible thing:
>>>>On 4 Mar 2001 19:13:00 -0000 Jonathan Stowe wrote:
>>>>> On Sun, 04 Mar 2001 13:19:21 GMT Bart Lateur wrote:
>>>>>> Holly Bortfeld wrote:
>>>>>> 
>>>>>>>I can write HTML
>>>>>>>from scratch without an editor.
>>>>>> 
>>>>>> Wow, that is strong. So how do you write HTML? Using a speech
>>>>>> recognition system?
>>>>>> 
>>>>> 
>>>>>    copy CON: somefile.html
>>>>> 
>>>>> or
>>>>> 
>>>>>    cp /dev/tty somefile.html
>>>>> 
>>>>
>>>>or of course the editor of champions :
>>>>
>>>>  dd if=/dev/tty of=somefile.html
>>>                                     |
>>> cat /dev/random | sed -e $SOME_SCRIPT > somefile.html
>>> 
>>> I'm still working on it though
>>
>>So... What did you use to write $SOME_SCRIPT? Or is this a recursive
>>solution?
> 
> Well, like, *duh*
> 
> SOME_SCRIPT=`cat /dev/random | sed -e $SOME_OTHER_SCRIPT`
> 

Well just to bring it to an end <ahem> you could try :

[gellyfish@orpheus perl]$ until sed -e $SOMESCRIPT </dev/random 2>/dev/null
> do
> SOMESCRIPT=`cat /dev/random`
> done

/J\
-- 
Jonathan Stowe                      |     
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: Wed, 07 Mar 2001 22:48:24 GMT
From: "JM Wood" <jm.wood@home.com>
Subject: Newbie:  How do I substitute a range of lines in a doc?
Message-Id: <YUyp6.13663$hn5.1998022@news1.rdc1.mb.home.com>

I'd like to substitute (to update) old with new information in a document
over a range of lines, between a specific START and END pattern.

Help please.

Thanks.




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

Date: 7 Mar 2001 21:10:53 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl for System V
Message-Id: <98684t$emf$1@orpheus.gellyfish.com>

On Wed, 07 Mar 2001 00:07:54 -0000 Chris Stith wrote:
> Garrett Groff <groffg@gmgdesign.com> wrote:
>> I need to install Perl on System V.  I'd like to use the source, but I
>> downloaded one compressed source file, containing dozens upon dozens of
>> files. Is this really going to compile???  How should I compile it?  g++ *.c
>> I'm dubious that that is going to work w/o time-consuming revisions to the
>> source.  Can anyone HELP?!
> 
> The source distribution comes with a Makefile and an INSTALL file.
> 

A small quibble.  There is no Makefile until part way through the steps
described in the INSTALL file.

/J\
-- 
Jonathan Stowe                      |     
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: 6 Mar 2001 22:05:30 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl Internals
Message-Id: <983mva$31g$1@orpheus.gellyfish.com>

On Mon, 05 Mar 2001 20:40:59 -0000 Chris Stith wrote:
> Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>> On Sat, 3 Mar 2001 16:17:45 -0500 Eduard Grinvald wrote:
>>> Hello All!!
>>> Is there any place where i can determine how perl internally represents data
>>> types and objects. Mostly, i need to know the level of number precision and
>>> how many bytes do references, ints, hashes, etc take up.
>>> 
> 
>> This kind of stuff is not documented, you will have to consult the
>> Perl source code.
> 
> Since Perl is implemented in C, and C's primitive data types are allowed
> to be different sizes as the platform allows, it would be good not
> only  to know how Perl maps its data types to C types, but also to
> know how those types are respresented on the platform in question.
>
> For all I know, every type in Perl maps to a certain defined type
> in C which is defined conditionally based on the platform. Somehow,
> though, I doubt this.  I'm sure some values in Perl are a different
> size on different platforms due to mapping against C types which are
> different on those platforms. I do know that there are options to make
> Perl numbers 64 bits instead of 32 at Perl build time. There is a pragma
> to use ints instead of doubles within a block of a Perl program. Refs,
> in my mind, are likely whatever size the C compiler on the platform
> uses for pointers (although I have not read the source closely enough
> to know for sure).

Yeah fine, but a Perl scalar or a hash or an array *doesnt* map to a
primitive C type - they are represented internally as structs - for instance
an SV ( the data structure that holds a scalar ) is defined as :

struct STRUCT_SV {
    void*       sv_any;         /* pointer to something */
    U32         sv_refcnt;      /* how many references to us */
    U32         sv_flags;       /* what we are */
};

Now of course the struct itself is of a fixed size but depending on what it
is you are storing in the sv_any the size of the storage for a given scalar
could be anything - this is why the code deserves examination if one is
concerned as to what the size of a Perl data type might be - the headers
themselves give some clue but it is what the functions that do the storing
in these structures themselves do that holds the real clue.

The perlapi and perlguts manpages should indicate what these functions are.

/J\
-- 
Jonathan Stowe                      |     
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: 7 Mar 2001 19:36:53 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: pi day
Message-Id: <983993367.12829@itz.pp.sci.fi>

In article <taatr2pan9q5ad@corp.supernews.com>, Chris Stith wrote:
>John McNamara <jmcnamara@cpan.org> wrote:
>> Ar 6 Mar 2001 07:03:41 -0000, do scriobh Jonathan Stowe
>> <gellyfish@gellyfish.com>:
>>>On Mon, 05 Mar 2001 16:30:14 -0000 Greg Bacon wrote:
>>>> Don't forget that it's also the birthday of Albert Einstein, Billy
>>>> Crystal, and noted Perl plinker Greg Bacon.  Send Guinness. :-)
>
>>>I didnt think there was an implementation of the Network Guinness Transport
>>>Protocol yet.
>
>> Guinapster anyone?
>
>Too specialized. We need a stable, general protocol. How about
>RATT? Remote Alcohol Tap Transport?

You could just set up a FreeBeer node and put the pints of Guinness on
it.  Anyone who wants one would yell for it, and the pints would get
passed between adjacent nodes until they reached the people who asked
for them.

Such a system would minimize the distance anyone would have to carry the
pints, and eliminate any central location where the network could be
compromised if someone, say, passed out, or stumbled while carrying the
beers.  The disadvantage would be that, due to transmission losses, the
pints would be likely to arrive empty.

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
"Suck Different"                         -- Graham Reed in the monastery

Please ignore Godzilla / Kira -- do not feed the troll.


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

Date: Wed, 07 Mar 2001 19:39:28 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: pi day
Message-Id: <tad3jg2al0k72f@corp.supernews.com>

In article <3aa563ec.1883792@news1.eircom.net>,
    John McNamara <jmcnamara@cpan.org> wrote:

: Ar 6 Mar 2001 07:03:41 -0000, do scriobh Jonathan Stowe
: <gellyfish@gellyfish.com>:
:
: >I didnt think there was an implementation of the Network Guinness Transport
: >Protocol yet.
: 
: Guinapster anyone?

As *if* it isn't already hard enough to get work done! :-)

Greg
-- 
Sometimes nothing can be a pretty cool hand.
    -- Cool Hand Luke


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

Date: Wed, 07 Mar 2001 23:01:34 GMT
From: jmcnamara@cpan.org (John McNamara)
Subject: Re: pi day
Message-Id: <3aa6bcd1.393448@news1.eircom.net>

Ar 7 Mar 2001 19:36:53 GMT, do scriobh Ilmari Karonen:

>You could just set up a FreeBeer node and put the pints of Guinness on
>it.  Anyone who wants one would yell for it, and the pints would get
>passed between adjacent nodes until they reached the people who asked
>for them.

P2P, pints to people.

My grandfather said that Guinness was never the same after they
stopped delivering it by barge: too much shaking on those lorries. ;-)

John.
-- 



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

Date: Wed, 07 Mar 2001 14:01:12 -0500
From: Jim Agnew <agnew@hsc.vcu.edu>
Subject: Re: PostgreSQL vs MySQL
Message-Id: <3AA68578.4614B8A5@hsc.vcu.edu>

Not really...  Choice of a database is one of the biggest concerns in designing a well-written system..  What do YOU use?

j.

Jon Ericson wrote:
> 
> "Aaron Cline" <acline@okstateerasecaps.edu> writes:
> 
> >       3.  Perl's ease of integration (as far as I know this is about the same
> > for both database's because of DBI).
> 
> Yep, and this is the only part of this post that is on-topic.
> 
> Jon


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

Date: 07 Mar 2001 21:24:37 +0000
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: PostgreSQL vs MySQL
Message-Id: <86snkpe0h6.fsf@jon_ericson.jpl.nasa.gov>

[rearranged quoting order]

Jim Agnew <agnew@hsc.vcu.edu> writes:

> Jon Ericson wrote:
> > 
> > "Aaron Cline" <acline@okstateerasecaps.edu> writes:
> > 
> > >       3.  Perl's ease of integration (as far as I know this is
> > >       about the same for both database's because of DBI).
> > 
> > Yep, and this is the only part of this post that is on-topic.

> Not really...  Choice of a database is one of the biggest concerns
> in designing a well-written system..  What do YOU use?

Yes really.  This is a _Perl_ newsgroup.  Thanks to DBI, Perl plays
with most databases on nearly equal footing.  There are other forums
for discussing the choice between database system.  I'm sure that you
will get more informed opinions there.  This is the same reason choice
of operating system, editor, web server, and breakfast cereal are more
or less _off-topic_ here.

(Even more off-topic, but I use DBD::RAM.  Was that relevant?)

Jon


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

Date: 07 Mar 2001 14:26:04 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: print abstract ('blah'); # subroutine or file handle?
Message-Id: <aWvp6.1492$887.68804@news3.atl>

rgarciasuarez@free.fr (Rafael Garcia-Suarez) writes:

> Alexander Farber (EED) wrote in comp.lang.perl.misc:
> > Hi,
> > 
> > I've this question actually since so long 
> > time, that I am already used to write:
> > 
> >   print &abstract ('blah');
> > 
> > if I have a subroutine called "abstract"...
> > 
> > But if I omit the &, will perl see it as 
> > subroutine name of as file handle? Like:
> > 
> >   print abstract ('blah');
> 
> Just try it :
> 
>   $ perl -Mstrict -wle 'sub STDOUT {$_[0]+1} print STDOUT 1'

Also try :

  % perl -Mstrict -wle 'print STDERR (1); sub STDERR {$_[0]+1}'
  % perl -Mstrict -wle 'print STDERR(1);  sub STDERR {$_[0]+1}'
  % perl -Mstrict -wle 'sub STDERR; print STDERR (1); sub STDERR{$_[0]+1}'

-- 
Joe Schaefer       "The man who sets out to carry a cat by its tail learns
                something that will always be useful and which never will grow
                                      dim or doubtful."
                                               --Mark Twain


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

Date: Wed, 07 Mar 2001 19:15:45 GMT
From: Philip Yuson <pyuson@yahoo.com>
Subject: Re: PWS and Perl
Message-Id: <20010307.19154566@mis.configured.host>

Have you checked the directory of your cgi-bin as defined in PWS. I=20
got into this problem and found out that the cgi-bin was pointing to=20=

another directory and not to the diretory where the script is.

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=

Philip Yuson
Concept Solutions Corporation=20
http://www.conceptsolutionsbc.com

Contributing Editor - Perl
http://www.suite101.com/welcome.cfm/perl

Author: Getting Started with Perl
http://www.selfhelpguides.com

>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 2/27/01, 9:30:12 AM, Mark <mark_shutt@hotmail.com> wrote regarding=20=

PWS and Perl:


> I am trying to run MS Personal Web Server on Win98 and run Perl CGI
> scripts. I have my registry correct to execute Perl, but it still=20
isn't
> working. I am getting a "the page cannot be displayed" error. I am
> browsing the directory so it is definately there..and the script=20
executes
> fine (a simple print statement with HTML headers) on a different web
> server. Does anyone know what may be missing? What needs to be done to=

> ensure proper installation of MS PWS and ActivePerl?

> Thanks.

> Mark

> --
> Posted via CNET Help.com
> http://www.help.com/





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

Date: 07 Mar 2001 21:05:07 +0000
From: nobull@mail.com
Subject: Re: Reading a file
Message-Id: <u9puftl27w.fsf@wcl-l.bham.ac.uk>

Shazad Iqbal <iqbals8@cs.man.ac.uk> writes:

> Subject: Reading a file

Question has nothing to do with reading files.  (It had to do with
_parsing_ which is something altogether different).

> I am trying to extract all the vital details from a file usinf regular
> expressions. I cant seem to get the hang of the matching clauses.

You are forgetting that the * qualifier is by default greedy.

You are forgetting that the ? qualifier exists.

You are probably being too stict in your regex - if you assume your
data is going to conform to the correct format you dont need to spell
it out - e.g. say (\d+) rather than (\d{2}) if there's no chance that
the next character is going to be a digit.

You also appear to be trying to solve a problem without specifying it first.

You must first be able to describe the syntax of your data
unabiguously before you try to write a program to parse it.

Although your file format _may_ be parseable by a single m// operator
this may not be the best approach if you are optomising for maintainabiliy.

You also seem to use pattern match to test string equality - one of
the cardinal Perl sins.

> #!/opt/perl/bin/perl -w
> use strict;

Very good.
 
> my ( 
>       $PRINCIPLE_GROUP,
>       $EXAMPLE_CLASSES_OR_LAB,
>       $USERNAME,
>       $MODULES,
>       @PRINCIPLE_GROUP,
>       @EXAMPLE_CLASSES_OR_LAB,
>       @USERNAME,
>       @MODULES,
>       $index );

If you feel the need to declare a lot of variables in one place this
is should be taken as a warning sign.  Rather than using a lot of
paralell arrays I think a hash of hashes would be the more natual structure.

> # Group/              Example Clases
> Username Modules
> # Y/1112E=Th15a,1412=W,1412E=Th15b,MT1662E=Mo16,Unix12=S1	akrami0	 1011
> 1021 1031 1041 1052 1062 1072 1112 1211 1311 1412 MT1662
> # ABIS	brodiejx	 1511 1522 1532
> # W/1112E=Tu10a,Unix12=S1	brownea0	 1011 1021 1031 1041 1052 1062 1072
> 1112 1211 1222 1311 MT1672

I really can't understand that - I thought I'd got it but I can't
believe you run Unix example classes at 1am on Saturday...

OK lets take it nice and easy rather than running at it headlong.

#!/usr/bin/perl
use strict;
use warnings;

my %user_info;

sub some_function_of ($) {
    # I can't guess the syntax of the class list
    @_;
}

while (<DATA>) {
    chomp;
    my ($group,$user,@modules) = split /\s+/;
    next unless defined $user;

    my @classes;
    if ( $group =~ s/\/(.*)// ) {
	@classes = some_function_of($1);
    }	

    $user_info{$user} = {
	Group => $group,
	Classes => \@classes,
	Modules => \@modules,
    };
}
close DATA;

print "what is your username ?\n\n";
my $user = <STDIN>;
chomp $user;

print "Your username is $user\n";

if ( my $u = $user_info{$user} ) {
    print " the module he/she does are @{$u->{Modules}}, in group $u->{Group}.\n";
} else {
    print "You have not typed in an incorrect username\n";
}

__DATA__
Y/1112E=Th15a,1412=W,1412E=Th15b,MT1662E=Mo16,Unix12=S1	akrami0	 1011 1021 1031 1041 1052 1062 1072 1112 1211 1311 1412 MT1662
ABIS	brodiejx	 1511 1522 1532
W/1112E=Tu10a,Unix12=S1	brownea0	 1011 1021 1031 1041 1052 1062 1072 1112 1211 1222 1311 MT1672
__END__

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

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 V10 Issue 438
**************************************


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