[10145] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3738 Volume: 8

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

Date: Thu, 17 Sep 98 07:05:30 -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: 3738

Today's topics:
    Re: any way to encrypt my script? (Michael J Gebis)
    Re: any way to encrypt my script? <qdtcall@esb.ericsson.se>
    Re: DBD::ODBC adding blob data error to Informix Db andy_williams@my-dejanews.com
    Re: editing a database textfile <koos_pol@nl.compuware.com>
    Re: Extending Perl-Win32 by ActiveState? scott@softbase.com
    Re: how safe is xor encryption ? (Stefan Berglund)
    Re: how safe is xor encryption ? <dejah@DejahsPrivateIce.com>
    Re: ifdef in Perl <barnett@houston.Geco-Prakla.slb.com>
    Re: ifdef in Perl dave@mag-sol.com
    Re: leading  space <koos_pol@nl.compuware.com>
    Re: Memory being eated... (David A. Black)
    Re: milliseconds? miho21@yahoo.com
        mod function in PERL? buckybeaver73@yahoo.com
    Re: mod function in PERL? <qdtcall@esb.ericsson.se>
    Re: mod function in PERL? <zenin@bawdycaste.org>
    Re: Perl & Java - differences and uses <zenin@bawdycaste.org>
    Re: Perl & Java - differences and uses <garry@sage.att.com>
    Re: require does not work <ajvdhek@ingbank.com>
    Re: splitting by certain spaces (David A. Black)
    Re: STDOUT into array (Tad McClellan)
    Re: Style question re ($k => $v) <rick.delaney@shaw.wave.ca>
    Re: system() and `` on Win32 scott@softbase.com
    Re: Un-tainting a variable for the following format <garry@america.net>
        Using Mail:: module with WinNT <tor@kmd.dk>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 17 Sep 1998 05:32:11 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: any way to encrypt my script?
Message-Id: <6tq6sr$b2a@mozo.cc.purdue.edu>

abigail@fnx.com (Abigail) writes:
}++                                                Can
}++ I encrypt my script so that it can be executed but not read?

}No.

}perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'

On the other hand, Abigail seems to do be able to do it.

-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

Date: 17 Sep 1998 14:09:20 +0200
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: any way to encrypt my script?
Message-Id: <is67en54b3.fsf@godzilla.kiere.ericsson.se>

dennis@info4.csie.nctu.edu.tw (GEMINI) writes:

> However, if I don't want to show my source code to the world, what
> should I do with my script?

Don't use it where it can be seen.

> Can I encrypt my script so that it can be executed but not read?

No. See the FAQ for details.
-- 
                    Calle Dybedahl, UNIX Sysadmin
       qdtcall@esavionics.se  http://www.lysator.liu.se/~calle/


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

Date: Thu, 17 Sep 1998 10:38:53 GMT
From: andy_williams@my-dejanews.com
Subject: Re: DBD::ODBC adding blob data error to Informix Db
Message-Id: <6tqoru$ijj$1@nnrp1.dejanews.com>

I have tried using
$quotedblob = $dbh->quote($blobdata);
$sth = $dbh->do("insert into test (name,age,type,tblob) values ('Fred Bloggs',
'98', 'A', $quotedblob)");

and this seems to work for the TEXT data type, but I get a Syntax error for
the BYTE data type.

Still need help

Thanks

Andy

In article <6tqhrf$a0f$1@nnrp1.dejanews.com>,
  andy_williams@my-dejanews.com wrote:
