[18812] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 980 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 24 21:06:20 2001

Date: Thu, 24 May 2001 18:05:14 -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: <990752713-v10-i980@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 24 May 2001     Volume: 10 Number: 980

Today's topics:
        ANNOUNCE: YAPC Lightning Talk deadline only one week aw (Mark Jason Dominus)
    Re: Array slice: how about the remainder? <mischief@velma.motion.net>
    Re: Array slice: how about the remainder? <mischief@velma.motion.net>
    Re: Array slice: how about the remainder? <ren@tivoli.com>
    Re: Calling function reference <kris.verbeeck@chello.be>
    Re: Calling function reference <ren@tivoli.com>
    Re: Calling function reference <uri@sysarch.com>
        Converting spaces to plus signs <kenphilbrick@mindspring.com>
    Re: Converting spaces to plus signs <tony_curtis32@yahoo.com>
    Re: Converting spaces to plus signs (Jim Cochrane)
    Re: Converting spaces to plus signs <godzilla@stomp.stomp.tokyo>
    Re: Converting spaces to plus signs <xris@dont.send.spam>
    Re: Converting spaces to plus signs <juex@my-deja.com>
    Re: date question <ren@tivoli.com>
    Re: dbi, fork and ipc-shareable - having problems <uri@sysarch.com>
    Re: Function renaming and arguments replacing in c sour <dball@bnb-lp.com>
    Re: Hash reference and copying (Eric Bohlman)
    Re: Hash reference and copying <mischief@velma.motion.net>
    Re: How to install perl modules as local user <tdyboc@insight.rr.com>
    Re: looping through text to get info (Gary)
        Options for handling a configuration file <somewhere@in.paradise.net>
    Re: parsing perl again (Randal L. Schwartz)
    Re: Permuting days of the week (James Weisberg)
        Problem building Perl <pumuckl666@t-online.de>
    Re: Problem building Perl <andy@wood7.fsbusiness.co.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 24 May 2001 22:43:27 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: ANNOUNCE: YAPC Lightning Talk deadline only one week away
Message-Id: <3b0d8e8e.7b3$2ba@news.op.net>

May 31 is the deadline for submitting proposals for the lightning
talks session at YAPC 2001 in Montreal.  That is one week from today.

To submit, send the title and a description of not more than four sentences to:

        mjd-yapc-lightning+@plover.com

Lightning talks are five minutes long and may be on any topic whatsoever.

For complete information, please visit:

        http://perl.plover.com/lightning-talks.html     (English)
        http://perl.plover.com/lightning-talks.fr.html  (Francais)


Mark-Jason Dominus 	  			                 mjd@plover.com


-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Thu, 24 May 2001 22:54:54 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Array slice: how about the remainder?
Message-Id: <tgr49utne9tm36@corp.supernews.com>

John W. Krahn <krahnj@acm.org> wrote:
> Chris Stith wrote:
>> 
>> > John W. Krahn wrote:

[snip]

> $ perl -v

> This is perl, version 5.005_03 built for i586-linux

[snip]

> From the two_loops code that you posted the other day.

[snip]

> my $vec = 0;

s/ = 0;$/;/; # should fix weird problem

[snip]

> You will notice that the element "AE" does not show up in either array.

s/ = 0;/;/; # applied to q{my $vec = 0;} should fix that

Would someone please explain to me why zeroing out a scalar before
using it as a bit vector causes this odd behavior in 5.5.3 and 5.6.0?
This is counterintuitive.

On another note, you still said that neither of my posted methods
worked. My other method was misimplemented due to my mistaken
memory and the !DWIM nature of q{keys} on the LHS.

This version of the same algorithm will be slightly faster
and will pass your test:

    my @stay_home;
    my %chosen;
    $chosen{$_} = 1 for @go_picnic;
    for( @array ) {
        unless( exists( $chosen{$_} ) ) {
            push @stay_home, $_;
        }
    }

Here's what I meant to do originally, but I was mislead by lack
of sleep (this is also slightly faster, but not as much as the
above):

    @stay_home = ();
    my %chosen;
    %chosen = map { $_, undef } @go_picnic;
    for( @array ) {
        unless( exists( $chosen{$_} ) ) {
            push @stay_home, $_;
        }
    }

