[10920] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4521 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 30 18:07:22 1998

Date: Wed, 30 Dec 98 15:00:18 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 30 Dec 1998     Volume: 8 Number: 4521

Today's topics:
    Re: An interesesting? problem.... <skilchen@swissonline.ch>
    Re: An interesesting? problem.... <galahadthedestroyer@earthlink.net>
        Help please! <silvolat@dlc.fi>
        Help please! <silvolat@dlc.fi>
        Help please! <silvolat@dlc.fi>
        Help please! <silvolat@dlc.fi>
    Re: How to Run Perl on DOS <expert@friko.onet.pl>
    Re: How to Run Perl on DOS <gellyfish@btinternet.com>
    Re: Perl Cookbook <crism@oreilly.com>
    Re: Perl Win32 and ODBC? <trellin@inreach.com>
    Re: Perl, Netscape and Internet Explorer...:( <expert@friko.onet.pl>
    Re: Please help will generating biased random numbers. <mkahn@vbe.com>
    Re: Please help will generating biased random numbers. (John Stanley)
        Problems with HTTPD-Tools-0.55 Perl 5.005_2 <pgreen@m2.msd.ray.com>
        reading a single char (Stephen Paul Miller)
    Re: reading a single char <tchrist@mox.perl.com>
    Re: reading a single char (John Stanley)
        Some XS-Authoring-Questions (Konstantinos Agouros)
        splitting a file into pages <kvraman@lucent.com>
    Re: splitting a file into pages (Mark-Jason Dominus)
        Time tracking system with database backend (Damon K. Haley)
    Re: Usual "Hello, world" problem <rsilk@hummingbird.com>
    Re: Webpage database linkage ? <galahadthedestroyer@earthlink.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Wed, 30 Dec 1998 22:18:45 +0100
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: Re: An interesesting? problem....
Message-Id: <76e5j2$bqo1@news-sol.swissonline.ch>

Abigail schrieb in Nachricht <76do58$fsm$1@client3.news.psi.net>...
>
>#!/usr/local/bin/perl -w
>use strict;
>
>my $thingy = '10(4).3.4(2).2(2)';
>my @out = ("");
>
>map {@out = map {my $new = $_; map {length () ? "$_.$new" : $new} @out}
@$_}
>     map {/(\d+)(?:\((\d+)\))?/; [$1 .. ($1 + ($2 || 0))]} split /\./,
$thingy;
>
>$" = "\n"; print "@out\n";
>
>__END__
>
I like this proposal very much! It is a much more compact (and more
efficient) implementation of the same idea (is it the cartesian product of
lists?), that i tried to implement in my proposal. If you modify it
slightly, you even get the "right" order in the output:

my $thingy = '10(4).3.4(2).2(2).1(3)';
my @out = ("");

foreach (reverse map {/(\d+)(?:\((\d+)\))?/; [$1 .. ($1 + $2)]}
#        ^^^^^^^
                     split /\./, $thingy) {
  @out = map {my $new = $_; map {length () ? "$new.$_" : $new} @out} @$_;
#                                             ^^^^^^^
}
$" = "\n"; print "@out\n";

(the change of one "map" to "foreach" seems to be only a style preference:
is it true, that "map" called in a void/scalar context does not build the
result list?)

--
Samuel Kilchenmann
skilchen@swissonline.ch





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

Date: Wed, 30 Dec 1998 13:54:21 -0800
From: Chuck <galahadthedestroyer@earthlink.net>
To: Jim Matzdorff <syran@best.com>
Subject: Re: An interesesting? problem....
Message-Id: <368AA10D.4E2A716A@earthlink.net>

Nah, don't use recursion. I would split the string based on the dot and feed each of the four
parts to a nested for loop:

$starta = 10;
$enda = 10 + 4;
 . . .
for( $a=$starta; $a++; $a<=$enda ) {
for( $b=$startb; $b++; $b<=$endb ) {
for( $c=$startc; $c++; $c<=$endc ) {
for( $d=$startd; $d++; $d<=$endd ) {
print $a.'.'.$b.'.'.$c.'.'.$d;
} } } }

You would of course have to parse your input string to assign correct values to the $startX and
$endX variables.

Chuck

Jim Matzdorff wrote:

> I have a problem here at work that I was wondering if anyone may have thoughts on.
>
> I have an string (suspiciously like an ip address) such as:
>
> 10(4).3.4(2).2(2)
>
> I need to get every combination of ip address out of that, assuming the number in parens
> are number of addtions to that particular part of the ip address.  For instance, the string
> above would (hopefully) get expanded to:
>
> 10.3.4.2
> 10.3.4.3
> 10.3.4.4
> 10.3.5.2
> 10.3.5.3
> 10.3.5.4
> .and so on...
> 14.3.6.2
> 14.3.6.3
> 14.3.6.4
>
> ALL the iterations and possible combinations.
>
> I was able to get one iteration done (which was easy, obviously), but attepting to get every
> iteration is proving to be a little difficult.  I almost think this requires recursion of some
> type, but my abilities in that area (or this) are limited.
>
> Suggestions?
>
> --jim






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

Date: Thu, 31 Dec 1998 00:41:59 +0200
From: "Ilari Silvola" <silvolat@dlc.fi>
Subject: Help please!
Message-Id: <76e6mb$6uo$1@tron.sci.fi>

Hello

I am starting to use perl and am not familar with it yet (nor programing
overall) Now I am making a program to go trough several loadcases in a text
file. So I tried to put file pointer (tell / seek ) to the locations needed
(start of each loadcase) and seek them later. The problem is, that as I am
giving the file ponter name by variable:

for ($n=0;$n<$nlc;$n++) {
  $found=0;
  open (Fpifile,"$ipfpi");
  chomp ($lcstring=<Inpfile>);
  $lcin=("100CL" . "$lcstring");
  while ($Fstring = <Fpifile>) {
       @Fdata = split " ",$Fstring;
       if (@Fdata[0] eq $lcin) {
            $Fstring = <Fpifile>;
            @Fdata = split " ",$Fstring;
             if (@Fdata[1] eq "STRESS") {
                  print "Lc $lcin found\n";
                  $found=1;
                  $lcstart="L" . $lcstring . "start";
                  $lcstart=tell Fpifile }
              }
       }
}

And later I should  go through the loadcases in loop, so I need to define
the variable name again:


chomp ($nlc=<Inpfile>);
for ($n=0;$n<$nlc;$n++) {
     chomp ($lcstring=<Inpfile>);
     $lcstart="L" . $lcstring . "start";

    open (Forces,">$edfor");
    open (Edges,"$tmpedge");
    open (Fpifile,"$ipfpi");
        while ($Edge=<Edges>) {
         @Edge=split" ",$Edge;
         $Fstring=<Fpifile>;
         seek Fpifile, $lcstart, 0;

So I loose the position information from the variable.

Obviously I am doing something wrong, but how should I solve the problem????

Please help

Ilari Silvola
silvolat@dlc.fi







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

Date: Thu, 31 Dec 1998 00:41:59 +0200
From: "Ilari Silvola" <silvolat@dlc.fi>
Subject: Help please!
Message-Id: <76ea8k$8vg$1@tron.sci.fi>

Hello

I am starting to use perl and am not familar with it yet (nor programing
overall) Now I am making a program to go trough several loadcases in a text
file. So I tried to put file pointer (tell / seek ) to the locations needed
(start of each loadcase) and seek them later. The problem is, that as I am
giving the file ponter name by variable:

for ($n=0;$n<$nlc;$n++) {
  $found=0;
  open (Fpifile,"$ipfpi");
  chomp ($lcstring=<Inpfile>);
  $lcin=("100CL" . "$lcstring");
  while ($Fstring = <Fpifile>) {
       @Fdata = split " ",$Fstring;
       if (@Fdata[0] eq $lcin) {
            $Fstring = <Fpifile>;
            @Fdata = split " ",$Fstring;
             if (@Fdata[1] eq "STRESS") {
                  print "Lc $lcin found\n";
                  $found=1;
                  $lcstart="L" . $lcstring . "start";
                  $lcstart=tell Fpifile }
              }
       }
}

And later I should  go through the loadcases in loop, so I need to define
the variable name again:


chomp ($nlc=<Inpfile>);
for ($n=0;$n<$nlc;$n++) {
     chomp ($lcstring=<Inpfile>);
     $lcstart="L" . $lcstring . "start";

    open (Forces,">$edfor");
    open (Edges,"$tmpedge");
    open (Fpifile,"$ipfpi");
        while ($Edge=<Edges>) {
         @Edge=split" ",$Edge;
         $Fstring=<Fpifile>;
         seek Fpifile, $lcstart, 0;

So I loose the position information from the variable.

Obviously I am doing something wrong, but how should I solve the problem????

Please help

Ilari Silvola
silvolat@dlc.fi







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

Date: Thu, 31 Dec 1998 01:48:42 +0200
From: "Ilari Silvola" <silvolat@dlc.fi>
Subject: Help please!
Message-Id: <76eaje$9bt$1@tron.sci.fi>

Hello

I am starting to use perl and am not familar with it yet (nor programing
overall) Now I am making a program to go trough several loadcases in a text
file. So I tried to put file pointer (tell / seek ) to the locations needed
(start of each loadcase) and seek them later. The problem is, that as I am
giving the file ponter name by variable:

for ($n=0;$n<$nlc;$n++) {
  $found=0;
  open (Fpifile,"$ipfpi");
  chomp ($lcstring=<Inpfile>);
  $lcin=("100CL" . "$lcstring");
  while ($Fstring = <Fpifile>) {
       @Fdata = split " ",$Fstring;
       if (@Fdata[0] eq $lcin) {
            $Fstring = <Fpifile>;
            @Fdata = split " ",$Fstring;
             if (@Fdata[1] eq "STRESS") {
                  print "Lc $lcin found\n";
                  $found=1;
                  $lcstart="L" . $lcstring . "start";
                  $lcstart=tell Fpifile }
              }
       }
}

And later I should  go through the loadcases in loop, so I need to define
the variable name again:


chomp ($nlc=<Inpfile>);
for ($n=0;$n<$nlc;$n++) {
     chomp ($lcstring=<Inpfile>);
     $lcstart="L" . $lcstring . "start";

    open (Forces,">$edfor");
    open (Edges,"$tmpedge");
    open (Fpifile,"$ipfpi");
        while ($Edge=<Edges>) {
         @Edge=split" ",$Edge;
         $Fstring=<Fpifile>;
         seek Fpifile, $lcstart, 0;

So I loose the position information from the variable.

Obviously I am doing something wrong, but how should I solve the problem????

Please help

Ilari Silvola
silvolat@dlc.fi









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

Date: Thu, 31 Dec 1998 01:48:42 +0200
From: "Ilari Silvola" <silvolat@dlc.fi>
Subject: Help please!
Message-Id: <76eaku$9ct$1@tron.sci.fi>

Hello

I am starting to use perl and am not familar with it yet (nor programing
overall) Now I am making a program to go trough several loadcases in a text
file. So I tried to put file pointer (tell / seek ) to the locations needed
(start of each loadcase) and seek them later. The problem is, that as I am
giving the file ponter name by variable:

for ($n=0;$n<$nlc;$n++) {
  $found=0;
  open (Fpifile,"$ipfpi");
  chomp ($lcstring=<Inpfile>);
  $lcin=("100CL" . "$lcstring");
  while ($Fstring = <Fpifile>) {
       @Fdata = split " ",$Fstring;
       if (@Fdata[0] eq $lcin) {
            $Fstring = <Fpifile>;
            @Fdata = split " ",$Fstring;
             if (@Fdata[1] eq "STRESS") {
                  print "Lc $lcin found\n";
                  $found=1;
                  $lcstart="L" . $lcstring . "start";
                  $lcstart=tell Fpifile }
              }
       }
}

And later I should  go through the loadcases in loop, so I need to define
the variable name again:


chomp ($nlc=<Inpfile>);
for ($n=0;$n<$nlc;$n++) {
     chomp ($lcstring=<Inpfile>);
     $lcstart="L" . $lcstring . "start";

    open (Forces,">$edfor");
    open (Edges,"$tmpedge");
    open (Fpifile,"$ipfpi");
        while ($Edge=<Edges>) {
         @Edge=split" ",$Edge;
         $Fstring=<Fpifile>;
         seek Fpifile, $lcstart, 0;

So I loose the position information from the variable.

Obviously I am doing something wrong, but how should I solve the problem????

Please help

Ilari Silvola
silvolat@dlc.fi









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

Date: Wed, 30 Dec 1998 21:08:56 GMT
From: Expert <expert@friko.onet.pl>
Subject: Re: How to Run Perl on DOS
Message-Id: <368A870D.59ED@friko.onet.pl>

FTMOM42 wrote:
> 
> How do you run a program on DOS?
In first line of a script file put
#!c:\perl\perl.exe  ( or other directory where perl.exe is)

and name a script
file.pl


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

Date: 30 Dec 1998 22:17:58 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: How to Run Perl on DOS
Message-Id: <76e8qm$lo$1@gellyfish.btinternet.com>

On Wed, 30 Dec 1998 21:08:56 GMT Expert <expert@friko.onet.pl> wrote:
> FTMOM42 wrote:
>> 
>> How do you run a program on DOS?
> In first line of a script file put
> #!c:\perl\perl.exe  ( or other directory where perl.exe is)
> 
> and name a script
> file.pl

Er, no.  I really dont think that will work (unless of course you have some
alternative to command.com that supports that kind of thing but I dont think
we can assume that.)

perldoc perlrun

 .
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 30 Dec 1998 13:37:15 -0500
From: Chris Maden <crism@oreilly.com>
Subject: Re: Perl Cookbook
Message-Id: <kevhitwk6c.fsf@rosetta.ora.com>

Tom Turton <tturton@cowboys.anet-dfw.com> writes:

> I couldn't find any info on the O'Reilly web page as to how to
> report suspected errata, so please forgive the bandwidth here.

>From the home page, follow "How to Contact Us".  There, you'll see
that "booktech@oreilly.com" is "for technical questions, or
corrections, concerning book contents".

-Chris
 JAPH, not a customer service guy or anything like that, so don't ask
 me about this
-- 
<!NOTATION SGML.Geek PUBLIC "-//Anonymous//NOTATION SGML Geek//EN">
<!ENTITY crism PUBLIC "-//O'Reilly//NONSGML Christopher R. Maden//EN"
"<URL>http://www.oreilly.com/people/staff/crism/ <TEL>+1.617.499.7487
<USMAIL>90 Sherman Street, Cambridge, MA 02140 USA" NDATA SGML.Geek>


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

Date: Wed, 30 Dec 1998 21:48:25 GMT
From: Clay Ratliff <trellin@inreach.com>
Subject: Re: Perl Win32 and ODBC?
Message-Id: <368A9EB1.291CFE66@inreach.com>

> I am looking to extract ODBC-based data using Perl for Win32.
> I was wondering if anyone could point me in the right direction,
> throw me a code sample to mess with, anything.  I am an extreme
> newbie in this situation.

Take a look at this place. Has some nice handy links.

http://www.roth.net/odbc/FAQ/FAQ.HTM

Clay Ratliff



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

Date: Wed, 30 Dec 1998 21:13:03 GMT
From: Expert <expert@friko.onet.pl>
Subject: Re: Perl, Netscape and Internet Explorer...:(
Message-Id: <368A8805.58F@friko.onet.pl>

Tojo wrote:
> 
> Hi,
> 
> I have a HTML Form page where, I have put some text fields , radio buttons
> and all. And there is a Submit button, which will execute a Perl script and
> will send a mail to me. This page is working fine Internet Explorer3.0 to
> IE5.0.
> 
> But when I use Neescape, instead of ececuting the Perl script, it tries to
> download
> (
what downloads, a html source ?
Mayby you need make some modifications to the perl script or omit some
tags.
Try to run perl script under DOS/win95/98 locally to see how it works.
Set up another www on local PC and run script on local server.
If still doesn't work, send me this script to see how to repair it.

Jacek


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

Date: Wed, 30 Dec 1998 14:53:21 -0600
From: Mark Kahn <mkahn@vbe.com>
Subject: Re: Please help will generating biased random numbers.
Message-Id: <368A92C1.A9DF7414@vbe.com>

chad@vcn.net wrote:
> 
> Hi,
> 
> Ok ... I've read the perlcook book concerning this and the doc on
> Math::Random, 'randdom_uniform_integer()' and I still can't seem to get it.
> Can someone please put this in simple terms for me.  Of course what I want to
> do is randomly pick a banner based on weighted values (and I don't even
> really know what that means).  Can some one point me in the right direction?


Chad,

I'm not sure where the problem is if you have perl documentation.  On the
subject of "weighted values", this is what the Merriam-Webster Dictionary has
to say:

2 a : having a statistical weight attached <a weighted test score> b :
compiled or calculated from weighted data <a weighted mean>.

and,

4 : to assign a statistical weight to
5 : to cause to incline in a particular direction by manipulation <the tax
structure... which was weighted so heavily in favor of the upper classes -- A.
S. Link>

For example, to produce a weighted random number from 5 to 10 you'd generate
numbers from 1 to 6, then add 4 to the result:

Random Nr.  +4    Total
----------  ---   -----
1             4     5
2             4     6
3             4     7
4             4     8
5             4     9
6             4     10

These would be considered "weighted" values.

To generate a random value in perl use rand().  For example, to generate a
number between 1 and 100, with no fractions:

$randval = sprintf("%-3d", rand(100) + 1); # Generate a number 1-100
print "$randval\n"; # Print the value of $randval

The sprintf is used to format the return value of rand().  See perldoc -f
sprintf or man sprintf for details.
-- 
~ M. Kahn  <mkahn@vbe.com>

"The software required `Windows 95 or better', so I installed Linux."
-- Tom Christiansen


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

Date: 30 Dec 1998 21:53:27 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Please help will generating biased random numbers.
Message-Id: <76e7cn$5vq$1@news.NERO.NET>

In article <368A92C1.A9DF7414@vbe.com>, Mark Kahn  <mkahn@vbe.com> wrote:
>I'm not sure where the problem is if you have perl documentation.  On the
>subject of "weighted values", this is what the Merriam-Webster Dictionary has
>to say:

The dictionary sometimes does not give the true technical meaning for
terms.

>For example, to produce a weighted random number from 5 to 10 you'd generate
>numbers from 1 to 6, then add 4 to the result:
>...
>These would be considered "weighted" values.

No, those are just random numbers from 5 to 10. They are not "weighted"
because they are evenly distributed.

To "weight" your random selections means to shift the distribution of
your random numbers away from flat. This does not mean they are no
longer random, because you still cannot predict what the next number
will be. It means that you are more likely to get a number in one certain
range than another. I suppose you can argue that your 5-10 example is
"weighting" because the range of 5-10 is 100% likely and outside that
range is 0%, but that's not common usage. Otherwise, ALL random number
generators would be "weighted" and thus the term would be useless.

One example is the gaussian distribution that often appears in real
data. Small deviations from the "true" value are more likely than large
ones.

In a "banner" context, if company A pays you $10 to put up its banner,
and companies B and C each pay you $5, you want to put A's banner up
twice as often as B's or C's. To do this in Perl:

while(1) {

	# some code ...
	...

	$val = rand;  # 0-1 value
	do {
		&putUpBanner('A'); # put up A's banner
		next;
	} if $val < .5;

	do {
		&putUpBanner('B'); # put up B's banner
		next;
	} if $val < .75;

	&putUpBanner('C'); # put up C's banner

}

You could also implement this:

	@whose = ( 'A', 'A', 'B', 'B' );

	&putUpBanner( $whose[int rand 4] );

In either case, you weight the appearance of banner A by twice that of
B or C, but they still appear randomly.  The difficulty in the latter
example is if you want to weight some occurrance at a small fraction.
You will need to have a large array, since the smallest fraction you can
achieve without more codeing is 1/n, where n is the number of elements.



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

Date: Wed, 30 Dec 1998 16:36:56 -0500
From: Philip Green <pgreen@m2.msd.ray.com>
Subject: Problems with HTTPD-Tools-0.55 Perl 5.005_2
Message-Id: <368A9CF8.10703EE7@m2.msd.ray.com>

This is a multi-part message in MIME format.
--------------42048A81E759E247D822E31C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


I have Perl 5.005_2 on Solaris 7 and am unable to  get HTTPD-Tools-0.55
working

I want to use the tools for password admin in an Apache 1.3.3 web
server.

I have included the output of;

make test
make test TEST_VERBOSE=1

Thanks
pgreen@m2.msd.ray.com

--------------42048A81E759E247D822E31C
Content-Type: text/plain; charset=us-ascii;
 name="twink"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="twink"

m2# make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl -Iblib/arch -Iblib/lib -I/usr/local/lib/perl5/5.00502/sun4-solaris -I/usr/local/lib/perl5/5.00502 -e 'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/apache-groups.....Ambiguous call resolved as CORE::close(), qualify as such or use & at lib/HTTPD/AdminBase.pm line 220.
ok
t/authen............Ambiguous call resolved as CORE::close(), qualify as such or use & at lib/HTTPD/AdminBase.pm line 220.
Can't load MD5, skipping Message Digest Authentication tests
Can't load MIME::Base64, skipping Basic Authentication tests
Geez, we can't test much...
dubious
        Test returned status 0 (wstat 11, 0xb)
t/convert...........Ambiguous call resolved as CORE::close(), qualify as such or use & at blib/lib/HTTPD/AdminBase.pm line 220.
dubious
        Test returned status 0 (wstat 11, 0xb)
t/shortcuts.........Ambiguous call resolved as CORE::close(), qualify as such or use & at lib/HTTPD/AdminBase.pm line 220.
ok
t/support...........Ambiguous call resolved as CORE::close(), qualify as such or use & at blib/lib/HTTPD/AdminBase.pm line 220.
couldn't load DBI, skipping SQL support test
ok
t/users-groups......Ambiguous call resolved as CORE::close(), qualify as such or use & at lib/HTTPD/AdminBase.pm line 220.
dubious
        Test returned status 0 (wstat 11, 0xb)
Failed Test  Status Wstat Total Fail  Failed  List of failed
-------------------------------------------------------------------------------
t/authen.t        0    11    ??   ??       %  ??
t/convert.t       0    11    ??   ??       %  ??
t/users-groups.   0    11    ??   ??       %  ??
Failed 3/6 test scripts, 50.00% okay. 0/65 subtests failed, 100.00% okay.
*** Error code 2
make: Fatal error: Command failed for target `test_dynamic'
m2# make test TEST_VERBOSE=1
PERL_DL_NONLAZY=1 /usr/local/bin/perl -Iblib/arch -Iblib/lib -I/usr/local/lib/perl5/5.00502/sun4-solaris -I/usr/local/lib/perl5/5.00502 -e 'use Test::Harness qw(&runtests $verbose); $verbose=1; runtests @ARGV;' t/*.t
t/apache-groups.....Ambiguous call resolved as CORE::close(), qualify as such or use & at lib/HTTPD/AdminBase.pm line 220.
1..30
ok 1
ok 2
ok 3
ok 4
ok 5
ok 6
ok 7
ok 8
ok 9
ok 10
ok 11
ok 12
ok 13
ok 14
apples =  onefish twofish 
oranges =  onefish twofish 
ok 15
ok 16
ok 17
ok 18
ok 19
ok 20
ok 21
ok 22
ok 23
ok 24
ok 25
ok 26
ok 27
ok 28
ok 29
apples = onefish twofish 
oranges = onefish twofish 
ok 30
ok
t/authen............Ambiguous call resolved as CORE::close(), qualify as such or use & at lib/HTTPD/AdminBase.pm line 220.
Can't load MD5, skipping Message Digest Authentication tests
Can't load MIME::Base64, skipping Basic Authentication tests
Geez, we can't test much...
dubious
        Test returned status 0 (wstat 11, 0xb)
t/convert...........Ambiguous call resolved as CORE::close(), qualify as such or use & at blib/lib/HTTPD/AdminBase.pm line 220.
dubious
        Test returned status 0 (wstat 11, 0xb)
t/shortcuts.........Ambiguous call resolved as CORE::close(), qualify as such or use & at lib/HTTPD/AdminBase.pm line 220.
groupone:one
groupone:two
groupone:three
groupone:four
groupone:five
1..24
ok 1
ok 2
EXISTS 'groupone:one'-> one
ok 3
EXISTS 'groupone:two'-> two
ok 4
EXISTS 'groupone:three'-> three
ok 5
EXISTS 'groupone:four'-> four
ok 6
EXISTS 'groupone:five'-> five
ok 7
ok 8
ok 9
ok 10
ok 11
ok 12
ok 13
groupone = one two three four five 
ok 14
ok 15
ok 16
ok 17
EXISTS 'groupone:one'-> one
ok 18
EXISTS 'groupone:two'-> two
ok 19
EXISTS 'groupone:three'-> three
ok 20
EXISTS 'groupone:four'-> four
ok 21
EXISTS 'groupone:five'-> five
ok 22
groupone = one two three four five 
ok 23
ok 24
ok
t/support...........Ambiguous call resolved as CORE::close(), qualify as such or use & at blib/lib/HTTPD/AdminBase.pm line 220.
couldn't load DBI, skipping SQL support test
1..11
ok 1
ok 2
ok 3
ok 4
ok 5
ok 6
ok 7
ok 8
ok 9
ok 10
ok 11
ok
t/users-groups......Ambiguous call resolved as CORE::close(), qualify as such or use & at lib/HTTPD/AdminBase.pm line 220.
dubious
        Test returned status 0 (wstat 11, 0xb)
Failed Test  Status Wstat Total Fail  Failed  List of failed
-------------------------------------------------------------------------------
t/authen.t        0    11    ??   ??       %  ??
t/convert.t       0    11    ??   ??       %  ??
t/users-groups.   0    11    ??   ??       %  ??
Failed 3/6 test scripts, 50.00% okay. 0/65 subtests failed, 100.00% okay.
*** Error code 2
make: Fatal error: Command failed for target `test_dynamic'
m2# 


--------------42048A81E759E247D822E31C--



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

Date: 30 Dec 1998 20:40:28 GMT
From: spmiller@csc.umd.edu (Stephen Paul Miller)
Subject: reading a single char
Message-Id: <76e33s$2ln$1@hecate.umd.edu>

i am having trouble getting perl to read a single char and return control.
Using getc and read, it will always wait for a newline, i want it to
respond after the press of one key without pressing enter.  any ideas?



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

Date: 30 Dec 1998 21:07:12 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: reading a single char
Message-Id: <76e4m0$6ms$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, spmiller@csc.umd.edu (Stephen Paul Miller) writes:
:i am having trouble getting perl to read a single char and return control.
:Using getc and read, it will always wait for a newline, i want it to
:respond after the press of one key without pressing enter.  any ideas?

My first idea is read what perlfunc's entry for getc has to say about this?

   getc    Returns the next character from the input file attached to
	   FILEHANDLE, or the undefined value at end of file, or if there
	   was an error.  If FILEHANDLE is omitted, reads from STDIN.
	   This is not particularly efficient.	It cannot be used to
	   get unbuffered single-characters, however.  For that, try
	   something more like:

	       if ($BSD_STYLE) {
		   system "stty cbreak </dev/tty >/dev/tty 2>&1";
	       }
	       else {
		   system "stty", '-icanon', 'eol', "\001";
	       }

	       $key = getc(STDIN);

	       if ($BSD_STYLE) {
		   system "stty -cbreak </dev/tty >/dev/tty 2>&1";
	       }
	       else {
		   system "stty", 'icanon', 'eol', '^@'; # ASCII null
	       }
	       print "\n";

	   Determination of whether $BSD_STYLE should be set is left as
	   an exercise to the reader.

	   The POSIX::getattr() function can do this more portably
	   on systems purporting POSIX compliance.  See also the
	   Term::ReadKey module from your nearest CPAN site; details on
	   CPAN can be found on the CPAN entry in the perlmod manpage.

    29/Nov/1998            perl 5.005, patch 54                    30

My next idea is to read what the Perl FAQ says about the matter:

    =head2 How can I read a single character from a file?  From the keyboard?

    You can use the builtin C<getc()> function for most filehandles,
    but it won't (easily) work on a terminal device.  For STDIN, either
    use the Term::ReadKey module from CPAN, or use the sample code in
    L<perlfunc/getc>.

    If your system supports the portable operating system programming
    interface (POSIX), you can use the following code, which you'll note
    turns off echo processing as well.

	#!/usr/bin/perl -w
	use strict;
	$| = 1;
	for (1..4) {
	    my $got;
	    print "gimme: ";
	    $got = getone();
	    print "--> $got\n";
	}
	exit;

	BEGIN {
	    use POSIX qw(:termios_h);

	    my ($term, $oterm, $echo, $noecho, $fd_stdin);

	    $fd_stdin = fileno(STDIN);

	    $term     = POSIX::Termios->new();
	    $term->getattr($fd_stdin);
	    $oterm     = $term->getlflag();

	    $echo     = ECHO | ECHOK | ICANON;
	    $noecho   = $oterm & ~$echo;

	    sub cbreak {
		$term->setlflag($noecho);
		$term->setcc(VTIME, 1);
		$term->setattr($fd_stdin, TCSANOW);
	    }

	    sub cooked {
		$term->setlflag($oterm);
		$term->setcc(VTIME, 0);
		$term->setattr($fd_stdin, TCSANOW);
	    }

	    sub getone {
		my $key = '';
		cbreak();
		sysread(STDIN, $key, 1);
		cooked();
		return $key;
	    }

	}

	END { cooked() }

    The Term::ReadKey module from CPAN may be easier to use.  Recent version
    include also support for non-portable systems as well.

    (etc)

--tom, the last reader on earth
-- 
_doprnt(pat, args, &fakebuf); /* what a kludge */
    --Larry Wall, from util.c in the v5.0 perl distribution


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

Date: 30 Dec 1998 21:32:07 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: reading a single char
Message-Id: <76e64n$5ko$1@news.NERO.NET>

In article <76e4m0$6ms$1@csnews.cs.colorado.edu>,
Tom Christiansen  <tchrist@mox.perl.com> wrote:
>--tom, the last reader on earth

An insult to the millions of people who read the FAQ and don't post
their questions here. You are hardly "the last reader on Earth". If you
are, then I suppose I ought to take back all those books I have that
list you as an author, since I obviously would never be able to read
them.

Why do you feel the need to denigrate others who are acting the way you
allegedly want them to act? If you want people to read the FAQ, don't
claim to be the only one who can.



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

Date: Wed, 30 Dec 1998 10:38:54 GMT
From: elwood@rumba.m.isar.de (Konstantinos Agouros)
Subject: Some XS-Authoring-Questions
Message-Id: <1998Dec30.103854.1376@rumba.m.isar.de>

Hi,

I recently wrote a little XS-Module since Perl was to slow for what I wanted
to do. Now I have some questions: 
1.) Is there an emacs-mode for .xs-Files? I am a fan of the font-lock-mode, and
used C-mode but the indention didn't work.

2.) In my module I converted a perlhash to a c-struct. I did it extracting
the values from the hash one by one and with those I filled the c-struct.
I thought it might be easier just using pack in perl, but is this good style?
Do other people do it that way?

3.) Debugging. Is there any way to debug the C-Code besides writing a second
file with a main()-Function link it together with my c-code and then use gdb?

Konstantin
-- 
Dipl-Inf. Konstantin Agouros aka Elwood Blues. Internet: elwood@rumba.m.isar.de
Otkerstr. 28, 81547 Muenchen, Germany. Tel +49 89 69370185
----------------------------------------------------------------------------
"Captain, this ship will not sustain the forming of the cosmos." B'Elana Torres


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

Date: Wed, 30 Dec 1998 15:46:29 -0600
From: Venkatraman Krishnan <kvraman@lucent.com>
Subject: splitting a file into pages
Message-Id: <368A9F35.ACDF1C45@lucent.com>

Hi,


I have a file which I am reading into an array. I want to store it
in another array as pages with each containing 60 lines.

open(FILEIO, $file);
@lines = <FILEIO>;
close (FILEIO);
 ...

$lines = join('', @lines);

$count=0;
$pages[count++] = $1 while ($lines =~ /((.*?\n){60}?)/s);

the array @pages is never initialised. is something wrong with the re?

Thanks

venky


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

Date: 30 Dec 1998 22:42:03 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: splitting a file into pages
Message-Id: <76ea7r$m7h$1@picasso.op.net>

In article <368A9F35.ACDF1C45@lucent.com>,
Venkatraman Krishnan  <kvraman@lucent.com> wrote:
>I have a file which I am reading into an array. I want to store it
>in another array as pages with each containing 60 lines.
>
>open(FILEIO, $file);
>@lines = <FILEIO>;
>close (FILEIO);

while (@lines) {
  push @pages, (join '', (splice @lines, 0, 60));
}

Done.

>$lines = join('', @lines);

Hey, don't do that.  Perl went to a lot of trouble to break the file
into lines for you, and you just threw that informartion away.



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

Date: 30 Dec 1998 19:59:13 GMT
From: dhaley@infobeat.com (Damon K. Haley)
Subject: Time tracking system with database backend
Message-Id: <slrn78jnc1.31m.dhaley@dhcp132.corp.merc.com>


Hello,

I am trying to do some reasearch on opensource time-tracking 
systems available for unix (Linux or Solaris).

The basic ideas is a solution that allows multiple users to 
document the hours they work and what projects they work on.  

It must be web-based and have a database backend.  The database 
doens't have to be relational but Oracle or MySql are preferred.

Please let me know if there are any open source solutions out there.

Thanks

Damon Haley



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

Date: 30 Dec 1998 20:27:28 GMT
From: "Robin Silk" <rsilk@hummingbird.com>
Subject: Re: Usual "Hello, world" problem
Message-Id: <01be3432$b185d5e0$8163e7c6@robin.hcl.com>

Try entering the full path of the file (this will prove if you have a path
problem)
e.g. perl c:\perl\hello.plx

I would create a "source" directory for your *.pl files. Make sure that
your DOS path is set to something like:
path C:\WIN95;C:\WIN95\COMMAND;"%path%;C:\Perl\bin;"

Then you can cd to your source directory and

perl hello.plx will work.

Robin Silk (not related -- I think).


AJ <ajonsson@csi.com> wrote in article
<#V2vP1tM#GA.318@ntawwabp.compuserve.com>...
> was that directory :\perl\bin?  is :\perl\bin in your path?
> aj
> Gregg Silk wrote in message
> <19981227231200.12881.00002265@ng-fd1.aol.com>...
> >hey there,
> >
> >OK I have been reading the FAQs and bought the gecko book, installed
Perl5
> on
> >Win95, typed hello.plx as a text file and saved it in the same dir as
perl,
> >started the DOS window from Windows Explorer, type >perl hello.plx and
get
> the
> >message:
> >
> >Can't open Perl script "hello.plx": no such file or directory.
> >
> >If I just type >perl, the title bar of the DOS window does say Perl, so
it
> >seems to be working.
> >
> >Gregg
> 
> 
> 


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

Date: Wed, 30 Dec 1998 13:43:24 -0800
From: Chuck <galahadthedestroyer@earthlink.net>
To: chall5@hotmail.com
Subject: Re: Webpage database linkage ?
Message-Id: <368A9E7C.B3C1B77E@earthlink.net>

The best way is the way that works.

If you've already got an SQL relational database, you could create a keywords
table and do a lookup for your keyword(s), then select from your jobs table for
the job details.

If you've got a text database, then add a keyword field to each record and try to
match the search string:

while( <DB> )
{
($blah, $blah, $blah, $keyword_field, $blah, $blah, $blah ) = split ( /$delim/,
$_ );
if( $keyword_field =~ /$search/ )
{
   # match found!
}
}

The true answer lies in the details of your application.

Chuck


chall5@hotmail.com wrote:

> Could anyone please tell me what the best way to provide a search facility on
> my website is using Perl scripting and CGI.  I have a CGI-BIN and am trying
> to achieve a search function for a job database.
>
> Also what would be the format of the database file that the jobs were stored
> in ? Would it be a .txt file or something more complicated ?
>
> Any help appreciated.
>
> chris hall
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own






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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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


------------------------------
End of Perl-Users Digest V8 Issue 4521
**************************************

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