> I get the following error when attempting to add blob data to my informix
> database via my perl script. This only happens using INTERSOLV 3.01 32bit ODBC
> driver. It works
> using version 2.80 (Unfortunately I have an other problem with this driver).
>
> "DBD::ODBC::st execute failed: [INTERSOLV][ODBC Informix
> driver][Informix]Illegal attempt to convert Text/Byte blob type."
>
> The code is listed below.
>
> Please help
>
> Andy
>
> print "Reading data...\n";
> open(FH, "test.txt") or die "$!\n";
> @lines = <FH>;
> close FH;
> $blobdata = join("",@lines);
> undef @lines;
>
> print "Create Table.......";
> $sth = $dbh->prepare("create table test \(name CHAR\(20\) PRIMARY KEY, age
> INTEGER, type CHAR\(1\) DEFAULT 'A', tblob TEXT in TEXT1\)");
> die "Prepare failed " . $dbh->errstr . "\n" if $dbh->errstr;
> $sth->execute;
> die "Execute failed " . $dbh->errstr . "\n" if $dbh->errstr;
> print "Ok\n\n";
>
> $sth = $dbh->prepare("insert into test \(name,age,type,tblob\) values \('Fred
> Bloggs', '98', 'A', ?\)"); die "Prepare failed " . $dbh->errstr . "\n" if
> $dbh->errstr; $sth->execute($blobdata); die "Execute failed " . $dbh->errstr
> . "\n" if $dbh->errstr; # The Error occurs  # Here print "Ok\n\n";
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum
>

-----== 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 14:40:55 +0200
From: Koos Pol <koos_pol@nl.compuware.com>
Subject: Re: editing a database textfile
Message-Id: <36010357.7F42@nl.compuware.com>

J. Strijb wrote:
> 
> Hi,
> 
> i want to know how to search trough a pipeline delimited database text
> file,
> and edit the value's i find.
>  example:
> 
> when the following line's are in the file "pizza.txt" .
> 
> pizza|mushrooms|5,50
> pizza|cheese|6,50
> 
> and i want to change the mushroom in to peppers how do i do that.
> 
> Thanks in advance,
> 
> Jeroen Strijb


For on-the-fly-editing quit some nice examples are printed in
perlfaq3. Look for "Can I write useful perl programs on the command
line?"


Koos Pol
----------------------------------------------------------------------
S.C. Pol                          T: +31 20 3116122
Systems Administrator             F: +31 20 3116200
Compuware Europe B.V.             E: Koos_Pol@nl.compuware.com
Amsterdam                         PGP public key available


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

Date: 17 Sep 1998 12:13:57 GMT
From: scott@softbase.com
Subject: Re: Extending Perl-Win32 by ActiveState?
Message-Id: <3600fd05.0@news.new-era.net>

pds@datcon.co.uk wrote:
> Does anyone know how to extend the current version of Perl-Win32 from
> ActiveState?

The easiest way would be to write an Automation DLL and call
it with Win32::OLE.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

Date: 17 Sep 1998 11:19:20 GMT
From: f94stbe+news@dd.chalmers.se (Stefan Berglund)
Subject: Re: how safe is xor encryption ?
Message-Id: <6tqr7o$en6$1@eol.dd.chalmers.se>

beyret@my-dejanews.com wrote:
> I am about to write a simple script to encrypt/decrypt credit card numbers
> using xor and a key supplied by credit card owner. I wanted to learn your
> thoughts about it:

To use the words of Bruce Schneier in Applied Cryptography:
An XOR might keep your kid sister from reading your files, but it
won't stop a cryptanalyst for more than a few minutes.

An XOR is very simple to crack it is really just a polyalphabetic 
Vigenere variant, this is how you do:

1. Discover the keylength.
   Shift the ciphertext against itself various amounts of bytes and
   count those bytes that are equal. When you have shifted a whole
   keylength you will see a dramatic change in the number of equal
   bytes, from less than .4% to something around 6%
   The smallest shiftlength with this large index is the keylength.

2. Get rid of the key and get the plaintext
   Shift the ciphertext that amount of bytes and XOR it against
   itself. This removes the key and leaves you with the plaintext
   XOR:ed with itself shifted keylength bytes. As you know that it is
   a creditcard number and therefor has a specific format (with for
   example a checksum) it is an easy task to discover the number.

This will only take a few seconds with a computer and a couple of
minutes with pen and paper.

What is really frightening is that this algorithm is actually used in
the MS-DOS and Mac world.

Why not use a real crypto algorithm?
PGP is freely available. So is some DES implementations and numerous of
others, see for example ftp://ftp.funet.fi/pub/crypt

I recommend that you get Bruce Schneiers book if you are generally
interested in cryptography and/or use cryptography in your work.

And BTW this has very little to do with perl you will get more
responses (or more probably get flamed...) in sci.crypt* 

Hope that this got you on another track!

-- 
			/Stefan
			f94stbe@dd.chalmers.se

Life - the ultimate practical joke

finger f94stbe.pgp@dd.chalmers.se for public pgp-key


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

Date: Thu, 17 Sep 1998 07:52:37 -0500
From: Mary E Tyler <dejah@DejahsPrivateIce.com>
Subject: Re: how safe is xor encryption ?
Message-Id: <36010614.4A77@DejahsPrivateIce.com>

Mark-Jason Dominus wrote:
> 
> In article <3600635B.6CA8@DejahsPrivateIce.com>,
> Mary E Tyler  <dejah@DejahsPrivateIce.com> wrote:
> >> }If the key is truly random, an xor-based one-time pad is perfectly
> >okay, so how random is random enough?
> 
> The users, as a group, must constitute an ergodic source of
> information with an entropy of at least 53.15 bits per key.
> 
> >this is an actual question.
> 
> That is the actual answer.
> 
> Hope this helps.

