[16063] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3475 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 25 14:05:26 2000

Date: Sun, 25 Jun 2000 11:05:11 -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: <961956311-v9-i3475@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 25 Jun 2000     Volume: 9 Number: 3475

Today's topics:
        C prog access to dbi? <cpcapps@erols.com>
    Re: C prog access to dbi? <billy@arnis-bsl.com>
    Re: Can a regex pick out a domain name from a line of t (Keith Calvert Ivey)
    Re: Concatenating with join() (Steven Smolinski)
    Re: Encryption <rootbeer@redcat.com>
    Re: filehandle <-> filename <juex@deja.com>
    Re: Get cgi url markqian@my-deja.com
    Re: Get the matched position in regexp (Tad McClellan)
    Re: Get the matched position in regexp <billy@arnis-bsl.com>
    Re: How to measure time to milliseconds inside perl scr <billy@arnis-bsl.com>
    Re: Is there a dos htm enviroment for perl ? <smile773@bigfoot.com>
        Java + Perl on Solaris <almarn@videotron.ca>
    Re: Need app to generate perl for windows <smile773@bigfoot.com>
    Re: Newbie qn: scope of Dir (file?) handles. nobull@mail.com
        newbie question from Learning Perl--help me debug this <kokopuff@cukezone.com>
        Newsgroup question (Ghengis 76)
    Re: Newsgroup question <rootbeer@redcat.com>
    Re: OpenFile then Chomp <bernie@fantasyfarm.com>
    Re: perl + dll <carvdawg@patriot.net>
    Re: Perl Programming Style Question (Andrew Johnson)
    Re: Perl2Exe Problem <rootbeer@redcat.com>
    Re: Problem installing CPAN Date::Calc <mandersjones@my-deja.com>
    Re: Quick "Perl Way" solution needed (Bart Lateur)
    Re: Quick "Perl Way" solution needed <jjchew@math.utoronto.ca>
    Re: Redirecting <rootbeer@redcat.com>
    Re: Repeated regex matching. (Tad McClellan)
    Re: return by value <abe@ztreet.demon.nl>
        test for membership in an array? iwelch@my-deja.com
    Re: test for membership in an array? (Leon Brocard)
    Re: test for membership in an array? <billy@arnis-bsl.com>
    Re: Urgent help with non-blocking child process require salim@cygnos.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 25 Jun 2000 11:28:31 -0400
From: cc <cpcapps@erols.com>
Subject: C prog access to dbi?
Message-Id: <3956251F.25DC0D31@erols.com>

Does anyone know how to call dbi from a C program.  We want to
distribute binaries and source.  Actually, we wrote the whole system in
java and the performance is not acceptable, so we are exploring the
possibility of writing a database io component in dbi.  We want to
distribute binaries if possible to simplify installation.  Ideas?

cc





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

Date: Sun, 25 Jun 2000 16:44:58 GMT
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: C prog access to dbi?
Message-Id: <8j5cu8$o8t$1@nnrp1.deja.com>

In article <3956251F.25DC0D31@erols.com>,
  cc <cpcapps@erols.com> wrote:
> Does anyone know how to call dbi from a C program.  We want to
> distribute binaries and source.  Actually, we wrote the whole system
in
> java and the performance is not acceptable, so we are exploring the
> possibility of writing a database io component in dbi.  We want to
> distribute binaries if possible to simplify installation.  Ideas?
>

Hm-m, you mentioned Java and C, not Perl.
So why need DBI (which is a Perl interface)
if you do not use Perl ?

AFAIK most database engines have a C client library
and corresponding #include files. Just use them
from your C program and get the job done.

Hope this helps.
Ilja.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 25 Jun 2000 15:19:39 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Can a regex pick out a domain name from a line of text?
Message-Id: <39561874.87303736@nntp.idsonline.com>

"Robert Chalmers" <robert@chalmers.com.au> wrote:

>Does anyone have a regex that can pick out a domain name
>from a line of text please.

