[10152] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3745 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 17 21:08:56 1998

Date: Thu, 17 Sep 98 18:00:24 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 17 Sep 1998     Volume: 8 Number: 3745

Today's topics:
    Re: Building perl5.005_02 with Cygwin32 b19.1 (Adam Turoff)
    Re: collecting string padding techniques (Abigail)
    Re: Cookies? (brian d foy)
    Re: Cookies? <milkman@dave-world.net>
        doing a compare with a variable (Steve .)
        finding out last Sunday (Steve .)
    Re: finding out last Sunday (Abigail)
    Re: Formatting a variable to three digits <jeff@vpservices.com>
    Re: Formatting a variable to three digits <uri@camel.fastserv.com>
        formmail with peer web services stan_tall_man@hotmail.com
        Glob inside a foreach loop (Matt Goddard)
    Re: Glob inside a foreach loop (Sam Holden)
    Re: Glob inside a foreach loop (Sam Holden)
    Re: HELP! SSI error NWS (Alastair)
    Re: how safe is xor encryption ? (Jim Michael)
    Re: how safe is xor encryption ? <merlyn@stonehenge.com>
    Re: how safe is xor encryption ? <fsg@newsguy.com>
        IO::Select Problems <edwin.ramirez@erols.com>
    Re: Kermit Speaks <sneaker@sneex.fccj.org>
        newbie - ms access database on unix <int@rz.fh-augsburg.de>
    Re: Newbie needs help (Alastair)
        newbie trying to create library - questions <arranp@datamail.co.nz>
        passing argument !!!! nguyen.van@imvi.bls.com
    Re: perl video games <sneaker@sneex.fccj.org>
    Re: Popping into a Dir. <jdf@pobox.com>
        print statement. Please help nguyen.van@imvi.bls.com
    Re: print statement. Please help (Sam Holden)
    Re: print statement. Please help (Alastair)
    Re: split() from within C (Ken Fox)
    Re: to greg bacon (Asher)
    Re: What is Perl related? [was Re: how safe is xor encr <sauvin@osmic.com>
    Re: Who posts original posts on CLPM? (Asher)
    Re: Who posts original posts on CLPM? (Asher)
    Re: Who posts original posts on CLPM? <sauvin@osmic.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 17 Sep 1998 19:33:21 -0400
From: ziggy@panix.com (Adam Turoff)
Subject: Re: Building perl5.005_02 with Cygwin32 b19.1
Message-Id: <6ts681$icn@panix.com>

In article <36000ca4.0@news.cc.umr.edu>, David Fannin <dpf@umr.edu> wrote:
>Has anyone been able to successfully build perl5.005_02 with the Cygnus
>tools version b19.1 under Windows NT 4.0 with SP3?  I've tried this a couple
>of times and given up because Configure only stops at every other line when
>asking for input.  Is there a fix for this behavior besides copying the
>hints file and not running in interactive mode?  

The few times I tried to build perl w/cygwin32, I found that if I ran
the bash script from the command shell (cmd.exe), things were torturously
slow.

When I was already inside bash, performance was more reasonable.  I'm
guessing that's because it didn't need to shell out nearly as much from
bash as from that lazy, miserable excuse for a shell M$ ships.

HTH,

Z.



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

Date: 17 Sep 1998 23:40:37 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: collecting string padding techniques
Message-Id: <6ts6ll$sbn$1@client3.news.psi.net>

Uri Guttman (uri@camel.fastserv.com) wrote on MDCCCXLIII September
MCMXCIII in <URL: news:sar4su68l2e.fsf@camel.fastserv.com>:
++ 
++ this is a call to prove TIMTOWTDI is a large value.
++ 
++ postings of how to pad numbers or strings are getting to be an FAQ. we
++ should add that to the master FAQ. someone asked me (as i expressed
++ interest in this idea) to write up the faq. i am asking for all you
++ favorite padding code ideas. i have seen many posted. IIRC randal once
++ posted 10 new ones but i couldn't find it on dejanews.
++ 
++ i want both right and left justification and 0 and blank (or arbitrary)
++ pad chars.
++ 
++ so here are some to start the list:
++ 
++ (assume $pad_len is set)
++ 
++ # sprintf doesn't support arbitrary pad chars, just 0 and blank
++ # note that %d and %s do the same thing so you can left zero pad arbitrary
++ # strings!
++ 
++ # left padding with 0 
++ 
++ $padded = sprintf( "%0{$pad_len}d", $num ) ;
++ 
++ # left padding with blank 
++ 
++ $padded = sprintf( "%{$pad_len}s", $text ) ;
++ 
++ # right padding with blank
++ 
++ $padded = sprintf( "%{$pad_len}d", $num ) ;
++ 
++ # prepending the pad with x and .
++ 
++ $padded = '0' x ($pad_len - length( $num )) . $num ;
++ 
++ # or right padded version
++ 
++ $padded = $num . '0' x ($pad_len - length( $num )) ;
++ 
++ # or you can right pad $num directly
++ 
++ $num .= '0' x ($pad_len - length( $num )) ;
++ 
++ # prepending the pad using x and substr
++ 
++ $padded = substr( $padded = $num, 0, 0 ) = '0' x ($pad_len - length( $num )) ;
++ 
++ # make the longest possible padded text, then substr to get the
++ # padded string. this pads on the left
++ 
++ $padded = substr( '0' x $pad_len . $num, -$pad_len ) ;
++ 
++ # same but pad on the right
++ 
++ $padded = substr( $num . '0' x $pad_len , 0, $pad_len ) ;
++ 
++ # modifies $num, pads on right
++ 
++ substr( $num .= '0' x $pad_len, $pad_len ) = '' ;
++ 
++ # pack can blank pad on the right
++ 
++ $padded = pack "A$pad_len", $num ;
++ 


# Right padded:
$text =~ s/(.*)/$1 . ' ' x ($pad_len - length $1)/e;

# Left padded:
$text =~ s/(.*)/' ' x ($pad_len - length $1) . $1/e;

# Right padded:
substr ($text .= ' ' x $pad_len, $padlen) =~ s/.+//;

# Left padded:
substr ($text = " " x $pad_len . $text, 0, -$pad_len) =~ s/.+//;

# Right padded:
join "" => grep {$i ++ < $pad_len} (split // => $text), ' ' x $pad_len;

# Right padded:
$text .= " " while length $text < $pad_len;

# Left padded:
$text = " $text" while length $text < $pad_len;

# Right padded:
$text =~ s/$/ / while length $text < $pad_len;

# Left padded:
$text =~ s/^/ / while length $text < $pad_len;

# Right padded
$text = reverse join "" => map {length () ? $_ : " "}
                           map {chop $text} 1 .. $pad_len;

# Right padded
$text .= " " for 1 .. $pad_len - length $text; print "<$text>\n"'

# Left padded
$text = " $text" for 1 .. $pad_len - length $text; print "<$text>\n"'

# Right padded (will fail if text contains \0s)
($text ^= "\0" x $pad_len) =~ s/\0/ /g;

# Right padded (will fail if length $text > $pad_len).
$text ^= " " x $pad_len ^ " " x length $text;


Etc....


Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Addition/s) [0]'


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

Date: Thu, 17 Sep 1998 18:54:03 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Cookies?
Message-Id: <comdog-ya02408000R1709981854030001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6trjuc$f3s$1@nnrp1.dejanews.com>, wyndo@cxo.com posted:

>> How do you set a cookie in Perl(Win32)? I tried to set an environment
>> variable but the next .pl file could not get the value from the variable. Is
>> there any way to pass a variable without a post or get with the value in the
>> url?

>whatever.cgi?somevar=15&someothervar=18&whatever=6
>
>This will AUTOMATICALLY be viewed by perl as a "GET" operation.

you're slightly confused on the mechanics.  a query string does not
automatically make something a GET.  you need to provide a context
for that URL.  furthermore, it's not up to Perl to decide what sort
of request it is.  that is determined before Perl even gets a chance
to do anything.

>I'm writing a full sized RPG (web
>game) in Perl, and I'm maintaining state this way, only using a cookie as a
>"checksum" to make sure nobody cheats.