thanks mark!

it might have been an answer... but it was not one i understood. except
that it might be some sort of strange joke.

ask lori about having peas for supper tonight.

dejah
-- 
i trust i make myself obscure, i have need of obscurity now- robert bolt

a heated exchange of unread mail would be welcomed by all- christensen

Skating Fiction. Featuring the  highly acclaimed serial On The Edge!
http://www.DejahsPrivateIce.com


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

Date: Thu, 17 Sep 1998 07:40:01 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: ifdef in Perl
Message-Id: <36010321.A9F61FC4@houston.Geco-Prakla.slb.com>

Narasimha G. Pai wrote:
> Hi ,
> 
>      Thanks for the solution . It works except for one thing . I am
> trying to determine $os
>      by calling a function . Do I have to put that in the BEGIN block
> too ?
Why not just:
#!/usr/local/bin/perl -w
my $os = $^O;
print $os, "\n";
__END__

Works fine for me on solaris 2.5.1, should work fine under dos/win as
well.

HTH.

Cheers,
Dave

-- 
Dave Barnett	Software Support Engineer	(281) 596-1434

"Security through obscurity is no security at all."
	- comp.lang.perl.misc newsgroup posting


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

Date: Thu, 17 Sep 1998 12:49:27 GMT
From: dave@mag-sol.com
Subject: Re: ifdef in Perl
Message-Id: <6tr0go$q8r$1@nnrp1.dejanews.com>

In article <3600CA8E.3F5F9D63@cadence.com>,
  "Narasimha G. Pai" <pai@cadence.com> wrote:
> >          I want something like :
> >
> >          if($os eq 'NT'){
> >          use Win32 ;
> >          }
> >          if($os eq 'UNIX'{
> >          #do nothing
> >          }
> >
>
> To check on compile time, what platform you are running on, use BEGIN:
>
> BEGIN { if ($^O =~ /Win32/) { eval 'use Win32;' } }
>
> Take care (and do not post the HTML part next time).
>
> Hi ,
>
>      Thanks for the solution . It works except for one thing . I am
> trying to determine $os
>      by calling a function . Do I have to put that in the BEGIN block
> too ?
>
>    BEGIN{
>
>     $os = $ctfGetOSName ;
>
>     if( $os eq "WINDOWSNT"){
>
>    eval 'use Win32::AdminMisc' ;
>    eval 'use Win32 ';
>
>    }

What are you getting from your function that you can't get from just checking
the value of the $^O variable?

Dave...

--
dave@mag-sol.com
London Perl M[ou]ngers: <http://www.mag-sol.com/London.pm/>

-----== 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 14:31:38 +0200
From: Koos Pol <koos_pol@nl.compuware.com>
Subject: Re: leading  space
Message-Id: <3601012A.3ADB@nl.compuware.com>

Sameer Sharma wrote:
> 
> Hi,
> When i read an entire file into an array
> @array = <FILENAME>
> and then print this array into another file FILENAME1
> print FILENAME1(@array)
> after doing some modifications on the array, I get a leading  space
> in the lines written to FILENAME1. Why is this happening? Can it be
> avoided?

If you show us (part of) your code, we are much more able to
comment on your particular problem.

-- 
Koos Pol
----------------------------------------------------------------------
S.C. Pol                          T: +31 20 3116122
Systems Administrator             F: +31 20 3116200
Compuware Europe B.V.             E: Koos_Pol@nl.compuware.com
Amsterdam                         PGP public key available


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

Date: Thu, 17 Sep 1998 09:24:48 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: Memory being eated...
Message-Id: <6tr2j0$1uu$1@earth.superlink.net>

Hello -

lozano@opalo.etsiig.uniovi.es (Lozano Mosterin, Jesus) writes:

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

>This routine is eating me up all the memory. I don't know why...

>print <<TIA

>sub 
>remove_one_and_only_one_byte_first_BYTE_on_array_DO_IT_DO_IT_ARGGG {
>     if (length($temp[0])>1){
>        $temp[0] =~ s/(^.)(.*)/$2/;
>        if ($1 eq '1') {
>           $tac--;
>        }
>     }else{
>        if ($temp[0] eq '1'){
>           $tac--;
>        }
>        shift @temp;
>     }
>     $len--;
>}

>TIA;


What are you trying to do?  You're using a lot of global variables in the
routine, which makes it extremely hard to understand in isolation.

David Black
dblack@saturn.superlink.net


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

Date: Thu, 17 Sep 1998 10:59:09 GMT
From: miho21@yahoo.com
Subject: Re: milliseconds?
Message-Id: <6tqq1u$jk1$1@nnrp1.dejanews.com>

you know what? forget it... there is no need to explain to me about
programming, since i know some languages like c++ and java. what I do not
know, is perl programming. somehow i got the wrong impression that this group
might be able to help on this specific issue.

there is no need to explain to me about research either, but you know what?
usenet is a big part of my research turf. I find it very helpful to be able
to toss questions and get answers when FAQs dont quite cut it, and they dont
always... I am to understand, however, that comp.lang.perl is not the place
to ask such questions (yes, even stupid questions like "what does $a mean").

Moderate the group, friends. atitudewise you are allready moderated.

back to lurking...

mihoko.

In article <EzEEsK.135@world.std.com>,
  aml@world.std.com (Andrew M. Langmead) wrote:
> I would think that it would save Tom a lot of time if he wrote the
> explanation once and everyone else referred to that explanation if
> they needed it. After all, there are probably more people who want to
> know what qw/STRING/ is than there are of him.
>
> Oh wait. Since he's responsible for a good part (if not most) of the
> standard perl documentation, he probably already did write the
> explanation down. Its in the perlop document. (and if he didn't write
> that particular section, he knew he didn't have to because it was
> already there.) All we need is to have everyone look for their answers
> there.
>
> Programming is something that requires a certain amount of research
> skills. If you post a question for evey single construct you have not
> come accross before, it will get a little tedious, don't you think?
>
> What does "$a" mean?
> What does "=" mean?
> What does "+" mean?
> What do "{" and "}" mean?
> What does "print" mean?
> ...
> What does "use Fctl(:flock)" mean?
> ...
> (ad nauseum)
>
> I think it is time to bring out my Lego analogy again.
>
> The sytactic elements of Perl are similar to the individual elements
> of a Lego set. Each individual block is fairly uninteresting examined
> by itself, but they can be put together in an infinate variety of
> interesting ways. Programmers are very likely programmers because they
> love the infinate possibilities that computers give them, and they
> congregate in places like comp.lang.perl.misc because they love
> discussing with each other things that they can build with the
> language. Discussing the definition of a particular syntactic element
> is about exciting as discussing an individual Lego block.
>
> --
> Andrew Langmead
>


--
"We believe that life, creation, everything is based on mathematics."
                                                 -Zulu Nation

-----== 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 12:30:02 GMT
From: buckybeaver73@yahoo.com
Subject: mod function in PERL?
Message-Id: <6tqvca$p27$1@nnrp1.dejanews.com>

  Hi all... Is there a mod function in perl? I would like to get the
remainder of a division. If there isn't I guess I could always parse the
number out and do the calculation myself... Any help is appreciated.

Thanks,
Justin
buckybeaver73@yahoo.com


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


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

Date: 17 Sep 1998 15:26:01 +0200
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: mod function in PERL?
Message-Id: <is3e9q6fbq.fsf@godzilla.kiere.ericsson.se>

buckybeaver73@yahoo.com writes:

>   Hi all... Is there a mod function in perl? 

Yes. RTFM perlop.
-- 
                    Calle Dybedahl, UNIX Sysadmin
       qdtcall@esavionics.se  http://www.lysator.liu.se/~calle/


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

Date: 17 Sep 1998 13:37:52 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: mod function in PERL?
Message-Id: <906039460.87419@thrush.omix.com>

[posted & mailed]

buckybeaver73@yahoo.com wrote:
:   Hi all... Is there a mod function in perl? I would like to get the
: remainder of a division. If there isn't I guess I could always parse the
: number out and do the calculation myself... Any help is appreciated.

	Modulus?  Same as in C:

	$mod = $this % $that;

	perldoc perlop

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: 17 Sep 98 13:26:55 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Perl & Java - differences and uses
Message-Id: <906039092.538628@thrush.omix.com>

Andrew Dalke <dalke@bioreason.com> wrote:
	>snip
: (Wait, I seem to remember something about if a string
: is used as an re, then the compiled pattern is stored until the
: string changes, In that way, if the string is used as a pattern again
: it doesn't need to recompile.

	Yes and no.  The string they refer to is the pattern string, not
	the string to be searched.  Since the same var is used in each
	iteration of the loop, it must be recompiled for each iteration.

	This is the reason for the string eval() pattern hacks, and the
	reason 5.005 gave us first class patterns.

	>snip<
: Excepting that possible optimization, that's why "q()" is not a
: replacement for "qr()"

	They both work. :-)

: Besides, if I really wanted to force the issue, I'll say
: that my code has to support both POSIX regular expressions
: (implemented in some re library; and POSIX semantics are different
: than perl's)

	Of course they are, because POSIX is broken. :-)

: and perl5 REs, so I cannot put the =~ in the "search" routine.

	Err, huh?

	>snip<
: > Does Python really need the archaic "count = count + 1"?
:
: Dude, with words like that you're pushing close to the language
: war button.

	I thought this already was a war?

	My language is bigger then your language! :-)

: It's for the exact same reason in perl this:
: $b = 5;
: $arr{$b} = "Hello";
: $b++;
: print keys %arr;
: gives you "5" instead of "6"  (If "++" existed in Python as
: you think it should, the python code would return 6).

	Umm, that would be very odd...  Why in heavens would it
	do such a thing with a hash?

: It's the difference between a pass-by-value language and a
: pass-by-reference language.

	You say that like both can not exist in the same language.

: Which is the reason why in python I pass multiple lists without
: needing the reference.
	>snip<
: @c = &vector_add(\@a, \@b);
: as compared to
	>snip<
: c = vector_add(a, b)
: I dunno, seems kinda archaic to me :)

	You're right, not requiring a reference op is pretty archaic. ;-)

	Fact is, list flattening gives Perl far more power then it might
	take away in syntax.

	>snip<
