[7052] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 677 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 28 06:07:15 1997

Date: Sat, 28 Jun 97 03:00:22 -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           Sat, 28 Jun 1997     Volume: 8 Number: 677

Today's topics:
     ### FILE RIGHTS FROM PERL PROGRAM ### (Hardware Planet)
     Re: ?: How to copy a file? (Nathan V. Patwardhan)
     Re: Creating directories? <nospam-djohnson@uu.net-nospam>
     Re: Databases (Nathan V. Patwardhan)
     Re: DBM file endings (Chris Nandor)
     FLY...I'm New please Help! (Melody Polakow)
     Forcing a browser auth w Perl (Daniel G. Drumm)
     Re: Fun with ".cgi contained no blank line separating h (Shelle)
     Hash vs. DBM (Otis Gospodnetic)
     Re: HELP: Running a script without a form <keys@babylon5fan.corn>
     Re: making an associative array of scalar arrays <foxkw@mh.us.sbphrd.com>
     Need PID of qx{command} stabro@almatel.net
     Re: no. of days between two dates ? <nospam-djohnson@uu.net-nospam>
     Re: no. of days between two dates ? (Matthew Cravit)
     PERL 5 book:Any new Revisions ? (Vasudev Dalal)
     perl archive /software <jing@one-o.com>
     Perl Resources <sean@darkstar.ftech.co.uk>
     Question: split and anonymous arrays <jon@webdev.co.uk>
     Re: Regexps on streams (Ilya Zakharevich)
     Re: Req: CRC-32 (Steffen Beyer)
     Re: Sending e-mail using Perl for NT - don't wanna... g (Melody Polakow)
     Re: Source code comparison - know of a tool? (Spam Sucks!!!)
     Re: Stumped .... (Charles F. Randall)
     Trapping the output of the System command into a variab <kvenug@hotmail.com>
     Re: uc function for PERL4 (Abigail)
     Re: What does <<END do? (Raymond Chitolie)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sat, 28 Jun 1997 10:19:49 GMT
From: sales@hardwareplanet.com (Hardware Planet)
Subject: ### FILE RIGHTS FROM PERL PROGRAM ###
Message-Id: <33b449ea.0@news.itsnet.com>


I need help.  My username on my telnet account is matth, but
whenever my perl program creates a file within my perl program I try and give 
it 755 rights using   umask (0022)  but all I get is rw-rw-rw-  . I really
really really really need the execute flag set for my programs.
The files are being created under the name "nobody" when I do
an ls.  I think this may be the problem.  I don't know how to
fix this.  PLEASE HELP if you can.

Call me collect at (801) 765-0575 (Matt Heaton) or email me
at sales@hardwareplanet.com

I would really appreciate a response.

Thanks,

Matt Heaton


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

Date: 28 Jun 1997 03:45:53 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: ?: How to copy a file?
Message-Id: <5p21dh$ji5@fridge-nf0.shore.net>

Tina Marie Holmboe (tina@elfi.adbkons.se) wrote:

:   And if the original poster still wants to know HOW to copy a file,
: and not how to call on libraries, here is a suggestion:

Oh, isn't using a module included with the Perl distribution enough?
Not trying to be a wiseass; just wondering why you went through all
the trouble?

Another method might be:

perl -e 'while(<>) { print; }' oldfile > newfile

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Fri, 27 Jun 1997 15:28:51 -0500
From: Dale Johnson <nospam-djohnson@uu.net-nospam>
Subject: Re: Creating directories?
Message-Id: <33B42283.167EB0E7@uu.net-nospam>

Rei Baker wrote:
> 
> Is there any way I can create new directories with Perl?
> 
> Rei

Aye.  There is.  The command is:

mkdir();

Usage:  mkdir  FILENAME, MODE;

Good luck.
-- 
Dale R. Johnson, Jr.  --  djohnson[at]uu.net  --  http://www.drsj.com/
PGP Key: 1024/7F16D9FF  Fingerprint: D52DF796E5693AA3 F500A8FCEF354154
 perl -e 'foreach(`finger johnson\@doit.net`){$a=1if/^-/;print if$a}'


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

Date: 28 Jun 1997 00:08:16 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Databases
Message-Id: <5p1klg$4b5@fridge-nf0.shore.net>