might as well put the checksum with the rest of the data.  cookies are
easy to spoof.  i think Randal even wrote about that in one of his 
WebTechnique columns about proxies :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers needs volunteers! <URL:http://www.pm.org/to-do.html>


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

Date: Thu, 17 Sep 1998 19:45:39 -0700
From: "Kurt Lange" <milkman@dave-world.net>
Subject: Re: Cookies?
Message-Id: <3601ad15.0@nt.dave-world.net>

Javascript is a widely accepted scripting language(i.e. Internet Explorer
and Netscape).  I had the same problem, so I just made the perl script
"write" the javascript along with the other HTML.  It's not a very good
workaround(lot's of typing-get's a little confusing), but it does work.

Example
write "function PrintHello()\n";
write "{\n";
write "alert(\"hello\");\n";
write "}\n";

Another way, for which I prefer, is to write the javascript in a seperate
file, then in the course of writing to the HTML page, open the file and
write it also.  This will save all the needless typing of the "print"
statement.

milkman@dave-world.net

wyndo@cxo.com wrote in message <6trjuc$f3s$1@nnrp1.dejanews.com>...
>
>> How do you set a cookie in Perl(Win32)? I tried to set an environment
>> variable but the next .pl file could not get the value from the variable.
Is
>> there any way to pass a variable without a post or get with the value in
the
>> url?
>
>Call your CGI program like this:
>
>whatever.cgi?somevar=15&someothervar=18&whatever=6
>
>This will AUTOMATICALLY be viewed by perl as a "GET" operation. Just read
all
>those variables in like normal. You should be able to completely maintain
>state among multiple CGI programs by simply generating all your links via
CGI
>with the right parameters after the URL. I'm writing a full sized RPG (web
>game) in Perl, and I'm maintaining state this way, only using a cookie as a
>"checksum" to make sure nobody cheats.
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum
>




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

Date: Thu, 17 Sep 1998 22:23:13 GMT
From: syarbrou@ais.net (Steve .)
Subject: doing a compare with a variable
Message-Id: <36018b43.2618328@news.ais.net>