: You don't get it, do you?  That's almost the exact code that would
: fit inside a class definition, but since there's no need for a class,
: I don't worry about it.  Converting to a proper definition is straight
: forward.  Here (realizing I'm tossing some comments for a smaller post):
    >snip<
: What's the same in perl?

	Pretty similar, but it's 6:30 am so you'll just have to take my
	word for it because I'd be damned if I'm coding anything else
	until I get some sleep. ;-)

: Assuming a posix re class, you'll need to wrapper the exising re so you
: can use it in a generic framework.

	Three ways this could be done as I can see.  A class that converts
	POSIX re in to Perl re syntax (pretty simply actually), or that
	handles the match itself (harder, and would be kinda silly
	considering the speed of Perl patterns), or an XS pragma that
	drops in a replacement re parser.

: You'll also need to split this across several files since (as I
: recall, prices subject to change without notice) perl only allows
: one class definition per file.

	package Foo;
	...foo class stuff...
	package Bar;
	...bar class stuff...

	If you like Java/Python style blocks and indentation, you
	can also do:
	
	{
	    package Foo;
	    ...foo stuff...
	}
	{
	    package Bar;
	    ...bar stuff...
	}

	Perl 4 can do this, albeit without actually making classes.
-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Thu, 17 Sep 1998 09:43:06 -0400
From: "Garrett G. Hodgson" <garry@sage.att.com>
Subject: Re: Perl & Java - differences and uses
Message-Id: <360111EA.A4ABCC4D@sage.att.com>