It depends on exactly what you mean by "domain name" and how
strict you want to be.  If you mean a host name (as defined in
RFC 952 updated by RFC 1123), then something like this might
work, assuming the text is in $_:

    my @names =
        m{ \b              # a word boundary
           (?:             # followed by one or more groups of
             [a-z0-9]      # a letter or digit
             (?:           # possibly followed by
               [a-z0-9-]*  # letters, digits, and hyphens
               [a-z0-9]    # ending with a letter or digit
             )?
             \.            # a period
           )+
           (?:             # and then one of
             com |         # the 7 generic TLDs
             edu |         # (top-level domains)
             gov |
             int |
             mil |
             net |
             org |
             [a-z]{2}      # or a country code
           )
           \b              # a word boundary
         }gix;

Note that you don't want to use \w, because (aside from the
issue of locale) underscores aren't legal in domain names and
hyphens are.  Also, there's a bit of complication to disallow
hyphens at the beginning or end of any part of the name (Network
Solutions had a problem with that a few months back and
erroneously allowed people to register things like "e-.com").

You could include the whole list of valid country codes, but
then you'd have to keep updating it.  This regex has to be
updated only whenever ICANN decides to define new generic TLDs,
which is unlikely ever to happen because of the power of
trademark holders.

If you're trying to get just the second-level domain name (the
thing registered with the Internic), then you're going to have
to decide what to do about country-code TLDs, since different
countries organize their DNS hierarchies differently -- some are
deep and some are shallow.
-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


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

Date: Sun, 25 Jun 2000 14:32:46 GMT
From: sjs@yorku.ca (Steven Smolinski)
Subject: Re: Concatenating with join()
Message-Id: <slrn8lc5vj.75u.sjs@john.sympatico.ca>

Martin Julian DeMello <mdemello@pound.ruf.rice.edu> wrote:
>Abigail <abigail@delanet.com> wrote:

>> Because it was a DOS file, the line ended with a CR LF pair. You chomp()
>> the LF off, leaving a trailing CR at the end of $_. 
>>
>> So, print() prints $_, ending in a CR. And then your terminal driver does
>> what it's suppose to do on a CR: it returns the "carriage". But there's
>> no line feed. Hence, the " " . join ("", sort //) parts overwrites what
>> was already there.

>Ah! Thanks muchly - I've never actually thought about what a 'carriage
>return' implied; I always assumed the term was a leftover from the teletype
>era. 

It *is* a leftover from teletype machines.  But some certain OSes have 
retained it for the express purpose of making life harder :-)

Steve


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

Date: Sun, 25 Jun 2000 10:31:54 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Encryption
Message-Id: <Pine.GSO.4.10.10006251027490.23149-100000@user2.teleport.com>

On Sat, 24 Jun 2000, Jimmy Humphrey wrote:

> I made a very basic encryption tool in perl. 

For most of us, making our own encryption is a little like making your own
Prozac. :-)  But I'll ignore the question of whether your cryptographic
methods are effective or not....

> However, I noticed some problems.  For "some" .doc files, and such,
> the encryption tool seems to corrupt. I use pack("c") & unpack("c") to
> translate my strings into ASCII code. But for some reason, when I
> decrypt the message, on "some" .doc files, it makes them become
> corrupt. This program works with regular text files. Could anybody
> explain why this might happen? Using Win32 activestate perl (latest
> version).

Just a guess, but: binmode? If that's not it, you'll have to post at least
one line of code which isn't doing what you think it should. Ideally, you
should make a small, stand-alone program to post. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 25 Jun 2000 10:51:42 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: filehandle <-> filename
Message-Id: <395646af@news.microsoft.com>

"andreyw" <andreywNOanSPAM@altavista.net.invalid> wrote in message
news:10d173b5.ef3ac927@usw-ex0101-008.remarq.com...
> I have a filehandle (as a subroutine parameter).
> Is there a way to know a filename or other disk file id.

You are aware that there might not be a physical file attached to the file
handle int he first place (Which file is <STDIN> attached to? What if the
directory entry has been deleted after the file has been opened by your Perl
program?)?
Or not any more? Or that the same file might have multiple names?

jue




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

Date: Sun, 25 Jun 2000 10:23:00 GMT
From: markqian@my-deja.com
Subject: Re: Get cgi url
Message-Id: <8j4mi0$ab9$1@nnrp1.deja.com>

I found a simple way:

$ENV{'SERVER_URL'} . $ENV{'SCRIPT_NAME'};

thanks for all your help

Mark

In article <slrn8lbgi7.m7c.efflandt@efflandt.xnet.com>,
  efflandt@xnet.com wrote:
> On Sun, 25 Jun 2000, markqian@my-deja.com <markqian@my-deja.com>
wrote:
> >How can I get the url of the cgi?
> >
> >For example, if I run
> >
> >http://www.my-site.com/cgi-local/my-script.cgi?action=xxx
> >
> >How can I get
> >
> >http://www.my-site.com/cgi-local/my-script.cgi
> >
> >from the cgi?
>
> On a system with Perl type:  perldoc CGI
>
> #!/usr/bin/perl
> use CGI qw/:standard/;
> print header,start_html('URL Test'),
> "The URL of this script is ",url(),
> end_html;
>
> --
> David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
> http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
> http://hammer.prohosting.com/~cgi-wiz/
http://cgi-help.virtualave.net/
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 25 Jun 2000 09:54:49 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Get the matched position in regexp
Message-Id: <slrn8lc3p9.47e.tadmc@magna.metronet.com>

On Sun, 25 Jun 2000 16:16:30 +0800, multiplexor <abuse@localhost> wrote:
>Is it possible to get the position of the matched part in a string?
>For example:
>
>$_ = 'ABCDE';
>if (/C/) {
>    print "C is at the 3rd character".
>}
>
>How do I get the position of C in $_ ?


If you are looking for a constant string, rather than for
a pattern, (as you are above), then pattern matching is
not the Right Tool For the Job.


   perldoc -f index


   if ( (my $pos = index $_, 'X') >= 0 ) {
      print "C is at the $pos character\n";
   }


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sun, 25 Jun 2000 16:28:31 GMT
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: Get the matched position in regexp
Message-Id: <8j5bv3$nit$1@nnrp1.deja.com>

In article <8j4emg$jhs3@imsp212.netvigator.com>,
  "multiplexor" <abuse@localhost> wrote:
> Is it possible to get the position of the matched part in a string?
> For example:
>
> $_ = 'ABCDE';
> if (/C/) {
>     print "C is at the 3rd character".
> }
>

One of solutions:

$_ = 'abcd';
print 'Matched at ', length($`), "\n" if /c/;

or:

$_ = 'abcdeccxyzc';
print 'Matched at ', length($`), "\n" while /c/g;

Add 1 to length()'s result if you really want
to count characters in a string from 1 (as in yor exapmle).

Hope this helps.
Ilja.



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 25 Jun 2000 16:50:24 GMT
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: How to measure time to milliseconds inside perl script ?
Message-Id: <8j5d8d$ojs$1@nnrp1.deja.com>

In article <3956aef4.134106794@news.fuse.net>,
  bretten@fuse.net (MrSpoon) wrote:
> Hi, does anyone know a way to measure time inside a script to the
> millisecond ?
>

Check the FAQ: "How can I measure time under a second?"

The answer may be found in 'perldoc perlfaq8
or at http://www.cpan.org/doc/manual/html/pod/perlfaq8.html.

Hope this helps.
Ilja.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 25 Jun 2000 15:14:16 GMT
From: "smile773" <smile773@bigfoot.com>
Subject: Re: Is there a dos htm enviroment for perl ?
Message-Id: <clp55.437$kK.41578@bgtnsc05-news.ops.worldnet.att.net>

You must be mistaken. There is no uu  posted. Are you making a funny ?
searching under httpd for dos I found BOA  that should accept Perl cgi.