Sam Scruggs (sscruggs@widomaker.com) wrote:
: I have been programming perl for several months now, and part of what I have 
: been doing is with simple databases, with entries looking like:
: fn:ln:email
: Sam:Scruggs:sscruggs@cucinc.com

Ahh, then you're looking for Sprite.

http://www.perl.com/CPAN/modules/by-module/Sprite/

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Fri, 27 Jun 1997 15:37:09 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: DBM file endings
Message-Id: <pudge-ya02408000R2706971537090001@news.idt.net>

In article <vlb-ya023580002606971659070001@news2.apple.com>, vlb@apple.com
(Vicki Brown) wrote:

# I was given a set of Perl scripts that use DBM routines; the scripts assume
# that .pag and .dir files will be created. 

They shouldn't.  They should assume a name like "my_db" and the dbm package
will create and translate the necessary filenames.  On some packages it
might be .pag and .dir as two files to one db; other packages might create
on file and give it a .db extension.

Assuming the extension is not a good idea.

# On my system (MkLinux, essentially RedHat Linux) I get a single .db file
# instead.

You MacHead, you ...  :-)

# Am I assuming correctly that it's my _system_ dbm library that's handling
# this, and not Perl, per se?

Yes.

# Is there a simple way of determining which dbm library is in use or is this
# one of those times where the code has to check for a .db file and if it's
# not there look for .dir & .pag (i.e. where the code writer needs to know
# how the different libraries will act).

AnyDBM_File should open it no matter what created it.

#!perl
use AnyDBM_File;
use Fcntl;

#write with NDBM_File
tie %hash1,'NDBM_File','my_db', O_CREAT|O_RDWR, 0644;
$hash1{key} = value;
untie %hash1;

#open with AnyDBM_File
tie %hash2,'AnyDBM_File','my_db', O_CREAT|O_RDWR, 0644;
foreach (keys %hash2) {print "$_: $hash2{$_}\n"}
untie %hash2;

This worked on both MacPerl 5.1.3r2 and perl5.003 (Solaris 2.4).  The file
created by the Mac version was one file, named 'my_db'.  In the Solaris
version,  two files were created, 'my_db.dir' and 'my_db.pag'.  The Mac
version was also tested using DB_File instead of NDBM_File, and it worked
fine, too.  I don't have DB_File on the Solaris box.

Hope that all helps,

--
Chris Nandor                 pudge@pobox.com                 http://pudge.net/
%PGPKey=('B76E72AD',[1024,'08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6'])


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

Date: Fri, 27 Jun 1997 21:17:54 GMT
From: melody@imp.net (Melody Polakow)
Subject: FLY...I'm New please Help!
Message-Id: <33b42d0c.2865991@news.lisco.com>

I am a novice at Perl but am implementing a number of Perl scripts
successfully on my NT server.
I am attempting to use Matts script for counter - a graphical counter.
The script also uses a c program called Fly.
There is a binary .exe version of this program which I am using on my
NT.
Everything seems to be working ok on the script as fas as logging and
incrementing except for that the graphical output is garbled and
sometimes just plain blank??
Can anybody tell me what might be going on?? thanks much.


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

Date: 27 Jun 1997 21:33:48 GMT
From: dgd@nebula.is.rpslmc.edu (Daniel G. Drumm)
Subject: Forcing a browser auth w Perl
Message-Id: <5p1bjs$ll7@nebula.is.rpslmc.edu>

I'm searching for a way to force a browser to authenticate, as with a httpd
protected page, strictly from within Perl.

I want to write a CGI, that when you call it:

http://www.foo.com/test.cgi

It will open the browser dialog box (on most browsers) and ask you for your
name and password, read it, and then continue based on that information.

This doesn't work the same way as CGI, this is not a GET or PUT, but I know
it can be done without resorting to the Web server to do it. In a worse
case scenario, perhaps the HTTP::Daemon module could be used to open a
socket to the client's browser and issue the code, although that seems
nuts.

I've done all kinds of Web authentication, using Selena's auth module,
Java, and even Javascript. But can't do what I want strictly within Perl.

--
--
Daniel G. Drumm - ddrumm@rush.edu
Rush Presbyterian St. Luke's Medical Center - Chicago, IL
Network Division - Information Services


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