Andrew Dalke wrote:
> abigail@fnx.com (Abigail) replied to my question about how to
> get the list of matches from an re match:
> 
> > if (@matches = $str =~ /$term->[0]/) {
> >    $term -> [1] -> ($str, @matches);
> > }
> >
> > There is one catch though. If $term->[0] doesn't contain parens, and
> > the regex matches, @matches will be (1) - as if the regex had on set
> > of parens, with captured '1'.
> 
> Thanks for the info.  The scary thing is four months ago I knew
> this (well, not the catch part).  I think one of the reasons I
> switched to Python was I get about the same amount of power and I
> don't have to remember all these details.

that pretty well sums up my reasons, as well.
even when i used perl regularly, i rarely got
something new written without digging through the manual
to look up some obscure detail.  (of course, i now
dig through the python library refs, but at least the 
object and function names have some mnemonic value.)

-- 
Garry Hodgson			and when they offer
garry@sage.att.com		golden apples
Software Innovation Services	are you sure you'll refuse?
AT&T Labs			heaven help the fool.


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

Date: Thu, 17 Sep 1998 13:13:39 +0200
From: Adriaan van der Hek <ajvdhek@ingbank.com>
Subject: Re: require does not work
Message-Id: <3600EEE3.E3CD46E8@news.ing.nl>

Dan Albertsson wrote:

> When trying to call functions in other perl files I use for example:
>
> require 'test1.sub';
>
> And then call functions in that file.
>
> This works fine running perl stand-alone in Windows95, NT and Unix
> environment.
> It also works fine when called as a cgi-script on my apache webserver.
>
> But it does not work when called as a cgi-script on my Microsoft IIS
> webserver. My webbrowsers only response is something like:
>
> ------------------------------------------------------------------
> CGI Error
>
> The specified CGI application misbehaved by not returning a complete
> set of
> HTTP headers. The headers it did return are:
>
> Can't locate test1.pl in @INC at E:\Webscripts\testing\test2.pl line
> 7.
>
> ------------------------------------------------------------------
> Why? I have tried to change the syntax for "require" in all sorts of
> ways.
>
> /dan

   I presume you added the registry-key so that IIS understands that .pl