Jonathan Stowe <gellyfish@gellyfish.com> wrote in message
news:vup45.616$My4.59455@news.dircon.co.uk...
> On Thu, 22 Jun 2000 00:37:18 GMT, smile773 Wrote:
> >
> > begin 666 Xyzzy.pl
> > M(PT*(R!X>7IZ>2YP; T*(PT*(R!!('-I;7!L92!P<F]G<F%M('1O(&QE87)N
>
> Do not post uuencoded stuff to the newsgroup.  If you want people to look
> at it post a URL instead.
>
> /J\




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

Date: Sat, 24 Jun 2000 19:40:59 -0400
From: "Alain Maronani" <almarn@videotron.ca>
Subject: Java + Perl on Solaris
Message-Id: <lAl55.700$jT5.1197@wagner.videotron.net>

Hello,

I would like to know if somebody can provide a feedback on JPL (Java + Perl)
on Solaris/Sun
platform ?

Is it stable ?
Is it a workable alternative for a small size application (20 concurrent
clients) with
low to moderate transaction volume ?
Is it possible to use it in a multi-threading environment ?

Thank you in advance

Alain Maronani
Montreal




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

Date: Sun, 25 Jun 2000 17:07:14 GMT
From: "smile773" <smile773@bigfoot.com>
Subject: Re: Need app to generate perl for windows
Message-Id: <6%q55.1142$AM4.59671@bgtnsc04-news.ops.worldnet.att.net>

What do you mean by interface win98 ?
IDE ? or cgi or html forms(widgets). I am not certain
from what perspective you are looking at perl ?

Do you have an example of  what you would like to do
with perl but win98 is causing some frustrations ?




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

Date: 25 Jun 2000 16:53:10 +0100
From: nobull@mail.com
Subject: Re: Newbie qn: scope of Dir (file?) handles.
Message-Id: <u9bt0pzrix.fsf@wcl-l.bham.ac.uk>

Sriram Karra <karra@cs.utah.edu> writes:

> hi,
> 
> if I cant my() or local() them, how can I get teh following code to
> work: (apart from explicitly maintaining a "stack" of dirhandles
> (dirnames)).

You _can_ local() a dirhandle - or rather you can local() a typeglob
which is about as good.

A better solution is to use a my() scalar containg a reference to
dir handle.

perldoc DirHandle

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


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

Date: Sun, 25 Jun 2000 12:29:04 -0400
From: "kokopuff" <kokopuff@cukezone.com>
Subject: newbie question from Learning Perl--help me debug this
Message-Id: <slccnksfjev131@corp.supernews.com>

I am going through the exercises in "Learning Perl" from O'Reilly.

I was working on 8.2, which (i slightly misunderstood...) asks you to write
a subroutine that takes in an arithmetic operation, such as 2 + 2 = 4 and
return it as a string, like "Two plus two equals four"

Here is my code so far:


#!/usr/bin/perl

while (defined ($input = <STDIN>)) {
 chomp;
 push(@a, $input);
 #print "(" . @a . ")\n";
}

@b = @a;

print @b; #why does this not print @[0]?
print @a;

print toString(@a);



sub toString
{

$str = "";

 foreach $_ (@_) {

  chomp ($_);

# if (/\d/) { $str .= $num2str[$_] . " ";}


 if ($_ < 10)


  if ($_ == 1) {
   $str .= "one ";
  }
  elsif ($_ == 2) {
   $str .= "two ";
  }
  elsif ($_ ==3) {
   $str .= "three ";
  }
  elsif ($_ == 4) {
   $str .= "four ";
  }
  elsif ($_ == 5) {
   $str .= "five ";
  }
  elsif ($_ == 6) {
   $str .= "six ";
  }
  elsif ($_ == 7) {
   $str .= "seven ";
  }
  elsif ($_ == 8) {
   $str .= "eight ";
  }
  else {
   $str .= "nine ";
  }
 }

 else { $str .= $_ . " ";  }

  } #foreach

  return $str;
}



The subroutine is rather inefficient, but it seems to be working anyhow. My
problem is, as I commented above, with the lines

print @b; #why does this not print @[0]?
print @a;
print toString(@a);

For reasons beyond my knowledge, @b does not print out @b[0]. When I comment
out that line, @a does not print out @[0] any more.
When I comment out both of these lines, print toString(@a) no longer works.

Anybody have any idea what is going on?





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

Date: 25 Jun 2000 16:31:51 GMT
From: ghengis76@aol.com (Ghengis 76)
Subject: Newsgroup question
Message-Id: <20000625123151.10222.00000371@ng-ct1.aol.com>

I'm interested in finding out which newsgroups people use and are the most
helpful in the following area's:

Computer Graphics
-Macromedia -Freehand, Dreamweaver, Fireworks
-Adobe Photoshop, etc
Computer Tech support.
Web Design
Mac Systems
Networking

If any one has a perferred newsgroup server/program that they like i'd be
intrested in hearing about those too.  

Thanks
Shawn James Taft

please e-mail your respones as well as postintg them, that way i'll be certain
to get them.


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

Date: Sun, 25 Jun 2000 10:49:47 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Newsgroup question
Message-Id: <Pine.GSO.4.10.10006251047470.23149-100000@user2.teleport.com>

On 25 Jun 2000, Ghengis 76 wrote:

> Newsgroups: comp.lang.perl.misc
> Subject: Newsgroup question
> 
> I'm interested in finding out which newsgroups people use and are the most
> helpful in the following area's:
> 
> Computer Graphics
> -Macromedia -Freehand, Dreamweaver, Fireworks
> -Adobe Photoshop, etc
> Computer Tech support.
> Web Design
> Mac Systems
> Networking

None of these have anything to do with Perl, really. Why are you asking
us? In any case, if you have questions about finding appropriate
newsgroups, see the frequent postings in news.announce.newusers. And if
you've posted this separately to other newsgroups, see the information on
crossposting in news.announce.newusers as well.

Follow-ups set, in case there's any Perl-related follow-up.

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 25 Jun 2000 08:36:06 -0400
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Re: OpenFile then Chomp
Message-Id: <22vblsol2mav3qumvna0s0rirdsvspp144@news.supernews.net>

Jonathan Stowe <gellyfish@gellyfish.com> wrote:

} > Well, opening and closing files a lot is a pretty slow operation, I'd think
} > [the read and chomp is probably not bad].  One alternative would be to let
} > Unix do the work for you.  If the set of files is known, I'd bet that the
} > fastest way to do it would be to do:
} > 
} >     open (FIRST, "head -1 <LOTS OF FILES> | ")
} > 
} 
} Of course it might make a difference how many file 'LOTS OF FILES' is ...