There you go. I'd still like to see where some of the others
failed. ;-)

Chris

-- 
You can never entirely stop being what you once were. That's
why it's important to be the right person today, and not put
it off till tomorrow. -- Larry Wall, 3rd State of the Onion



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

Date: Thu, 24 May 2001 23:19:57 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Array slice: how about the remainder?
Message-Id: <tgr5ot2re0dte5@corp.supernews.com>

John Lin <johnlin@chttl.com.tw> wrote:
> Dear all,

> I've been asked a quite interesting question.

BTW, I was nosing around in the docs today, and I found out that
this is a FAQ.

$ perldoc -q intersection
=head1 Found in /usr/lib/perl5/5.00503/pod/perlfaq4.pod

=head2 How do I compute the difference of two arrays?  How do I
compute the intersection of two arrays?

Use a hash.  Here's code to do both and more.  It assumes that
each element is unique in a given array:

    @union = @intersection = @difference = ();
    %count = ();
    foreach $element (@array1, @array2) { $count{$element}++ }
    foreach $element (keys %count) {
        push @union, $element;
        push @{ $count{$element} > 1 ? \@intersection : \@difference },
            $element;
    }


Later,
Chris

-- 
Get real!  This is a discussion group, not a helpdesk. You post
something, we discuss its implications. If the discussion happens to
answer a question you've asked, that's incidental. -- nobull, clp.misc



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

Date: 24 May 2001 16:51:16 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Array slice: how about the remainder?
Message-Id: <m3bsoibeln.fsf@dhcp9-172.support.tivoli.com>

On Thu, 24 May 2001, krahnj@acm.org wrote:

> my @array = ( 'AA' .. 'DV' ); my @chosen = (0,3,5,7,21,35,63,66,68);
> print 'Size of @array = ', scalar @array, "\n\@array = @array\n";
> print 'Size of @chosen = ', scalar @chosen, "\n\@chosen =
> @chosen\n\n";
> 
> #sub two_loops {
> my @go_picnic = @array[ @chosen ];  # those who are chosen go picnic
> my @stay_home = ();
> my $vec = 0;

The problem is here.  It seems like a bug in Perl to me, but perhaps
I'm missing something and the behavior is intentional.  Anyway, when
vec() gets $vec containing 0, it doesn't really stringify it the way
one might expect.  $vec actually becomes the ord() value of 0, which
turns on positions 4 and 5.  Position 5 is included in your @chosen
array, but position 4 isn't.  Position 4 is "AE".

Removing the " = 0" from this line fixes the problem.

> for( @chosen ) {
>     vec( $vec, $_, 1) = 1;
>     }
> for( my $i = 0; $i < @array; $i++ ) {
>     unless( vec($vec, $i, 1) ) {
>         push @stay_home, $array[$i];
>         }
>     }
> print 'Size of @stay_home = ', scalar @stay_home, "\n\@stay_home =
> @stay_home\n";
> print 'Size of @go_picnic = ', scalar @go_picnic, "\n\@go_picnic =
> @go_picnic\n\n";
> #}
> __END__

-- 
Ren Maddox
ren@tivoli.com


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

Date: Thu, 24 May 2001 22:46:21 GMT
From: Kris Verbeeck <kris.verbeeck@chello.be>
Subject: Re: Calling function reference
Message-Id: <3B0D902F.58F3798E@chello.be>

Uri Guttman wrote:

>   >> so if that is the best solution, why did you even clear up his symref
>   >> problem?
> 
>   KV> I'm glad he cleared it up because the reference is defined as a string
>   KV> in a configuration file, i.e. symbolic reference
> 
> no, you can still do a dispatch table. you are not thinking clearly here.

With a dispatch table, you mean a mapping between a string and a hard
ref,
is that correct?  If so, then I would have to know which functions are
going to be called when I write the script and not when I run the
script.
What I'm working on only needs a text file that describes the behaviour
of the script through a set of rules.  The functions being called  here
can be anything.  Am I missing something here?
 