I have a variable equal to:

$var=dog7

I then have a section:

if ($dot =~ /$var/)
  {
    bla bla bla
  }

Even though I know the value $dot contains the value of var, it
doesn't seem to realize it.  Can you do the above comparisons with
variables or do they have to be static items?  If not, how do you word
the above.

Also, can you do the same as above, but have $dot be an array and see
if the value is in the array?  Thanks.

Steve


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

Date: Thu, 17 Sep 1998 22:01:52 GMT
From: syarbrou@ais.net (Steve .)
Subject: finding out last Sunday
Message-Id: <3601865a.1360881@news.ais.net>

I have a program that basically states:

Stats for the current week through xx/xx/xx

What I would like to do is say something like:

Stats for the week starting on xx/xx/xx
where the xx/xx/xx above is the Sunday for the current week.  In other
words if this is Monday, I want yesterday's date.  I could store the
info in a file when the logs are cleared, but figured there was a
cleaner way of doing it.  Thanks.

Steve


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

Date: 17 Sep 1998 23:49:02 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: finding out last Sunday
Message-Id: <6ts75e$sbn$2@client3.news.psi.net>

Steve . (syarbrou@ais.net) wrote on MDCCCXLIII September MCMXCIII in
<URL: news:3601865a.1360881@news.ais.net>:
++ I have a program that basically states:
++ 
++ Stats for the current week through xx/xx/xx
++ 
++ What I would like to do is say something like:
++ 
++ Stats for the week starting on xx/xx/xx
++ where the xx/xx/xx above is the Sunday for the current week.  In other
++ words if this is Monday, I want yesterday's date.  I could store the
++ info in a file when the logs are cleared, but figured there was a
++ cleaner way of doing it.  Thanks.


perl -MDate::Manip -wle 'print UnixDate ParseDate ("last sunday"), "%x"'



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


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

Date: 17 Sep 1998 22:10:07 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Formatting a variable to three digits
Message-Id: <3601881E.831A72AB@vpservices.com>

Uri Guttman wrote:

[Jeff's bad code snipped by Jeff ...]

> the idea is valid but the padding code is blecchh!

Yes, well put.

>         return '0' x ($desired_length - length( $num ) ) . $num ;
> or
>         return sprintf( "%.$desired_length", $num ) ;

Thx, I knew there was a better way.

> there have been many padding algorithms posted but none use a loop for
> each char!

Mea culpa.  Isn't the Perl motto "There's more than one wrong way to do
it"?

- Jeff


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

Date: 17 Sep 1998 19:09:34 -0400
From: Uri Guttman <uri@camel.fastserv.com>
To: jeff@vpservices.com
Subject: Re: Formatting a variable to three digits
Message-Id: <saryari72vl.fsf@camel.fastserv.com>

>>>>> "JZ" == Jeff Zucker <jeff@vpservices.com> writes:

  JZ> Uri Guttman wrote:
  JZ> [Jeff's bad code snipped by Jeff ...]

  >> the idea is valid but the padding code is blecchh!

  JZ> Yes, well put.

thanx.

  >> return '0' x ($desired_length - length( $num ) ) . $num ;
  >> or
  >> return sprintf( "%.$desired_length", $num ) ;

see my recent post for many other techniques and i am looking to collect more.

  JZ> Thx, I knew there was a better way.

then why didn't you use one? :-)

  >> there have been many padding algorithms posted but none use a loop for
  >> each char!

  JZ> Mea culpa.  Isn't the Perl motto "There's more than one wrong way to do
  JZ> it"?

close but no cigar! 

and remember, sometimes a cigar is a phallic object and not a phallic
symbol!

:-)

uri

-- 
Uri Guttman                             Speed up your web server with Fast CGI!
uri@fastengines.com                                  http://www.fastengines.com


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

Date: Thu, 17 Sep 1998 22:25:52 GMT
From: stan_tall_man@hotmail.com
Subject: formmail with peer web services
Message-Id: <6ts29g$af$1@nnrp1.dejanews.com>

I'm trying to get formmail to work with peer web services for windows.  I've
got perl installed, and it works great, but when I try to access formmail via
the web, it gives me an error "HTTP/1.0 501 Not Supported".  Is this because
i'm using peer web services, or is there some way to fix this?
Any suggestion would be appreciated.
thanks

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Thu, 17 Sep 1998 23:36:33 GMT
From: mgoddard@REMOVETHISrosetta.org (Matt Goddard)
Subject: Glob inside a foreach loop
Message-Id: <36019bf6.268691287@thor>

Okay, this one has me baffled. It seems too easy to be true, I guess.
I'm on a WinNT system, with @directories containing a list of
directories (all formatted just fine). So now, I try to go through
this list with a foreach loop, looking for a specific file type like
so:

foreach $dir (@directories) {
   Win32::SetCwd $dir;
   @files = glob('*.tif');
}
foreach (@files) {print; print"\n";}

Nothing fails, but nothing gets printed in the last foreach loop. I'm
looking for the files with a .TIF extension, and also their file sizes
and other info if possible.  Anybody who would tell me what I am
missing, I would be deeply in debt to.
Thanks in advance,

Matt 


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

Date: 18 Sep 1998 00:25:52 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Glob inside a foreach loop
Message-Id: <slrn703a4g.5c8.sholden@pgrad.cs.usyd.edu.au>

On Thu, 17 Sep 1998 23:36:33 GMT, Matt Goddard <mgoddard@REMOVETHISrosetta.org>
	wrote:
>Okay, this one has me baffled. It seems too easy to be true, I guess.
>I'm on a WinNT system, with @directories containing a list of
>directories (all formatted just fine). So now, I try to go through
>this list with a foreach loop, looking for a specific file type like
>so:
>
>foreach $dir (@directories) {
>   Win32::SetCwd $dir;
>   @files = glob('*.tif');
                  ^     ^
                  ^     ^
Get rid of the quotes and you might do a little better...

>}
>foreach (@files) {print; print"\n";}

You do realise that when you get here @files only contains the .tif files
that were found in the last directory in @directories, since you reassign to
@files every time you loop in the first for loop... Maybe push is what you
want?

>
>Nothing fails, but nothing gets printed in the last foreach loop. I'm
>looking for the files with a .TIF extension, and also their file sizes
>and other info if possible.  Anybody who would tell me what I am
>missing, I would be deeply in debt to.
>Thanks in advance,

I suspect it's the wuotes around the glob - although the last directory having
no .tif files would also cause that.

-- 
Sam

Another result of the tyranny of Pascal is that beginners don't use
function pointers.
	--Rob Pike


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

Date: 18 Sep 1998 00:29:07 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Glob inside a foreach loop
Message-Id: <slrn703aaj.5c8.sholden@pgrad.cs.usyd.edu.au>

On 18 Sep 1998 00:25:52 GMT, Sam Holden <sholden@pgrad.cs.usyd.edu.au> wrote:
>On Thu, 17 Sep 1998 23:36:33 GMT, Matt Goddard <mgoddard@REMOVETHISrosetta.org>
>	wrote:
>>   @files = glob('*.tif');
>                  ^     ^
>                  ^     ^
>Get rid of the quotes and you might do a little better...

My bad. Don;t do that or it won't work at all... sorry got confused with
<*.tif>, in fact I went to my 9term and checked with and without quotes but
of course I used <>s insteda of glob(). Sorry.

So I guess the last directory doesn't have ay tifs in it.

-- 
Sam

Of course, in Perl culture, almost nothing is prohibited. My feeling is
that the rest of the world already has plenty of perfectly good
prohibitions, so why invent more?  --Larry Wall


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

Date: Thu, 17 Sep 1998 22:06:03 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: HELP! SSI error NWS
Message-Id: <slrn7035le.4j.alastair@calliope.demon.co.uk>

Alastair Honeybun <A.Honeybun@cowan.edu.au> wrote:
>Hi
>
>Can anyone help please
>
>Using SSI with Novell Web Server I get this error:

This has _what_ to do with Perl?

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: Thu, 17 Sep 1998 22:09:48 GMT
From: genepool@netcom.com (Jim Michael)
Subject: Re: how safe is xor encryption ?
Message-Id: <genepoolEzG88C.95M@netcom.com>

beyret@my-dejanews.com wrote:


: any advice ? for commercial usage? I checked out PGP 5.0 for unix but its
: licencing is rather expensive for us. (at least for a few months)

I think there are no commercial restrictions on Blowfish.

Cheers,

Jim


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

Date: Fri, 18 Sep 1998 00:29:03 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: how safe is xor encryption ?
Message-Id: <8cemtagt6t.fsf@gadget.cscaper.com>

>>>>> "Mark-Jason" == Mark-Jason Dominus <mjd@op.net> writes:

Mark-Jason> One decimal digit contains the same information as 3.322 binary
Mark-Jason> digits.  A credit card number is 16 digits long, so it contains
Mark-Jason> 16*3.332 = 53.15 bits of information.  (Less, if you discount for the
Mark-Jason> check digits.) 

Exactly 3.332 bits less, by my determination. :)
(The final digit is completely computable from the remaining digits.)

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Thu, 17 Sep 1998 17:10:52 -0700
From: "Felix S. Gallo" <fsg@newsguy.com>
Subject: Re: how safe is xor encryption ?
Message-Id: <6ts88v$apu@enews1.newsguy.com>


Abigail writes:
>Felix S. Gallo writes:
>++ Possession of such a thing can easily be faked when purchasing over
>++ long distances.
>
>People seem to have no problem with that when it comes to CC#'s themselves.

Sociologically, they have no problem, but in reality, many millions of
dollars
are lost per year because of credit card fraud and theft.  Which is why I
said that what you really want is to carry around 2 megabits of key.

By the way, if I keep posting unrelated topics to a perl newsgroup, pretty
soon I'm going to catch up to Tom Christiansen in Usenet points!

Felix




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

Date: Thu, 17 Sep 1998 20:33:03 -0400
From: "Edwin S. Ramirez" <edwin.ramirez@erols.com>
Subject: IO::Select Problems
Message-Id: <3601AA3F.98C51465@erols.com>