Probably not --- I suspect it'll always be faster than almost anything you
can do short of XSUB'ing it in C.  If the # of files is HUGE, you can
always open:
      "find <files> [appropriateconditions] | xargs head -1 |"
or whatever works to get at all the filenames and use xargs to keep the
command lines under control.

  /Bernie\
-- 
Bernie Cosell                     Fantasy Farm Fibers
bernie@fantasyfarm.com            Pearisburg, VA
    -->  Too many people, too few sheep  <--          


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

Date: Sun, 25 Jun 2000 08:00:15 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: perl + dll
Message-Id: <3955F44F.E8E886A3@patriot.net>

Win32::API

elixir wrote:

> Hi !
>
> Is there anyone enable to tell me if it's possible to run a dll (visual C)
> from a perl script  with an exchange of parameters ?
>
> Thanks a lot for an answer !!!
>
> __< (©¿©)>___  felix qui potuit rerum cognoscere causas



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

Date: Sun, 25 Jun 2000 17:48:11 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Perl Programming Style Question
Message-Id: <vBr55.1611$k5.25863@news1.rdc1.mb.home.com>

In article <7a3dm264or.fsf@merlin.hyperchip.com>,
 Ala Qumsieh <aqumsieh@hyperchip.com> wrote:
> 
> SPAM+indigo@dimensional.com (Tim) writes:
[snip]
> > However, if you are writing a package, you may wish to enclose
> > you code in braces in case you wish to have package scoped
> > variables.
> 
> No. You don't need to enclose your code in braces if you are writing a
> package. As soon as you declare a new package using the package()
> construct, all subsequent variables belong to that package. The only
> exceptions are Perl's special variables (checkout perlvar) and fully
> qualified variables.

That's only true of package variables, not lexicals -- if you have
two or more packages defined in a single file and you want those
packages to have their own private lexicals then you'll need to wrap
them in curly braces.  In the following, $foo is file-scoped (not
package scoped) and can be accessed from anywhere else in the file,
but $bar is private to the scope containing package Bar and only
reachable through the Bar::bar() function:

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

package Foo;
my $foo = 'foo';
sub foo {print "$foo\n"}

{
    package Bar;
    my $bar = 'bar';
    sub bar {print "$bar\n"}
    sub foo {print "$foo\n"}
}

package main;
Foo::foo();      #prints: foo
Bar::bar();      #prints: bar
Bar::foo();      #prints: foo
print "$foo\n";  #prints: foo

print "$bar\n";  #compile time error
__END__

regards,
andrew

-- 
Andrew L. Johnson   http://members.home.net/perl-epwp/
      In theory, there's no difference between
      theory and practice, but in practice there is!


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