Date: Fri, 27 Jun 1997 19:56:39 GMT
From: shelle@interaccess.com (Shelle)
Subject: Re: Fun with ".cgi contained no blank line separating header and data"
Message-Id: <5p15tn$1j4_002@interaccess.interaccess.com>

mupe@desk.nl (M. muPe) wrote:
>shelle@interaccess.com (Shelle) wrote:
>>OK, we're dealing with a Win95 (rev. b) system, running WebSite 1.1e, and Perl
>> for Win32 5.003_07:
>>
>>This Server Error 500 message has plagued me for weeks with various scripts  
>>Although I'm feeling somewhat vindicated in that I can see the content-type 
>>info followed by 2 spaces print from the DOS command line, it really doesn't 
>>help too much to kill the problem.
>
>Folowed by two spaces?? It must be 2 new lines "\n\n"
>
>Hope your problem was as simple as that.

Alas it was not....  I stated incorrectly in my original post and apologize 
for the error humbly.  Indeed I did have the necessary "\n\n" and was looking 
at the blank line.

Thanks anyhow.  Always appreciated. :)

Michelle ----,-'-(@

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      I'm just a beginner with Perl but I read TFM....
 Michelle Feigen      ----,-'-(@      shelle@interaccess.com
          http://homepage.interaccess.com/~shelle/
       http://homepage.interaccess.com/~shelle/grafx/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: 28 Jun 1997 04:07:42 GMT
From: otisg@puma.middlebury.edu (Otis Gospodnetic)
Subject: Hash vs. DBM
Message-Id: <5p22me$nd6$1@tiger.middlebury.edu>

Hi,

I was wondering if somebody can tell me which of the following two
options/approaches is better.

I have to collect some data and as I collect it I need to store it.  As I
store it I also have to retrieve that data, and delete it from the storage.

So I'm wondering which storage option is better:

Should I store the data in a simple hash/associative array and let the array
grow as I add key-value pairs, or should I open a DBM file and have my script
add the data to the DBM file?

The important requirement is performance - if I collect some data I need to be
able to quickly determine if I already collected this data before.

And the other important requirement is memory usage - this script should not
require/consume more and more memory as I collect more and more data and
become a huge memory hog.

I tried using a hash, which gave me good results as far as performance goes
(because I can quickly check if data, which is the hash key, is already in the
hash).  However, as I collect more data this script grows from 5-10-20+ MB (of
RAM).

I haven't tried using a DBM yet because I'm not sure if when I tie() the DBM I
end up with the same thing.  In other words, I'm not sure if when I tie()
a DBM file to some %hash this %hash is then loaded into memory?  If it is, 
then I really don't gain anything at all by using a DBM, right?.

Another thing I'm afraid of is disk access.  With a plan hash (the first
option) I know the memory usage will grow, but I also know I won't have to
access the disk.  With a DBM I guess I will have to do that.  How fast are
those disk accesses?  I need to be able to make rouchly 1-2 lookups per
second.  I plan on using Berkeley DB 2.1.0.

Can anyone offer some advice?

Thanks!

Otis
--
POPULUS People Locator - The Intelligent White Pages - http://POPULUS.net/


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

Date: Thu, 26 Jun 1997 20:53:17 -0600
From: Keys <keys@babylon5fan.corn>
Subject: Re: HELP: Running a script without a form
Message-Id: <33B32B1D.B865498D@babylon5fan.corn>

Mike Stok wrote:
> 
> In article <5or723$689@knot.queensu.ca>,
> Chim Jason <4jc9@qlink.queensu.ca> wrote:
> >My name is Jason an I'm a new Perl programmer trying some fancy stuff.
> >
> >I am running an initialization script on my title page is using the <IMG>
> >tag and calling the script in the SRC.  The script works fine but now I
> >have a broken image icon on my page.  I'm trying to get rid of it by
> >sending a blank image with the script using the following lines:
> >
> >  print "Content-Type: image/gif"\n;
> >  print "\n";
> >  print "/jason/temp/blank.gif\n";

Poor man's solution, and not a bad one IMHO:
print "Location:
http://www.yourservername.com/jason/temp/blank.gif\n\n";