Hello,

    I have a network app which uses IO::Socket and IO::Select to listen
for connections and incomming messages.  The problem is that when the
program receives multiple lines, how do I find out how many lines of
data are awaiting on the socket?

    I tried turning blocking off and reading all the lines from the
socket, however, Select does not seem to work after modifying the
blocking (I tried turning blocking on again).  Select simply returns an
empty array even if there is data on the socket.

    Does anyone have any ideas?

Thanks,

Edwin Ramirez



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

Date: Thu, 17 Sep 1998 19:53:25 -0400
From: Bill 'Sneex' Jones <sneaker@sneex.fccj.org>
Subject: Re: Kermit Speaks
Message-Id: <3601A0F5.5778B224@sneex.fccj.org>

John Porter wrote:
> 
> hand,
> John Porter

hand = have a nice day, as opposed to
"Talk to the hand, cause the face don't understand."

This caused a small fray in the distant past.

:]
-Sneex-  (who generally likes Abigail(s); generally :)
__________________________________________________________________
Bill Jones | FCCJ Webmaster | http://webmaster.fccj.org/Webmaster
__________________________________________________________________
We are the CLPM... Lower your standards and surrender your code...
We will add your biological and technological distinctiveness to 
our own... Your thoughts will adapt to service us...
 ...Resistance is futile...


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

Date: Fri, 18 Sep 1998 01:24:54 +0200
From: "Aurel" <int@rz.fh-augsburg.de>
Subject: newbie - ms access database on unix
Message-Id: <6ts5p1$b13$1@av2.rz.fh-augsburg.de>

How can i access an ms-access database with perl
that is running on solaris-unix machine.
Im already a bit familiar with perl but without a clue
in that case.

thanks for any help

Norbert




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

Date: Thu, 17 Sep 1998 21:57:35 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Newbie needs help
Message-Id: <slrn70355h.4j.alastair@calliope.demon.co.uk>

Maxim Weinstein <weinstem@bms.com> wrote:
>I'm a perl newbie, though I have a _little_ C programming experience.
>I'm trying to create a script that does significant file manipulation,
>but I'm unsure how to do it, even after looking over a few perl
>resources.

I'm sorry if you only want to see a response along the lines of a 'pre-canned'
program but I think I have very good advice.

Basically, you need to do more than merely 'look' over a few perl resources
(whatever they are). If you want to learn and understand, the best way is to
actually get stuck in and try things out. It really isn't hard. The program you
want is pretty straightforward. 

I'd buy a book on perl (e.g. Learning Perl from O'Reilly) and start to read and,
more importantly, try.

Good luck.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: Fri, 18 Sep 1998 10:41:41 +1200
From: Arran Price <arranp@datamail.co.nz>
Subject: newbie trying to create library - questions
Message-Id: <36019025.BDD@datamail.co.nz>

Hi all,

I have created a reasonably complex script that needs to used as at
template for creating many similar scripts.
What I would like to do is put all the standard sub routines/procedures
in a library/module that can be called by the other scritps. Reasons
a) cuts down the size of all the the new scritps
b) one point for global changes 

I have read thru the man pages, the camel book and checked the net.
What I understand so far (please correct me if Im off the track here)
- libraries were used in perl4 but now modules are used in perl5
this makes libraries pretty much obsolete? I should be using modules?
-modules have the extension .pm
- you use uses to call modules?
-libraries have the extension .pl
- you use requires to call libraries?

The merlmod manpage tends to be very descriptive on how to create
modules and publish them for the greater good, but lacks the
fundamentals that I need.

take the following scripts for example (this is a first attempt)

file froglib.pl
#!/usr/local/bin/perl
#Description: Test of Library Functionality

sub PRINTFROG
{
   print"frog=$FROG\n";
   $CAT="fluffy";
}

1;

file frog.pl
#!/usr/local/bin/perl
#Descrtipion should call froglib.pl

unshift(@INC,".");
require "froglib.pl";
print "librarydirs = @INC\n";
$FROG="kermit";
froglib::PRINT_FROG;
print"cat = $CAT\n";


what I was hoping for was an output of
Frog=kermit
cat=fluffy

If anyone can help me with this or point me to an idiots guide or
something I would be extremelly grateful.

cheers

Arran 
My opinions are my own and not those of my employer.


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

Date: Thu, 17 Sep 1998 22:45:09 GMT
From: nguyen.van@imvi.bls.com
Subject: passing argument !!!!
Message-Id: <6ts3dl$1c4$1@nnrp1.dejanews.com>

I try to pass an argument from perl script to korn script which is called by
perl script. The following is my code:

system("browser_crno.ksh $DATE > $DOCS_DIR/$out_put");

where $DATE is the perl's and korn's argument.

This seems not working for me. Thanks in advance.

Van

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Thu, 17 Sep 1998 19:56:37 -0400
From: Bill 'Sneex' Jones <sneaker@sneex.fccj.org>
Subject: Re: perl video games
Message-Id: <3601A1B5.EB2404A8@sneex.fccj.org>