>   >> a dispatch table is very easy to create and use and is safe.
> 
>   KV> And need it to be much more dynamic than that.
> 
> and why is a symbolic ref more dynamic than hard refs for subs? you have
> not made any points for that argument.

What I meant is that a symbolic ref is more dynamic than a dispatch
table
(if I understand correctly what you mean with a dispatch table, that
is).
 
> you will eventually shoot yourself in the foot (or head) if you let sub
> calls be directly made with symrefs.

I don't need this script for something mission critical, just a small
tool that is general enough to be used in a variety of situations.


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

Date: 24 May 2001 17:54:35 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Calling function reference
Message-Id: <m33d9ubbo4.fsf@dhcp9-172.support.tivoli.com>

On Thu, 24 May 2001, kris.verbeeck@chello.be wrote:

> Uri Guttman wrote:
> 
>> no, you can still do a dispatch table. you are not thinking clearly
>> here.
> 
> With a dispatch table, you mean a mapping between a string and a
> hard ref, is that correct?  If so, then I would have to know which
> functions are going to be called when I write the script and not
> when I run the script.  What I'm working on only needs a text file
> that describes the behaviour of the script through a set of rules.
> The functions being called here can be anything.  Am I missing
> something here?

Where are the functions themselves defined?  Whenever a functions is
defined, it would also be added to the dispatch table.

-- 
Ren Maddox
ren@tivoli.com


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

Date: Thu, 24 May 2001 23:26:30 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Calling function reference
Message-Id: <x7y9rm2us8.fsf@home.sysarch.com>

>>>>> "RM" == Ren Maddox <ren@tivoli.com> writes:

  RM> On Thu, 24 May 2001, kris.verbeeck@chello.be wrote:
  >> Uri Guttman wrote:
  >> 
  >>> no, you can still do a dispatch table. you are not thinking clearly
  >>> here.
  >> 
  >> With a dispatch table, you mean a mapping between a string and a
  >> hard ref, is that correct?  If so, then I would have to know which
  >> functions are going to be called when I write the script and not
  >> when I run the script.  What I'm working on only needs a text file
  >> that describes the behaviour of the script through a set of rules.
  >> The functions being called here can be anything.  Am I missing
  >> something here?

  RM> Where are the functions themselves defined?  Whenever a functions is
  RM> defined, it would also be added to the dispatch table.

what he said.

there is no good reason to use symrefs vs. a dispatch table. you can
write config code that add entries the table when modules are loaded.

another solution is to make the subs into class methods and then look
them up with can() and call them.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


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

Date: Thu, 24 May 2001 20:05:00 -0400
From: Ken Philbrick <kenphilbrick@mindspring.com>
Subject: Converting spaces to plus signs
Message-Id: <3B0DA1AC.D0B73D85@mindspring.com>

I have some strings that contain spaces, but I'd like to convert all the
spaces into plus signs.  I've tried various methods using split and
join, but nothing has worked.  The FAQ on perl.com doesn't seem to
mention anything about it either.  Any ideas?

-- 
Ken


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

Date: 24 May 2001 19:16:26 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Converting spaces to plus signs
Message-Id: <87u22affl1.fsf@limey.hpcc.uh.edu>

>> On Thu, 24 May 2001 20:05:00 -0400,
>> Ken Philbrick <kenphilbrick@mindspring.com> said:

> I have some strings that contain spaces, but I'd like to
> convert all the spaces into plus signs.  I've tried
> various methods using split and join, but nothing has
> worked.  The FAQ on perl.com doesn't seem to mention
> anything about it either.  Any ideas?

perldoc -f tr

Or is this really a CGI question in disguise?  If so, some
more details might identify other interesting solutions.

hth
t
-- 
Just reach into these holes.  I use a carrot.


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

Date: 24 May 2001 18:24:20 -0600
From: jtc@dimensional.com (Jim Cochrane)
Subject: Re: Converting spaces to plus signs
Message-Id: <9ek8nk$91n@flatland.dimensional.com>