>From what I've seen most browsers can handle a redirect on an image,
although it screws up caching...
-- 
Keys
Spam sucks.  To reply, please change "corn" to "com" in my return
address...


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

Date: Fri, 27 Jun 1997 19:00:58 -0400
From: Ken Fox <foxkw@mh.us.sbphrd.com>
To: Mike Stok <mike@stok.co.uk>
Subject: Re: making an associative array of scalar arrays
Message-Id: <33B4462A.2BC6@mh.us.sbphrd.com>

> >> Jonathan Feinberg    jdf@pobox.com    Sunny Manhattan, NY
> Hope this helps,
> 
> Mike
> 
> --
 Thanks Folks - This is my first Perl program & the variable syntax is a
bit off....


Cheers, Ken


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

Date: 27 Jun 1997 12:40:48 GMT
From: stabro@almatel.net
Subject: Need PID of qx{command}
Message-Id: <5p0ccg$epj$1@viper.america.net>


I need to capture output of an external program:

 $stuff=`ProgName args`;

However, due to network conditions, the poor program sometimes
hangs (never returns).

Therefore, I have tried the more complex approach indicated
in the perlipc manpage:


 eval {
  local $SIG{ALRM} = sub { die("alarm clock restart") };
  alarm 120;
  $stuff=`ProgName args`;
  alarm 0;
 };
 if ($@) {
  print("$@");
  if ( $@ !~ /alarm clock restart/ ) { die("$@"); }
 }

This works sort of okay, in the sense that the perl program can
retain control to deal with the hung program.  However, the hung
program is still a live process which needs to be killed.

My question:  How does one find the PID of this child process
in order to "kill -KILL" it from within the perl program?  Of
course  'ps|grep Progname' is _not_ the type of answer I'm looking
for here.  There will be many copies of the ProgName executing
concurrently.


-- 
  -SJB         >> no junk-mail please! <<
--


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

Date: Fri, 27 Jun 1997 15:43:58 -0500
From: Dale Johnson <nospam-djohnson@uu.net-nospam>
Subject: Re: no. of days between two dates ?
Message-Id: <33B4260E.2781E494@uu.net-nospam>

*/chebs wrote:
> 
> Hi
> can anyone help me with this one I have been trying to
> calculate the difference in days between two dates in a form
> with out much success.
> 
> all my attempts are way to complicated and I can't work out how to adjust
> for the different no. of days in the months and leap years.
> 
> Any help towards my understanding of this or example code would be great
> thanks
> 
> martin
> @chebs.demon.co.uk

In my "Programming Perl" book by Larry Wall, Tom Christiansen & Randal
L.
Schwartz, I find on pages 185 and 186 concerning localtime() and how it
takes the seconds from epoch provided by the date function and returns 
nine values ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday,
$isdst).

Right after that, it discusses a Perl library Module called Time::Local
that has a subroutine called timelocal().  This timelocal() is able to 
return a second from epoch from an array of input based on localtime()
format.

Given that, you could take times from epoch for each day and then you
have the
number of seconds between the two.

Good luck.

-- 
Dale R. Johnson, Jr.  --  djohnson[at]uu.net  --  http://www.drsj.com/
PGP Key: 1024/7F16D9FF  Fingerprint: D52DF796E5693AA3 F500A8FCEF354154
 perl -e 'foreach(`finger johnson\@doit.net`){$a=1if/^-/;print if$a}'


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

Date: 27 Jun 1997 13:43:59 -0700
From: mcravit@best.com (Matthew Cravit)
Subject: Re: no. of days between two dates ?
Message-Id: <5p18mf$aka$1@shell3.ba.best.com>

In article <33b612e1.11233294@news.demon.co.uk>,
*/chebs <martin@chebs.demon.co.uk> wrote:
>Hi 
>can anyone help me with this one I have been trying to
>calculate the difference in days between two dates in a form
>with out much success.

Go to your nearest CPAN mirror (a list of them is on the Perl web site,
www.perl.com/perl/) and get the Date::Manip module.

/MC

-- 
--
Matthew Cravit, N9VWG               | Experience is what allows you to
E-mail: mcravit@best.com (home)     | recognize a mistake the second
        mcravit@taos.com (work)     | time you make it.


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