Adam Ziegler wrote:
> 
> Would it ever be possible to program video games with PERL, even simple
> ones?
> 
> --
> Adam Ziegler

Yes.

Lookup ANSI screen codes, etc...
-Sneex- 
__________________________________________________________________
Bill Jones | FCCJ Webmaster | http://webmaster.fccj.org/Webmaster
__________________________________________________________________
We are the CLPM... Lower your standards and surrender your code...
We will add your biological and technological distinctiveness to 
our own... Your thoughts will adapt to service us...
 ...Resistance is futile...


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

Date: 18 Sep 1998 02:53:18 +0200
From: Jonathan Feinberg <jdf@pobox.com>
To: wayne_allison@hotmail.com
Subject: Re: Popping into a Dir.
Message-Id: <m3d88u44xt.fsf@joshua.panix.com>

wayne_allison@hotmail.com writes:

> All, I had the idea to implement a popping dir type object where it
> would move you to directory on creation and move you back when the
> object died.

This works for me.  Maybe it will give you some ideas.

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

   package PopDir;
   use Cwd;
   sub new {  
     my ($class, $dir) = @_;
     my $cwd = cwd;
     chdir $dir || die "$dir: $!\n";
     bless { cwd => $cwd }, $_[0] 
   }
   sub DESTROY { chdir $_[0]->{cwd} || die "$_[0]->{cwd}: $!\n" }

   package main;
   use Cwd;
   chdir $ENV{HOME};
   printf "cwd: %s\n", cwd;
   {
     my $d = new PopDir '/tmp';
     printf "cwd: %s\n", cwd;  
   }
   printf "cwd: %s\n", cwd;


-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Thu, 17 Sep 1998 23:08:00 GMT
From: nguyen.van@imvi.bls.com
Subject: print statement. Please help
Message-Id: <6ts4og$2rd$1@nnrp1.dejanews.com>

Hi guys,

I have this problem. The following is my code:

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

($day, $month, $year) = (localtime)[3,4,5];
$current_date = printf ("%04d%02d%02d", $year+1900, $month+1, $day);
chop ($current_date);
printf "$current_date\n";

up to this point, it's alright but have problem with the folowing:
I want to concatenate strings together

$out_put =  $current_date . ".browser.html";
print $out_put, "\n";

however, this doesn't work for me any idea?

Thanks
Van Nguyen

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 18 Sep 1998 00:18:55 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: print statement. Please help
Message-Id: <slrn7039nf.5c8.sholden@pgrad.cs.usyd.edu.au>

On Thu, 17 Sep 1998 23:08:00 GMT, nguyen.van@imvi.bls.com
	<nguyen.van@imvi.bls.com> wrote:
>Hi guys,
>
>I have this problem. The following is my code:
>
>----------------------------------------------------
>
>($day, $month, $year) = (localtime)[3,4,5];
>$current_date = printf ("%04d%02d%02d", $year+1900, $month+1, $day);
>chop ($current_date);
>printf "$current_date\n";
>
>up to this point, it's alright but have problem with the folowing:
>I want to concatenate strings together
>
>$out_put =  $current_date . ".browser.html";
>print $out_put, "\n";
>
>however, this doesn't work for me any idea?

Saying what it did and what you expected would be usefull...

That code does exactly what you asked it too...

You printf the date and assign the return value of printf to $current_date. You
then chop $current_date which evectively removes the return value from it
and leaves you with the empty string. Then you print various things out the
hard way...

Possibly you want sprintf...

Possibly you might want to run your code in with perl -d...

The second printf is also a but excessive - maybe print would be better...

$current_date.browser.html" is also a bit clearer for that last assignment...

-- 
Sam

People get annoyed when you try to debug them.
	--Larry Wall


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

Date: Fri, 18 Sep 1998 00:18:58 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: print statement. Please help
Message-Id: <slrn703dek.4j.alastair@calliope.demon.co.uk>

nguyen.van@imvi.bls.com <nguyen.van@imvi.bls.com> wrote:
>Hi guys,
>
>I have this problem. The following is my code:
>
>----------------------------------------------------
>
>($day, $month, $year) = (localtime)[3,4,5];
>$current_date = printf ("%04d%02d%02d", $year+1900, $month+1, $day);

You're printing the string here and $current_date is getting the return value of
the printf statement.

>chop ($current_date);
>printf "$current_date\n";

You're _not_ printing the 'date' here - $current_date is not what you think.

>up to this point, it's alright but have problem with the folowing:
>I want to concatenate strings together
>
>$out_put =  $current_date . ".browser.html";
>print $out_put, "\n";

So this just prints '.browser.html'.


You probably want to look at 'sprintf' here.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: 17 Sep 1998 23:01:36 GMT
From: kfox@pt0204.pto.ford.com (Ken Fox)
Subject: Re: split() from within C
Message-Id: <6ts4cg$78k6@eccws1.dearborn.ford.com>

Jeff Murphy <jcmurphy+usenet@smurfland.cit.buffalo.edu> writes:
> I'm writing a perlmodule and would like to call split() from
> within the C code. ...
> I checked out the perlembed page, but i'm not sure if I
> need to:
>
>  my_perl = perl_alloc();
>  perl_construct(my_perl);