In article <87u22affl1.fsf@limey.hpcc.uh.edu>,
Tony Curtis  <tony_curtis32@yahoo.com> wrote:
>>> On Thu, 24 May 2001 20:05:00 -0400,
>>> Ken Philbrick <kenphilbrick@mindspring.com> said:
>
>> I have some strings that contain spaces, but I'd like to
>> convert all the spaces into plus signs.  I've tried
>> various methods using split and join, but nothing has
>> worked.  The FAQ on perl.com doesn't seem to mention
>> anything about it either.  Any ideas?
>
>perldoc -f tr

Or something like:

$string =~ s/ /+/g;


>
>Or is this really a CGI question in disguise?  If so, some
>more details might identify other interesting solutions.
>
>hth
>t
>-- 
>Just reach into these holes.  I use a carrot.


-- 
Jim Cochrane
jtc@dimensional.com


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

Date: Thu, 24 May 2001 17:27:10 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Converting spaces to plus signs
Message-Id: <3B0DA6DE.EE35D3B3@stomp.stomp.tokyo>

Ken Philbrick wrote:
 
> I have some strings that contain spaces, but I'd like to convert all the
> spaces into plus signs.  I've tried various methods using split and
> join, but nothing has worked.  The FAQ on perl.com doesn't seem to
> mention anything about it either.  Any ideas?

Have you considered using transliteration or substitution
to change spaces to plus signs? This would be logical.

Godzilla!


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

Date: Thu, 24 May 2001 19:43:09 -0500
From: xris <xris@dont.send.spam>
Subject: Re: Converting spaces to plus signs
Message-Id: <xris-85D73D.19430824052001@news.evergo.net>

In article <3B0DA1AC.D0B73D85@mindspring.com>,
 Ken Philbrick <kenphilbrick@mindspring.com> wrote:

> I have some strings that contain spaces, but I'd like to convert all the
> spaces into plus signs.  I've tried various methods using split and
> join, but nothing has worked.  The FAQ on perl.com doesn't seem to
> mention anything about it either.  Any ideas?

If you're trying to URL-encode strings, you need to do more than just 
convert spaces to plusses...  there's something about this in the perl 
faq, but since people sometimes just want answers, try:

$str =~ s/([^\w*\.\-&=])/$1 eq ' ' ? '+' : sprintf '%%%02x', ord $1/sge;



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

Date: Thu, 24 May 2001 17:56:51 -0700
From: "Jürgen Exner" <juex@my-deja.com>
Subject: Re: Converting spaces to plus signs
Message-Id: <3b0dadcb@news.microsoft.com>

"Ken Philbrick" <kenphilbrick@mindspring.com> wrote in message
news:3B0DA1AC.D0B73D85@mindspring.com...
> I have some strings that contain spaces, but I'd like to convert all the
> spaces into plus signs.  I've tried various methods using split and
> join, but nothing has worked.  The FAQ on perl.com doesn't seem to
> mention anything about it either.  Any ideas?

Slow method: s/ /+/g
Faster method: tr/ /+/

jue




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

Date: 24 May 2001 16:14:54 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: date question
Message-Id: <m3g0dubga9.fsf@dhcp9-172.support.tivoli.com>

On Thu, 24 May 2001, CalinG@cfgroup.ca wrote:

> Does anybody know how to convert a date in Perl, for ex. 01/01/2001
> and to tell what day of the week that was(like Monday...Sunday)?

$ perl -MTime::Local -le 'my($m,$d,$y)=split m{/},shift;print qw/Sunday Monday Tuesday Wednesday Thursday Friday Saturday/[(localtime timelocal 0,0,0,$d,$m-1,$y)[6]]' 01/01/2001
Monday

perldoc -f localtime
perldoc Time::Local

-- 
Ren Maddox
ren@tivoli.com


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

Date: Thu, 24 May 2001 23:40:21 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: dbi, fork and ipc-shareable - having problems
Message-Id: <x7r8xe2u57.fsf@home.sysarch.com>

>>>>> "S" == Sunray  <djberge@uswest.com> writes:

  S> The problem seems to be with the shared memory objects.  Either the
  S> array of results grows each time I run the program or else I get "Can't
  S> use an undefined value as an ARRAY reference at
  S> /usr/local/lib/perl5/site_perl/5.6.0/IPC/Shareable.pm line 446, <GEN1>
  S> chunk whatever".

  S> WARNING - be prepared to use 'ipcs' and 'ipcrm' if you want to play with
  S> this script!  You may have stray memory objects floating around
  S> afterwards.