Date: 26 Jun 1997 01:15:05 GMT
From: vkd0871@omega.uta.edu (Vasudev Dalal)
Subject: PERL 5 book:Any new Revisions ?
Message-Id: <5osfqp$bbk@news.uta.edu>
Keywords: PERL 5 Camel Book

Hello All :

	I was planning to buy the Camel ( Blue ) PERL 5 
book by Larry , Tom and Randal.

	But I was wondering if any newer revision of the
book is going to be published/released in the newer future 
( like within ONE month ) .

	Any input is appreciated.

Vasu



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

Date: Fri, 27 Jun 1997 15:40:14 -0700
From: Jing Liu <jing@one-o.com>
Subject: perl archive /software
Message-Id: <33B4414E.6798@one-o.com>

Hey, just got a good archive of NT Server & Client software download
site built for anybody to use.  Check it out!

http://www.itlinks.com/download/

Got all the critical component for a NT Server, like Mail, Telnet, WWW,
Chat, etc....

Will build one for Unix fans later!


and..some perl script for sys admin stuff and for web masters


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

Date: Fri, 27 Jun 1997 23:53:26 +0100
From: DarkStar <sean@darkstar.ftech.co.uk>
Subject: Perl Resources
Message-Id: <33B44466.3FD9@darkstar.ftech.co.uk>

The DarkStar Site contains resources for Perl including Books 'n' Links.

Visit the DarkStar Site, there's a lot more in store.

http://www.gre.ac.uk/~hs574

Have Fun

DarkStar


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

Date: 27 Jun 1997 13:02:14 GMT
From: "Jon Ewing" <jon@webdev.co.uk>
Subject: Question: split and anonymous arrays
Message-Id: <01bc82fa$d82a58a0$c4ec48c2@stevec>


Hi,

If I understand things right, [split /\t/, $line] will create an anonymous 
reference to the array created by splitting the line $line at every tab.

Then, to get an element out we can do something like

$mainarray = [split /\t/, $line];
print @$mainarray[0];

But is it possible to avoid using the string $mainarray?

i.e. why doesn't this work..

print @[split /\t/, $line][0];

I realise there are easier ways to get the first member of the list, but
I'm curious...

thanks

jon
		

							 


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

Date: 27 Jun 1997 20:53:44 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Regexps on streams
Message-Id: <5p198o$iu9@agate.berkeley.edu>

In article <slrn5r7ntu.6dj.andrew@pimlott.student.harvard.edu>,
Andrew Pimlott <pimlott@math.harvard.edu> wrote:
> >> Agreed! :-)  If using a RE on a stream does get into the core, it would
> >> really help if there were some way for Perl to be able to warn or abort
> >> when a regular expression is thrashing, since it will be an easy feature
> >> to misunderstand and misuse.
> >
> >What does it mean "thrashing" in this context?  Anything specific can
> >be implemented, but you need to know first what to implement.
> 
> thrashing == swapping.  Tom's suggesting some way to bail out before the
> entire (possibly huge) stream is read into memory.  I agree that this is
> very useful.  One handy form of this would be to pass a maximum number of
> lines (or calls to the refill function) over which the RE may spread.

I do not understand what this has to do with RE engine.  If you do not
want to reload after some limit is reached, make the reload function
which will bail out.

> This refill function is a regular perl function, right?  

No, it is a C function with a given signature.  Nobody prohibits it to
call a Perl function under the hood.

> Will it get called every time we get to the end of the string, or
> only when we have a potential match going (or will both be
> possible!)?

When forward-tracking reaches the end-of-string.

> I would like the second to be supported, since it's usually more
> convenient to consider the data line by line (despite the fact that
> my original question was on streams).  For example, suppose I want
> to make two replacements (both possibly across multiple lines, of
> course)--then I want to read in one line at a time any only get more
> if it looks like the next line(s) could complete a match.  So my
> code might look something like this:

Your code supposes Perl-variables.  RE engine works on char[].  Thus
an extra translations layer which will update a Perl-variable too is
needed.  I did not have s/// in mind when considering a change to RE,
s/// is again a layer *above* RE engine.

> Neat!  If it is (or becomes) available anywhere, I'd love to see exactly
> what you have in mind.