You don't.  A perl interpreter (maybe more than one!) is already
running.  You do need to set up the call to split() by dispatching through
the interpreter though -- it's quite unsafe to try to set up the stack
yourself.

The hard way is to write a subroutine that does the split() call you need.
You put the sub in the Perl part of your module (*.pm file) and fetch a
pointer to it with perl_get_cv().  (I'd call an initialization function
to fetch this pointer.  Call the init at the *end* of your *.pm file.)

Write the split subroutine like this:

   sub do_split {
       @{$_[0]} = split($_[1], $_[2]);
   }

It looks a bit weird, but simplifies the C code a lot.

In order to call your split subroutine, you'll need to use
perl_call_sv().  You'll have to push 3 args onto the stack and
then call perl_call_sv().  It will be something like this:

    dSP;

    av_clear(results);

    ENTER;
    SAVETMPS;

    PUSHMARK(sp);
    XPUSHs(sv_2mortal(newRV_inc(results)));
    XPUSHs(sv_2mortal(newSVpv("pattern", 0)));
    XPUSHs(sv_2mortal(newSVpv("text", 0)));
    PUTBACK;

    perl_call_sv(do_split, G_SCALAR | G_DISCARD);

    /* do something with the results array which will
       hold the results of the split() */

    FREETMPS;
    LEAVE;

There are lots of ways to optimize this, but I'd wait until
you get the basics working.  You can always ask another question. ;)

If the hard way is too hard, then try the easy way:  rewrite your
code so that you don't need split(). ;)  This isn't as silly as it
sounds.  You can easily put the user-visible subroutines into the *.pm
file.  Have those call simple (but gross and cryptic) C code interfaces
that the user will never have to use directly.  There is *zero*
performance advantage to having C do the split() instead of Perl code.

> since it's within a perl module .. i'm also not sure how to retrieve
> the (return) array values from the stack.

Well, you'd use POPs() or something like it.  That's kind of clunky
for dealing with split() though.  It's much easier to use an array.

Hope this helps.

- Ken

-- 
Ken Fox (kfox@ford.com)                  | My opinions or statements do
                                         | not represent those of, nor are
Ford Motor Company, Powertrain           | endorsed by, Ford Motor Company.
Analytical Powertrain Methods Department |
Software Development Section             | "Is this some sort of trick
                                         |  question or what?" -- Calvin


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

Date: 18 Sep 1998 00:00:00 GMT
From: asher@magicnet.net (Asher)
Subject: Re: to greg bacon
Message-Id: <slrn703875.h7.asher@localhost.localdomain>

On 16 Sep 98 07:45:49 GMT, MercuryZ <sf@sf.com> wrote:
>In article <6tmfsp$g8t$1@info.uah.edu>, gbacon@cs.uah.edu says...
>>
>>In article <35feb006.0@news.ptw.com>,
>>        sf@sf.com (MercuryZ) writes:
>>: I want to automate downloads through Perl.  Lynx is my choice
>>: for this.
>>
>>You chose poorly.  You want to use LWP or perhaps Net::FTP, both of
>>which are available on the CPAN.
>>
>>Greg
>
>
>I appreciate your response greg, but I am more curious at this point
>to make Perl automatically press "D" for me...I do know Perl quite well,
>but for some reason I can't seem to figure out this simple dilemma.
>Can you tell me how to make Perl automatically press a key so you
>can control the behaviour of a program like lynx through a telnet
>shell?  
>
>Thanks, Sean
>
Sean, if your main interest is exploring Perl's ability to simulate a user
and press keys, check out open2.  (Type perldoc open2).  This spawns a
process (e.g. lynx) with a pipe for writing to the process and one for 
reading from the process.  I haven't tried it with single-keypress commands -
maybe setting $|=1 will let your "D" key go without a \n.



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

Date: Thu, 17 Sep 1998 18:26:13 -0400
From: Ben Sauvin <sauvin@osmic.com>
Subject: Re: What is Perl related? [was Re: how safe is xor encryption ?]
Message-Id: <36018C85.CD05464F@osmic.com>


    One suspects that the border between "perl-related" and something else
divides that which is explicitly furnished by the Perl programming language,
its various modules and incidental accompanying documentation from that
which can be addressed by any (or most) programming languages, even if only
at the concept level.

Elaine -HappyFunBall- Ashton wrote:

> Ronald J Kimball wrote:
>
> > Why do people have such a broad idea of 'what is Perl related'.  This
> > was started by someone who wanted to do an e-commerce solution,
> > coincidentally in Perl.  And the discussion has continued to have
> > nothing whatsoever to do with Perl.
>
> Take my point. Perl is not an entity living in a vacuum independent of
> anything else. Yes, it did start out as a Perl question on e-commerce
> but digressed into a discussion on security and encryption. Perhaps you
> are uninterested in anything along those lines, but since Perl people in
> my general experience tend to be 'jack of all trade' type of people, it
> was somewhat a linear progression of the topic.
>
> Security is an important point whether you're dealing with Perl or
> something else. And certainly it was a much more interesting discourse
> than 'hey, why doesn't this 3 line perl program work?'. It's only Usenet
>
> e.
>
> "All of us, all of us, all of us trying to save our immortal souls, some
> ways seemingly more round-about and mysterious than others. We're having
> a good time here. But hope all will be revealed soon."  R. Carver



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