scripts should be parsed by the perl executable.
The webserver runs in a separate environment. The @INC array variable
contains a list of directories to be searched for files requested by the
require function. The current working directory always is a part of this
array including directories included by the -i option. You can add
directories to @INC.
IIS probably needs extra information.
Why don't you use Apache for NT? IIS isn't that great (for example: some
versions crash the entire machine after a telnet host 80 and "GET
 ..\..")

Goodluck

Adriaan




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

Date: Thu, 17 Sep 1998 06:52:35 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: splitting by certain spaces
Message-Id: <6tqplj$c9n$1@earth.superlink.net>

Hello -

Srikanth Natarajan <nkanth@cnd.hp.com> writes:

>If you do not care about one or two spaces in the fourth field
>you may do a split of your line using a / +/
>(Note: onl one space in / +/ )
>then shift @data till you get the fourth field

>Once you hit the fourth field do a join(" ", @data) 
>this will give you the fourth field with only one space separating
>the words.


That's a (partial) solution in search of a problem.  As Honza said, use the
third argument to split().

Honza is right to leave it at a referral to the docs.  However - call me
compulsive (you wouldn't be the first) - the above leaves me wanting to
convert the unbelieving with a working example:


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

my $line =
"filename    23434        02-06-98   this is a file that does bla bla.";

my @fields = split (/ +/, $line, 4);

print join "!", @fields;


Output:

filename!23434!02-06-98!this is a file that does bla bla.

(I'm assuming that the constraint to four array elements means we can split
on one-or-more, rather than two-or-more, spaces.)


David Black
dblack@saturn.superlink.net


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

Date: Thu, 17 Sep 1998 07:25:30 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: STDOUT into array
Message-Id: <q3vqt6.ls7.ln@metronet.com>

Steffen Golz (100.12399@germanynet.de) wrote:

: I had a compressed file called daten.gz.
: I would like to expand this file with "zcat -c daten.gz".
: zcat copy this uncompressed information to the STDOUT cannel.
: I would like to copy this information into an array, which i can
: work with.
: If any person had an idea, to realized this problem with perl, please
: help.


Perl FAQ, part 8:

-----------------------
=head2 How can I capture STDERR from an external command?

There are three basic ways of running external commands:

    system $cmd;                # using system()
    $output = `$cmd`;           # using backticks (``)
    open (PIPE, "cmd |");       # using open()

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



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


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

Date: Thu, 17 Sep 1998 12:35:33 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: Style question re ($k => $v)
Message-Id: <3601039A.76C2258A@shaw.wave.ca>

Abigail wrote:
> 
> While I wouldn't use while (($k => $v) = each %h), I often do
> things like:
[snip]
> 
>       %hash = map {$_ => 1} @list;

These seem very similar to me.  Is there a reason why you would do one
and not the other?

I like both of these and while I have never used the first, I may start
now because of its similarity to the second and to constructs like:

%hash = (
    key1 => 1,
    key2 => 2,
);

I like a lot of the other suggestions as well, but am not in the habit
of using them.  I guess laziness wins out over hubris for me.  :-)

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: 17 Sep 1998 12:16:00 GMT
From: scott@softbase.com
Subject: Re: system() and `` on Win32
Message-Id: <3600fd80.0@news.new-era.net>

Chris Day (chrisday@cs.utexas.edu) wrote:

> Hello, I've recently installed Perl 5.004_02 on my Win95 web server and
> have hit a rather odd bug when using system() or `` to execute any shell
> commands.

I've tried using system() some too with PWS, and have found it 
not to work well. Usually the Perl program either does nothing
at all, or hangs forever.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

Date: Thu, 17 Sep 1998 11:13:27 GMT
From: Garry Williams <garry@america.net>
Subject: Re: Un-tainting a variable for the following format
Message-Id: <3600EF21.18FB7482@america.net>

bill_mcintyre@hotmail.com wrote:

[snip]

> I can un-taint the variable this way
> 
> $recnum =~/(\w[\w.-]*)/;
> $recnum ="$1";
           ^  ^
    Not necessary.

> This however makes $recnum have this value "97-143" how can I also translate
> the space open paren alpanumeric close paren or  (S5)?

	$recnum =~ /(\w[\w.-]*\s+\([A-Z0-9]+\))/;

Or whatever is appropriate for the part inside the ().  

-Garry Williams


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

Date: Thu, 17 Sep 1998 14:57:12 +0200
From: "Torfinn Keringen" <tor@kmd.dk>
Subject: Using Mail:: module with WinNT
Message-Id: <6tr109$nul$1@news1.tele.dk>

Hy
What I want to do is to get the body out of an e-mail end decode it from
base64 or QuotedPrint to plain text.

Tony Curtis (Thanks to him) suggested I used Mail::internet modul, but I
can't make it work under Win32.
The error msg is:
----------------------------------------------------------------------------
--------
C:\InetMail\Scripts>perl test.pl 35f45d0b.msg
Can't locate auto/Mail/Internet/autosplit.ix in @INC (@INC contains:
C:\Programs\Perl\lib\site C:\Programs\Perl\lib c:\perl\lib c:\perl\lib\site
c:\perl\lib\site .) at C:Programs\Perl\lib/AutoLoader.pm line 84. at
C:\Programs\Perl\lib/Mail/Internet.pm line 14
----------------------------------------------------------------------------
--------
Where/How can I get this module working under Win32

Is ther an other smart way to do this, just fill in the code
foreach $mail (@mails) {
#if(base64) {
#   print MIME::base64::decode(the bodypart);
#}
#if(quotedprint) {
#   print MIME::QuotedPrint::decode(the bodypart);
#}
}

Torfinn tor@kmd.dk










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

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

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