Exactly this:

	When RE engine reaches end-of-string, it may call a given
function with the given void *data, and the length of the head which
is not needed anymore.  The function returns length of the added tail,
and fills the address to new start and how much did it bite from the
start. 

Ilya



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

Date: 27 Jun 1997 20:48:56 GMT
From: sb@en.muc.de (Steffen Beyer)
Subject: Re: Req: CRC-32
Message-Id: <5p18vo$euj$1@en1.engelschall.com>

Robert S. Kissel <kissel@kissel.spicerack.ibm.com> wrote:

> Before I go writing and testing one myself, does anyone have a module or
> sub to calculate a CRC-32?  I didn't see one in the CPAN modules list.

I'd be very interested in this module myself if you wrote it; haven't found
any yet either!

Once I needed something similar I hacked up some arbitrary cyclic checksum
method, but I'm not too sure about its quality (and it probably has got
nothing to do with the "true" CRC method, does it?).

But at least it's a 32 bit cyclic checksum.

(the C type "unsigned long" is 32 bits on my machine (SUN))

Here's the relevant code:

-------------------- cut here -------------------- cut here --------------------
#!/opt/bin/perl

use Bit::ShiftReg qw( ROL_long );

# Rest of program here - "$sig" contains the cyclic "checksum"

# "$sig" is initialized to zero before opening a file, then the
# subroutine below gets called for every line of the file being
# read. When the file is closed, "$sig" contains a checksum of
# that file.

sub checksum
{
    my($i);

    for ( $i=0; $i<length($_); $i++ )
    {
        ROL_long($sig);
        $sig += ord(substr($_,$i,1));
    }
}

__END__

-------------------- cut here -------------------- cut here --------------------

You can find the module "Bit::ShiftReg" on my web site at

http://www.engelschall.com/u/sb/download/

which is used here to perform the necessary register rotation operation(s).

Hope this helps!

Yours,
-- 
    Steffen Beyer <sb@sdm.de> http://www.engelschall.com/u/sb/
     "There is enough for the need of everyone in this world,
      but not for the greed of everyone." - Mahatma Gandhi
   >> Unsolicited commercial email goes directly to /dev/null <<


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

Date: Fri, 27 Jun 1997 21:13:08 GMT
From: melody@imp.net (Melody Polakow)
Subject: Re: Sending e-mail using Perl for NT - don't wanna... gotta
Message-Id: <33b42c75.2714495@news.lisco.com>

I use a program called "BLAT" with formmail.pl for win NT and it works
pretty well actually. Blat just basically mimics sendmail on NT. If
you want the specific setup information email me at mark@imp.net.


>x@apocalypse.org wrote:
>: I'm being "forced" (no gun to my head... at least not literally)
>: to port some perl CGI scripts from Unix to NT. Sending e-mail
>: with perl on Unix is easy enough... open a pipe to sendmail... but
>: how would I send e-mail from perl on NT? Thanks.
>-- 
>Jim Esten
>(temporarily between .sigs)



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

Date: Fri, 27 Jun 1997 22:10:47 GMT
From: spamless@nospam.org (Spam Sucks!!!)
Subject: Re: Source code comparison - know of a tool?
Message-Id: <33b439c2.5321435@news.sisna.com>

On the various flavors of UNIX and VAX-VMS systems use "diff".
Mr Bill's systems use "fc" (file compare).

Simon Goland <sg@mda.ca> wrote:

>Hi,
>
>I am looking for a tool/utility/script (partial or complete) that will
>compare various programs in C/C++/Java and tell me how closely they
>resemble each other. I teach these programming courses, and would like
>to get an accurate estimate of "program resemblance" when checking the
>assignments of my students... because some programs look way too similar
>to each other. The good-old "hhmmm, I have just seen almost exactly the
>same program..." method works OK on small programs, but on large ones,
>having over 60 students, it is not too accurate any more.
>
>I know I can spend some time (or maybe a bit more... ;-) writing such a
>utility, which will compare two source files and tell me how identical
>these are. For example, if the only thing changed is the names of the
>variables, and the rest is the same, etc... . And it makes sense to
>write something like that in Perl. I just don't want to reinvent the
>wheel, and assume that at least parts of it were invented already.
>Ideally many parts...
>
>So if you know of something that might be of help, in Perl or not, I
>would appreciate any tips. And perhaps you can email me directly as
>well.
>
>Thanks,
>
>-- 
>[ Simon Goland       B-)>     sg@mda.ca ]
>[   Without action there is no change   ]