Date: 17 Sep 1998 23:15:53 GMT
From: asher@magicnet.net (Asher)
Subject: Re: Who posts original posts on CLPM?
Message-Id: <slrn7035ke.h7.asher@localhost.localdomain>

On Wed, 16 Sep 1998 23:35:36 -0400, Ronald J Kimball <rjk@coos.dartmouth.edu>
 wrote:
[ root post numbers for Windows/*nix ]
>
>Possible explanations for this hypothetical statistic:
>
>1.  The number of posts from Windows users is equal to the number of
>posts from Unix users, but Windows users are more likely to post root
>messages.
>
>2.  The number of posts from Windows users is significantly greater than
>the number of posts from Unix users, and Windows users post root
>messages and followup messages with equal likelihood.
>

The web page shows both root posts and follw-up posts.  You should be
able to decide which explanation is more valid by looking at the graph.
By the way, thanks for pointing out the MacSOUP counting error - it's
since been fixed.

Since the original post has expired (here, anyway), the URL is:
www.magicnet.net/~asher/comp.lang.perl.misc.html


>
>You need to consider all four combinations of operating system and post
>type in order to calculate correlation.
>
>
>Personally, my objection is not with the conclusion that Windows users
>are more likely to post root messages; this could very well be the case,
>although I have not yet seen a statistical analysis which proves it.  I
>object to the conclusion that Windows users are more likely to post
>'misguided' messages, based on the unfortunate assumption that all root
>messages are 'misguided' messages.

I agree; not all root messages are misguided.  



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

Date: 17 Sep 1998 23:34:44 GMT
From: asher@magicnet.net (Asher)
Subject: Re: Who posts original posts on CLPM?
Message-Id: <slrn7036no.h7.asher@localhost.localdomain>

On Thu, 17 Sep 1998 15:23:28 GMT, Elaine -HappyFunBall- Ashton 
<eashton@bbnplanet.com> wrote:
[ statistical discussion snipped]

>If the person who posted the original article would like to take the
>challenge, I would be interested in seeing an on-line survey or
>something along those lines to collect data and then prove/disprove the
>earlier assumptions. This would be done with Perl of course :)
That survey might be a fun project.  However, I'm not sure what we'd
be aiming for - can you suggest some likely questions for the survey?
I mean, we can't very well ask people,

     "Do you tend to post misguided[1] messages to news groups?"

Or can we?

As you've probably guessed, the original web page owes its existence
to Perl.  Coding it in C, for example, would have been a markedly
unpleasant experience.

[1] Not my word, but seems to keep popping up in this discussion.

>
>> note: I am not a statistician...though I have played one in a previous
>> life...as such, all my remarks are within some bounded set of standard
>> error and may, or may not, be incorrect.
>
>cute.
>
>e.
>
>"All of us, all of us, all of us trying to save our immortal souls, some
>ways seemingly more round-about and mysterious than others. We're having
>a good time here. But hope all will be revealed soon."  R. Carver


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

Date: Thu, 17 Sep 1998 19:41:13 -0400
From: Ben Sauvin <sauvin@osmic.com>
Subject: Re: Who posts original posts on CLPM?
Message-Id: <36019E19.6CD90E41@osmic.com>

    It shouldn't be a very big trick merely to download all the messages in
comp.lang.perl* to examine for subject, references and xmailer (and probably one
of the timestamps) for correlation purposes.


Asher wrote:

> On Wed, 16 Sep 1998 23:35:36 -0400, Ronald J Kimball <rjk@coos.dartmouth.edu>
>  wrote:
> [ root post numbers for Windows/*nix ]
> >
> >Possible explanations for this hypothetical statistic:
> >
> >1.  The number of posts from Windows users is equal to the number of
> >posts from Unix users, but Windows users are more likely to post root
> >messages.
> >
> >2.  The number of posts from Windows users is significantly greater than
> >the number of posts from Unix users, and Windows users post root
> >messages and followup messages with equal likelihood.
> >
>
> The web page shows both root posts and follw-up posts.  You should be
> able to decide which explanation is more valid by looking at the graph.
> By the way, thanks for pointing out the MacSOUP counting error - it's
> since been fixed.
>
> Since the original post has expired (here, anyway), the URL is:
> www.magicnet.net/~asher/comp.lang.perl.misc.html
>
> >
> >You need to consider all four combinations of operating system and post
> >type in order to calculate correlation.
> >
> >
> >Personally, my objection is not with the conclusion that Windows users
> >are more likely to post root messages; this could very well be the case,
> >although I have not yet seen a statistical analysis which proves it.  I
> >object to the conclusion that Windows users are more likely to post
> >'misguided' messages, based on the unfortunate assumption that all root
> >messages are 'misguided' messages.
>
> I agree; not all root messages are misguided.



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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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