you should add cleanup code in an END block or exit handler to deal with
that.

  S> my($dbh, $sth, @results, @allRecords);

  S> my $if = IO::File->new(SQLFILE) or die "Couldn't open file: $!\n";

SQLFILE is a bareword. it should be quoted.

  S> # I am not entirely sure what the proper settings for these should be.
  S> # I've tried various combinations with no (or bad) luck
  S> my $glue = 'data';
  S> my %options = (create => 'yes', exclusive => 0, mode => 0644)
  S> tie @allRecords, 'IPC::Shareable', $glue, { %options } or die "Tie
  S> failed: $!\n";

  S> $/ = "";  # We're going to read each 'select' statement as an input
  S> record
  S> while(my $query = <$if>){
  S>    chomp($query);

  S>    my $child = fork();
  S>    die "Can't fork: $!\n" unless defined $child;

  S>    if($child == 0){

  S>         # Not sure if I need 'InactiveDestroy' here or not
  S>         $dbh = DBI->connect(DB,USER,PASSWD,DRIVER,
  S>             {RaiseError=>1,PrintError=>1,InactiveDestroy=>1}
  S>         );

  S>         $sth = $dbh->prepare($query);
  S>         $sth->execute();
  S>         while( my $hash_ref = $sth->fetchrow_hashref() ){
  S>             push(@results, $hash_ref);
  S>         }

  S>         #+++++++++++++++++++++++++++++++++++++++++++++
  S>         # '@allRecords' should contain a reference to an array of hash
  S>         # reference for each select statement (thus, four total).
  S>         #+++++++++++++++++++++++++++++++++++++++++++++
  S>         push(@allRecords, \@results);

think about this. you are trying to share a reference from one program
to another. think again. you can't do it. refs are based on pointers to
a given programs' address space. that is not something that is
guaranteed to be the same in another program space. also who knows what
IPC::Sharable is doing to that ref such as stringifying it.

save the data instead and not array refs.

another solution is to use pipes and multiplexes i/o such as Event.pm,
IO::Select, Stem or POE. shared memory is a pain.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


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

Date: Thu, 24 May 2001 15:34:45 -0700
From: David Ball <dball@bnb-lp.com>
Subject: Re: Function renaming and arguments replacing in c source code
Message-Id: <g13rgt0v6clvpvled0fi8o57570q2ks325@4ax.com>

On Tue, 22 May 2001 00:51:01 +0000 (UTC), abigail@foad.org (Abigail)
wrote:

>Federico Hernandez (federico@carmen.se) wrote on MMDCCCXX September
>MCMXCIII in <URL:news:rw4ruesw2a.fsf@gibraltar.carmen.se>:
>[]  Hi,
>[]  
>[]  I was wondering if there is some perl based script around that can be
>[]  used to rename functions and replace arguments in c source code?
>
>
>IIRC, Damian has made C parser.
>
>
>Abigail

Hey Abigail. Why did you respond in a helpful manner to this post,
but do your net-nazi routine when I asked about scripts that search
websites.

-- David




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

Date: 24 May 2001 23:40:52 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Hash reference and copying
Message-Id: <9ek664$g8h$2@bob.news.rcn.net>

Chris Stith <mischief@velma.motion.net> wrote:
> Others have shown you how to do this using symbolic references,
> which are no stricture clean nor recommended practice.

> Try this:
>     my %result = %{ $hash_ref };

Unless our two newsfeeds are badly out of sync, I haven't seen anybody in 
this thread suggest symrefs; in fact they've all said the same thing you 
did, just without the curly braces (which aren't syntactically required in 
this case).



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

Date: Thu, 24 May 2001 23:57:26 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Hash reference and copying
Message-Id: <tgr7v6heidi8e4@corp.supernews.com>

Eric Bohlman <ebohlman@omsdev.com> wrote:
> Chris Stith <mischief@velma.motion.net> wrote:
>> Others have shown you how to do this using symbolic references,
>> which are no stricture clean nor recommended practice.

>> Try this:
>>     my %result = %{ $hash_ref };

> Unless our two newsfeeds are badly out of sync, I haven't seen anybody in 
> this thread suggest symrefs; in fact they've all said the same thing you 
> did, just without the curly braces (which aren't syntactically required in 
> this case).

Yes, sorry. My eyes deceived me, as those hard refs without the
optional curlies start to _look_ like symrefs towards the end of
the day. I should have read more closely.

Carry on... There's nothing to see here.

Chris

-- 
For the pleasure of others, please adhere to the following
rules when visiting your park:
    No swimming.  No fishing.  No flying kites.  No frisbees.
    No audio equipment. Stay off grass.  No pets. No running.



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

Date: Thu, 24 May 2001 17:22:24 -0400
From: "Sparky" <tdyboc@insight.rr.com>
Subject: Re: How to install perl modules as local user
Message-Id: <9eju2302aub@enews1.newsguy.com>

I followed those instructions from "perldoc" and got mine to work
successfully.  I just didn't run the "make install".  In the PERL script I
stated somthing like "use lib /my_module_path ..." and it worked.

Anybody, how can you run "make install" not as root?

"Eric Smith" <eric@fruitcom.com> wrote in message
news:slrn9gqasb.3sm.eric@apple.fruitcom.com...
> Todd Smith posted
>  > Just put the directory in your home directory, where your scripts can
find
>  > it in @INC. It should work.
>  >
>  > /home/you/Date/Manip.pm
>
> Yes, but that does not include the documentation, is prone to error and is
> complicated when there are compiled files as well.
>
> Only thing I dug up from RTFM:
>
> How do I keep my own module/library
> directory?
>
> When you build modules, use the PREFIX option when generating
> Makefiles:
>
>     perl Makefile.PL PREFIX=/u/mydir/perl
>
> But this did not work as it only put that prefix on some of the install
> dirs and not all so on 'make install' I got a permission denied.
>
> This should be a real single step simple thing to do.




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

Date: 24 May 2001 15:09:03 -0700
From: grobitaille@mail.com (Gary)
Subject: Re: looping through text to get info
Message-Id: <a2051d6.0105241409.73c57038@posting.google.com>

"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message news:<3B0D31D7.FF3961B7@stomp.stomp.tokyo>...
> Gary wrote:
>  
> > I have a text file that looks like this:
>  
> > Database Name : database1
> 
> 
> (snipped)
> 
> I am curious to know what software produces
> this database.
> 
> Godzilla!
The database is SYBASE and the textfile is output from a DBCC command


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

Date: Fri, 25 May 2001 10:34:53 +1000
From: "Tintin" <somewhere@in.paradise.net>
Subject: Options for handling a configuration file
Message-Id: <RMhP6.7$zG3.149570@news.interact.net.au>

I'm looking at various options for handling a configuration file and would
like some opinions.

My config file looks something like:

$base='/home/fred/html';
$logdir="$base/logs";
$reportdir="$base/logs";

etc

I have a CGI script to edit the configuration file.  At the moment, I'm just
doing something like:

require "config.pl";

print $query->textfield(-name=>'logdir',
                           -default=>$logdir);

The problem is that all of the variables that use $base will be expanded, so
to update the base location, requires updating *every* variable.

I was thinking that it would be better to ensure the variables don't expand,
ie:

$logdir will be displayed at $base/logs rather than /home/fred/html/logs

At this stage, I'm not keen to change the format of the configuration file,
but if that is my only option, then I'll do it.

Ideas?





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

Date: 24 May 2001 17:33:38 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: parsing perl again
Message-Id: <m1ofsi468t.fsf@halfdome.holdit.com>

>>>>> "Damian" == Damian Conway <damian@cs.monash.edu.au> writes:

>> P.S. I take it this implies your belief that RecDescent is capable of 
>> performing the monsterous task?  

Damian> Not as it stands. But a new version of RecDescent is also on
Damian> the ToDo list!

Will the new version of RecDescent implement Perl6, Solve the Halting
Problem, or be self-aware?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Thu, 24 May 2001 22:49:47 GMT
From: chadbour@wwa.com (James Weisberg)
Subject: Re: Permuting days of the week
Message-Id: <fegP6.6452$DW1.289394@iad-read.news.verio.net>

In article <m1r8xfes9w.fsf@halfdome.holdit.com>,
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>In fact, it was such a good problem that I turned it into my next
>SysAdmin Magazine Perl column!  Thanks for the inspiration.
>
>Still smells of being a homework problem though.

   I take umbrage at having this called a "homework problem". I'm simply
curious how others might tackle it. You can mend a bruised ego by emailing
or posting a copy of your article.

   Here's my [tricky] solution:

   The endpoints are split into @r and the range is spliced into the middle.
The code forces two copies of the final endpoint to appear in @r, but it gets
popped off; though as a side effect, "Mon-Mon" returns "Mon" and a single day
without a range returns that day.

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

my %w = (Sun=>Mon,Mon=>Tue,Tue=>Wed,Wed=>Thu,Thu=>Fri,Fri=>Sat,Sat=>Sun);
my @r = split(/-/, shift);

for(my $d = $r[0]; $d ne $r[-1];) {
   splice(@r,$#r,0,$d = $w{$d});
}  pop @r if $#r;

print join ',', @r;
print "\n";

-- 
World's Greatest Living Poster


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

Date: Fri, 25 May 2001 01:22:43 +0200
From: Peter Schmitt <pumuckl666@t-online.de>
Subject: Problem building Perl
Message-Id: <c15rgtcsgvkpaso96s0orqlf9gtr331b4e@4ax.com>

hi,

i need threads in my perl on win98se. As the binary distributions i've
found so far don't have thread support i need to build perl from the
sources.

But it doesn't work. :-(

Perl Version: 5.6.1-1 (downloaded with cygwin installer)
GCC Version: gcc version 2.95.3-4 (cygwin special)

make produces nearly the same output as sample log from cygwin.
but it halts before printing the last few lines:

----lines from sample log that are missing

make[1]: Leaving directory `/src/cygwin-perl/perl-5.6.1-1/ext/Errno'
 
	Everything is up to date. 'make test' to run test suite.
---


make test halts before performing the actual tests:

---last line before make test halts
base/cond............
----

make install only prints out the following:
---output make install
GNUmakefile:244: warning: overriding commands for target `perlmain.o'
GNUmakefile:186: warning: ignoring old commands for target
`perlmain.o'
make: `install' is up to date
---

what do i do wrong?

Thanks,
Peter




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

Date: Fri, 25 May 2001 00:25:07 +0100
From: "Andrew Wood" <andy@wood7.fsbusiness.co.uk>
Subject: Re: Problem building Perl
Message-Id: <9ek5dv$a8s$1@news8.svr.pol.co.uk>

Try Activestate's version of Perl for Windows - it's easy

www.activestate.com


Regards
Andy


Peter Schmitt <pumuckl666@t-online.de> wrote in message
news:c15rgtcsgvkpaso96s0orqlf9gtr331b4e@4ax.com...
> hi,
>
> i need threads in my perl on win98se. As the binary distributions i've
> found so far don't have thread support i need to build perl from the
> sources.
>
> But it doesn't work. :-(
>
> Perl Version: 5.6.1-1 (downloaded with cygwin installer)
> GCC Version: gcc version 2.95.3-4 (cygwin special)
>
> make produces nearly the same output as sample log from cygwin.
> but it halts before printing the last few lines:
>
> ----lines from sample log that are missing
>
> make[1]: Leaving directory `/src/cygwin-perl/perl-5.6.1-1/ext/Errno'
>
> Everything is up to date. 'make test' to run test suite.
> ---
>
>
> make test halts before performing the actual tests:
>
> ---last line before make test halts
> base/cond............
> ----
>
> make install only prints out the following:
> ---output make install
> GNUmakefile:244: warning: overriding commands for target `perlmain.o'
> GNUmakefile:186: warning: ignoring old commands for target
> `perlmain.o'
> make: `install' is up to date
> ---
>
> what do i do wrong?
>
> Thanks,
> Peter
>
>




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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 980
**************************************


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