Date: Sun, 25 Jun 2000 11:03:21 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Perl2Exe Problem
Message-Id: <Pine.GSO.4.10.10006251102370.23149-100000@user2.teleport.com>

On Sat, 24 Jun 2000 malverian@hotmail.com wrote:

> Subject: Perl2Exe Problem

Didn't the technical support desk from the vendor of Perl2Exe help you
with this? 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 25 Jun 2000 11:31:02 GMT
From: moomoo <mandersjones@my-deja.com>
Subject: Re: Problem installing CPAN Date::Calc
Message-Id: <8j4qhn$cm3$1@nnrp1.deja.com>

I too have the perl Makefile.pl producing the errors given below and it
is driving me nuts! (on win98, ActivePerl)

Using PPM is of course the thing to do if there is a package for the
module you want. However there are loads of CPAN modules for which you
cant use ppm (no ppd file). So this still leaves the problem of getting
Perl Makefile.pl to work. I've looked and looked but no-one seems to
have given an answer. Installing Nmake15.exe with VC++ is not the
solution for the perl Makefile.pl problem.


I really hope someone out there can help us!

In article <8rt3lsgnfa9vkonig3kkdqbblbbiha082f@4ax.com>,
  Abe Timmerman <abe@ztreet.demon.nl> wrote:
> On Thu, 22 Jun 2000 01:44:17 GMT, aphiny6592@my-deja.com wrote:
>
> > When I input the first command "perl makefile.pl" to generate the
> > makefile.  I get the following errors:
>
> That has been answered.
> >
> > I am running Windows 98.
> > I have tested the module with my perl build on Solaris and it works
> > with no problems.
> >
> > I have no idea what the problem is.  Any suggestions?
>
> Yep, start the PPM program that comes with ActivePerl.
> and type at the PPM> prompt:
>
> 	install Date-Calc
>
> --
> Good luck,
> Abe
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 25 Jun 2000 11:42:11 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Quick "Perl Way" solution needed
Message-Id: <3958e6cc.8437084@news.skynet.be>

J Church wrote:

>I want to print the numbers in the last field in such a way
>that each sequence of consecutive numbers are considered
>seperate ranges, and are the only values extracted.

>.     (This the raw data with the desired values)
>.
>-W- getl0scene_nav.c: bad navigation at scan 688 <-----low
>-W- getl0scene_nav.c: bad navigation at scan 689
>-W- getl0scene_nav.c: bad navigation at scan 690
>-W- getl0scene_nav.c: bad navigation at scan 691
>-W- getl0scene_nav.c: bad navigation at scan 692 <-----high
>-W- getl0scene_nav.c: bad navigation at scan 1039<-----low
>-W- getl0scene_nav.c: bad navigation at scan 1040
>-W- getl0scene_nav.c: bad navigation at scan 1041
>-W- getl0scene_nav.c: bad navigation at scan 1042<-----high
>-W- getl0scene_nav.c: bad navigation at scan 1635<-----low
>-W- getl0scene_nav.c: bad navigation at scan 1636
>-W- getl0scene_nav.c: bad navigation at scan 1637
>-W- getl0scene_nav.c: bad navigation at scan 1638<-----high

A "Perl Way"? I can't see one, from the top of my head. But I'll take a
shot at it.

	my @scan = sort { $a <=> $b } 
	  map { /bad navigation at scan (\d+)/ } <DATA>;
	# drop the sort if you're sure the data is already sorted

	my $lo;
	foreach my $scan (@scan) {
	    if(not defined $lo or $scan > $range{$lo}+1) {
	        # new range
	        $lo = $range{$scan} = $scan;
	    } else {
	        $range{$lo} = $scan;
	    }
	}

	foreach (sort  { $a <=> $b } keys %range) {
	    print "From $_ to $range{$_}\n";
	}
	__DATA__
	... your data lines here

-- 
	Bart.


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

Date: Sun, 25 Jun 2000 12:01:10 -0400
From: John J Chew <jjchew@math.utoronto.ca>
Subject: Re: Quick "Perl Way" solution needed
Message-Id: <B57BA506.46B4%jjchew@math.utoronto.ca>

In article 3953C366.EEB592B1@orbital.com, J Church at
church.jeff@orbital.com wrote on 2000 06 23 16:07:

> I want to print the numbers in the last field in such a way
> that each sequence of consecutive numbers are considered
> seperate ranges, and are the only values extracted.

> I'm just looking for a quick "Perl Way" Solution.

If by 'quick' you mean 'does not take long to type' and not
'runs fastest' or 'is likely to take very little maintenance
time in the long run', you might try the following:

  my @sorted = (2,3,4,6,7,8,12,13,14,15,20,23); # for example
  print "$sorted[0]\t";
  map { print "$sorted[$_-1]\n$sorted[$_]\t" }
    grep($sorted[$_-1]+1 != $sorted[$_], 1..$#sorted);
  print $sorted[-1], "\n";

-- 
John J. Chew, III
jjchew@math.utoronto.ca * http://www.math.utoronto.ca/jjchew


John



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

Date: Sun, 25 Jun 2000 10:57:33 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Redirecting
Message-Id: <Pine.GSO.4.10.10006251055460.23149-100000@user2.teleport.com>

On Sat, 24 Jun 2000, Eelke Kleijn wrote:

> The firewall has to forward the request to the server, and receive the
> servers output. Now the firewall will have to forward the information
> back to the webserver, and the webserver has to show the output to the
> user.

> My question is, can this be done?? And if so how?

So, you're writing a firewall? It can be done, yes. Have you seen the docs
about sockets? Although you could probably do just fine with LWP. Is that
what you're doing?

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sat, 24 Jun 2000 18:43:58 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Repeated regex matching.
Message-Id: <slrn8laede.q4.tadmc@magna.metronet.com>

On Sat, 24 Jun 2000 13:25:38 -0500, David Allen <s2mdalle@titan.vcu.edu> wrote:
>Let's say I have a string:
>
>$foo = "popopop";
>
>and then I have this code:
>
>while(($foo =~ m/pop/gi)){
>   print "MATCHED\n";
>}
>
>This prints the word MATCHED two times instead of 3
>times. 

[snip overlapping matches]

>How do I get the desired behavior out of a regex?  I.e. how
>do I get a subsequent regex to return a match that can include
>part of, but not all of, a previous match?


   perldoc -f pos


while(($foo =~ m/(pop)/gi)){
   print "MATCHED '$`'\n";
   pos($foo) -= length($1) - 1; # one char beyond start of this match
}


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sun, 25 Jun 2000 14:14:25 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: return by value
Message-Id: <qmrblso346ai85mjt9hqgdihctd7kpuecr@4ax.com>

[please state your response _after_ the quoted text you are responding
to]

On Fri, 23 Jun 2000 16:44:01 GMT, "Benji Lilley"
<lilleyb001@hawaii.rr.com> wrote:
> Abe Timmerman <abe@ztreet.demon.nl> wrote in message
> news:08u6ls43k5aq7bmfacnpn2jsffsjfle781@4ax.com...
> > On Fri, 23 Jun 2000 06:59:38 GMT, "Benji Lilley"
> > <lilleyb001@hawaii.rr.com> wrote:
> >
> > ...
> > >
> > > a simple working example:
> >
> > Nope, _not_ working! Please test your code before posting, especially if
> > you say it's _working_.
> 
> It does work on my machine ...

Nope , it does not, and you _really_ should use '-w' to let perl help
you.

you might try the next example to see where you got it wrong:

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

my %hash = (name => 'foo', id => 'baz');

sub return_by_value{
	my %subroutine_hash = shift; # wrong!

#	my %subroutine_hash = @_; # use this !

	print "In sub {name} key has value '$subroutine_hash{name}'\n";

	$subroutine_hash{name} = 'bar';
	return %subroutine_hash;
}

my %newhash = return_by_value(%hash);

print "Original: $hash{id}, $hash{name}\n";
print "New:      $newhash{id}, $newhash{name}\n";

__END__

Now where did the $newhash{id} value go?

	perldoc perlsub

says:
    The Perl model for function call and return values is simple: all
    functions are passed as parameters one single flat list of scalars,
    and all functions likewise return to their caller one single flat
    list of scalars. Any arrays or hashes in these call and return lists
    will collapse, losing their identities--but you may always use
    ...

-- 
Good luck,
Abe


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

Date: Sun, 25 Jun 2000 16:02:24 GMT
From: iwelch@my-deja.com
Subject: test for membership in an array?
Message-Id: <8j5ae9$mmv$1@nnrp1.deja.com>



what is the recommended way to test repeatedly for existence
of different scalars in an array?  (I know I can write a loop or turn
the array into a hash, but that seems somewhat inelegant for an
operation that is probably very standard.)

/iaw


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 25 Jun 2000 16:14:43 GMT
From: acme@ns0.astray.com (Leon Brocard)
Subject: Re: test for membership in an array?
Message-Id: <slrn8lc8id.a5g.acme@ns0.astray.com>

iwelch@my-deja.com typed out randomly:

> (I know I can write a loop or turn the array into a hash, but that
> seems somewhat inelegant for an operation that is probably very
> standard.)

From perlfaq: "Hashes are designed to answer this question quickly and
efficiently. Arrays aren't."

One of the most important points in being a programmer is knowing what
data structure to use when storing data, and in Perl hashes are often
The Right Way To Do It.

HTH, Leon
-- 
Leon Brocard.............................http://www.astray.com/
yapc::Europe - September 22-24 London - http://yapc.org/Europe/

 ... Error 256: Programmer Deleted


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

Date: Sun, 25 Jun 2000 16:20:44 GMT
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: test for membership in an array?
Message-Id: <8j5bgh$nfh$1@nnrp1.deja.com>

In article <8j5ae9$mmv$1@nnrp1.deja.com>,
  iwelch@my-deja.com wrote:
>
>
> what is the recommended way to test repeatedly for existence
> of different scalars in an array?  (I know I can write a loop or turn
> the array into a hash, but that seems somewhat inelegant for an
> operation that is probably very standard.)
>

IMHO you could read the FAQ:
"How can I tell whether a list or array contains a certain element?"

Also the following FAQ may help:
"How do I compute the difference of two arrays? How do I compute the
intersection of two arrays?"

The answers mey be found in 'perldoc perlfaq4'
or at http://www.cpan.org/doc/manual/html/pod/perlfaq4.html.

IMHO, if you are going to _repeatedly_ search an array
for some elements - then convert it to hash (once)
and use this hash for repeated lookups.

Good luck.
Ilja.



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 25 Jun 2000 11:51:04 GMT
From: salim@cygnos.com
Subject: Re: Urgent help with non-blocking child process required
Message-Id: <Imm55.5926$pW4.132425@news1.rdc1.on.wave.home.com>

Greetings,

Thanks for the generous help I received from the news group. I am sorry I
made a few mistakes (etiquette-wise). Non was intentional and I agree with
all the remarks made on my posting.

A suggestion was made to me to use in snippetA the IO::File module in order
to assign different file handles for the different children that snippetA
fork/execs. I modified the snippetA to look as shown below. snippetB is left
unmodified as of my original posting. While the trick seems to have solved
the handle-related problem, I now have a different and bizarre behavior that
I couldn't explain. The difficulty is that while snippetA does not block
upon invoking a snippetB child ( invokes as many as desired), the children
execute (consistently)linearly and in reverse order of invocation. i.e. the
6th child has to finish executing before the 5th invocation can execute, and
the fourth waits until the fifth finishes,... and so on. I am not sure what
is causing the problem? I noticed however, is that upon killing the parent
(snippetA), all children execute concurrently, and that they no longer
exhibit the behaviour I outlined above. I'd appreciate any light you can
shed on this problem. Is there a way in Perl to dissociate a child from its
parent completely?. Will such dissociation be most effective way to force
independent execution from the children?

thanks for your help

snippetA:

use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
use POSIX qw(:sys_wait_h :signal_h :errno_h);
use IO::File;
use IO::Handle;

my $KeepAlive=1;
my $x=0;
my $y;
my @files=();
while ($KeepAlive) {
	  $y="\nIteration ++$x: sample data sent by snippetA\n";
                my $fh=new IO::File;
                if (my $pid=open($fh, "|-")){
                	push @files, $fh;
               	 $fh->autoflush(1);
               	 print $fh $y;
               	 print "\nSnippetA: iteration $x\n";
               	 close ($fh);
               	 waitpid(-1,&WNOHANG);
                }else{
                	exec "perl snippetB.pl";
                }
}


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 3475
**************************************


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