+---------------------------------------------------------+
| The macarena is dancing for the rhythmically challanged |
+---------------------------------------------------------+



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

Date: 26 Jun 1997 09:20:35 -0600
From: crandall@free.click-n-call.com (Charles F. Randall)
Subject: Re: Stumped ....
Message-Id: <5ou1c3$ogn$1@free.click-n-call.com>

[Note: posted to comp.lang.perl.misc and copy e-mailed to Arun]

Arun Saxena  <saxena_arun@jpmorgan.com> wrote:
>( Basicall replace 4 or more spaces w "\<cnt # of spaces> "
> I am having one hell of a time with this. I would think the 
>following would work, but it does not 

There's always more than one way to do something like this in perl...

Try this,

---snip---
while ( $line = <DATA> ) {
    $line =~ s/( {4,})/'\\' . length($1) . ' '/ge;
    print $line;
}
__DATA__
kkkk     d;ckdk  ;dkckd kkk   k    kd
ddk      dkd   dkkdk     dkkd
kkdk kddd kkk d      kkk
---snip---

-Randy
-- 
Charles F. Randall             With Click-n-Call, you can put a button
crandall@click-n-call.com      on a Web page that can initiate an H.323 
http://www.click-n-call.com/   Internet phone call to a plain old telephone.



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

Date: Fri, 27 Jun 1997 15:17:31 -0700
From: venugopal koppala <kvenug@hotmail.com>
Subject: Trapping the output of the System command into a variable
Message-Id: <33B43BFB.7322@hotmail.com>

Hi,

I am in the process of converting Unix shell scripts into Perl.

Any body can suggest me how to Trap the output from system command into
a variable.

At present I am Redirecting the Output to a temporary file and reading
back the file contents into a variable.. Is there any way I can redirect
the output to a variable directly to a variable bypassing the temporary
file.

Pls suggest me some way of doing this.

Bi Bi
venu


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

Date: Sat, 28 Jun 1997 03:18:44 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: uc function for PERL4
Message-Id: <ECGuJ8.H3F@nonexistent.com>

John L. Allen (allen@gateway.grumman.com) wrote on 1395 September 1993 in
<URL: news:5ou5ok$cq1@gateway.grumman.com>:
++ 
++ Wouldn't perl4's \U do ?

No, the point was the perl4 doesn't take locale into account.


Abigail
-- 
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=$]*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: Fri, 27 Jun 1997 09:11:12 GMT
From: ray@easynet.net (Raymond Chitolie)
Subject: Re: What does <<END do?
Message-Id: <33b58332.82522977@news.easynet.co.uk>

On Wed, 25 Jun 1997 09:11:24 -0500, wwilliam@cisco.com (Wade Williams) =
wrote:

>=20
>        sub print_tail {
>           print <<END;
>         <HR>
>         <ADDRESS>Lincoln D. Stein</ADDRESS><BR>
>         <A HREF=3D"/">Home Page</A>
>         END
>         }
>=20
> In the above code, I can surmise that the "print <<END" line says =
"Print
> until you reach an END."  Is that correct?
>=20
> If so, why do I get:
>=20
> Can't find string terminator "END" anywhere before EOF at ./test.cgi =
line 77.

It wil be VERY specific about what you are trying to match. <<END will =
expect
END to be on its on line with no leading space characters. if you use:

	print <<" END"=20

then this should work (assuming that you have a single space in front of =
the END
marker above. Just add more otherwise.

Be Seeing You

Ray.

=3D-=3D-=3D-=3D-=3D-=3D-=3D Games + Sounds + Homer + Serial Killers =
-=3D-=3D-=3D-=3D-=3D-=3D
  Reply sans .nospam ||  "I'm going to escape and come back...
   "Be Seeing You"   ||   wipe this place off the face of the
---------------------||   earth, obliterate it...and you with it."
 VoodooRay @ Zoinks! ||                                      No. 6
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- http://www.easynet.co.uk/ray/ =
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.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 677
*************************************

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