[7046] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 671 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 26 23:17:13 1997

Date: Thu, 26 Jun 97 20: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           Thu, 26 Jun 1997     Volume: 8 Number: 671

Today's topics:
     Re: #!/usr/bin/perl Where exactly <rootbeer@teleport.com>
     .htacces interface through PERL (Curt Bousquet)
     Anyone know if there is an automated way to translate C (David Sims)
     Compiling with wrapsuid <davidc@wrs.com>
     DBM file endings (Vicki Brown)
     Re: decimal to hex conversion? ( Tina Marie Holmboe )
     Re: GIFgraph.pm or finance scripts <zenin@best.com>
     Re: Is PERL a compiled language? <tony@peregrinco.com>
     Re: Newbie : FAQ location ?? ...can u solve my problem? <jefpin@bergen.org>
     Newbie question: 500 Server Error <l41325@alfa.ist.utl.pt>
     Re: Pattern-matching when strings have embedded "$" <jefpin@bergen.org>
     Re: Perl and PGP interface <zenin@best.com>
     Perl/CGI Scripting Ideas <jefpin@bergen.org>
     Re: Perlembed - cant compile <dougm@osf.org>
     Re: Problems compiling module <rootbeer@teleport.com>
     Re: Reading Cookies <tony@peregrinco.com>
     Re: Reading Cookies <tony@peregrinco.com>
     Re: Regexps on streams (Ilya Zakharevich)
     Re: Script Fake a browser? <zenin@best.com>
     Re: Source code comparison - know of a tool? (Tung-chiang Yang)
     Re: Source code comparison - know of a tool? (Dave Regan)
     strange error:" dlopen: stub interception failed " <hjy2@cornell.edu>
     Trouble using modules in Perl5.003 for Win32 <rajivk@worldnet.att.net>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 26 Jun 1997 15:47:47 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Fractture <rroberts@gowebway.com>
Subject: Re: #!/usr/bin/perl Where exactly
Message-Id: <Pine.GSO.3.96.970626154435.6142U-100000@kelly.teleport.com>

On Thu, 26 Jun 1997, Fractture wrote:

> Subject: #!/usr/bin/perl Where exactly
> 
> Ok, I am working on installing Linux, and want to understand the
> filesystem b y looking at this command.

I think you'll get something good from this entry in the Unix FAQ, which
deals with the question, "Why do some scripts start with #! ... ?"

    http://www.cis.ohio-state.edu/hypertext/faq/usenet/unix-faq/faq
          /part3/faq-doc-16.html
    http://www.cis.ohio-state.edu/hypertext/faq/usenet/unix-faq/faq
          /top.html

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 26 Jun 97 22:34:39 GMT
From: scanline@sover.net (Curt Bousquet)
Subject: .htacces interface through PERL
Message-Id: <5ouqq9$lm4$1@slate.sover.net>

       I'm currently using password protection for sections of my site with 
'.htaccess' and an encrypted password file.

        I would like to automate my maintenance of the site a little by 
building a CGI (with PERL) interface to the password file, the .htaccess file 
and the htpassword program, so I can manage everything from an administrative 
page (adding new accounts and such).... 

        If someone can refer me to a script that does this so I can learn by 
example, I would appreciate it very much. So far some of the script I HAVE 
found use non- .htaccess methods or go way beyond what I need to do (like 
Selena Sol's great but complex system).

        Thanks for the help.

++++++++++++++++
Curt Bousquet
scanline@sover.net 


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

Date: Thu, 26 Jun 1997 17:31:20 -0600
From: dpsims@slb.com (David Sims)
Subject: Anyone know if there is an automated way to translate C source to Perl??
Message-Id: <dpsims-260697173120@sims-pc.sugar-land.sl.slb.com>

Hi folks,

  Does anyone know if there is an automated way to translate C code
to Perl?

TIA,

Dave


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

Date: Thu, 26 Jun 1997 18:31:19 -0700
From: David Cross <davidc@wrs.com>
Subject: Compiling with wrapsuid
Message-Id: <33B317E7.1DA4@wrs.com>

Does wrapsuid need to compile its wrapper scripts in the same directory
- or at least under the same OS - as the one where they need to be run?

Why I ask is this: My test machine is SunOS 4.1.4 running Apache. I tell
wrapsuid to work on a script, and it compiles OK. The machine where
things _need_ to work is Solaris (version?) running Netscape Enterprise
Server. I can't get wrapsuid to compile over there. I tried "wrapping" 2
different upload scripts, compiling them on my machine but setting the
script's directory defaults to the path for the "real" machine. Both
broke with the same error about "insecure dependency in open" etc. it
could be they have the same genuine error in the "wrapped" perl, or it
could be the wrapper not working correctly . . . maybe?

I don't know, so I ask.

Thanks, in anticipation of learning something.


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

Date: Thu, 26 Jun 1997 16:59:07 -0700
From: vlb@apple.com (Vicki Brown)
Subject: DBM file endings
Message-Id: <vlb-ya023580002606971659070001@news2.apple.com>

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

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

The Perl code does various things with the files and made some assumptions
about names.  I got to wondering...
(Pardon me if these are silly questions; this is my first interaction with
DMB data bases).

Is this just a "new" way to do dbm stuff (i.e. the new standard)? Or is it
considered abnormal?

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

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).

Are there any other differences out there in terms of how the DBM files work?

-- 
-------------
Vicki Brown - vlb@apple.com, www.mklinux.apple.com - Apple Computer
MkLinux advocate, Rhapsodist, Stagehand, Utility repair tech, Web Gardener


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

Date: 27 Jun 1997 01:38:44 GMT
From: tina@elfi.adbkons.se ( Tina Marie Holmboe )
Subject: Re: decimal to hex conversion?
Message-Id: <5ov5j5$r2r$1@uabs64.uab.ericsson.se>

[Thu, 26 Jun 1997 01:17:19] [Scott Johnson]

> Does anybody know (I'm sure somebody must) how to convert decimal
> numbers to hex?  I've tried a few things with pack, but everything I
> try either comes up as the wrong number or zero.  I've seen the
> postings here on how to do this with printf, but I need to data to
> remain in variables.  Thanks in advance!

  'data to remain in variables' ? Not that I am entirely sure what you are
refering to here, but:

Script started on Fri Jun 27 02:23:32 1997
spip ~> perl -e '$num = 255 ; $num = sprintf("%x", $num) ; print "$num\n" ; '
ff
spip ~> exit
exit

Script done on Fri Jun 27 02:23:39 1997

  Perhaps ?

--
 Tina Marie Holmboe
 [ tina@htmlhelp.com    ]      WDG     [ http://www.htmlhelp.com/%7Etina/    ]
 [ tina@ifi.uio.no      ]  University  [ http://www.ifi.uio.no/%7Etina/      ]
 [ tina@elfi.adbkons.se ]    Private   [ http://www.elfi.adbkons.se/%7Etina/ ]


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

Date: 26 Jun 1997 22:00:26 GMT
From: Zenin <zenin@best.com>
Subject: Re: GIFgraph.pm or finance scripts
Message-Id: <5ouopq$5p9$5@nntp2.ba.best.com>

Kevin Luff <kluff@enterprise.net> wrote:
> 2) I'm having trouble pulling data from Oracle tables and fitting it into
> the array needed by GIFgraph. DBI & Oracle drivers are both  loaded and
> work OK.
	>snip<

	Post your code, or at least a snip of the part you are having
	problems with.  It's vary hard to help otherwise.

-- 
-Zenin
 zenin@best.com


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

Date: Thu, 26 Jun 1997 17:25:57 -0700
From: Tony McCormick <tony@peregrinco.com>
Subject: Re: Is PERL a compiled language?
Message-Id: <33B30895.5DECB7FD@peregrinco.com>

Webmaster wrote:
> 
> I'm a newbie to PERL...how does this language run?
> 
> Thanks,
> Matthew Robinson
> ExecuSoft Controls, Inc.

Perl is interpreted, sortof, the runtime loads the script, compiles
it then executes if not syntax errors are found.

-- 
Tony McCormick, Systems Analyst      (503) 690-1111
mailto://tony@peregrinco.com  or http://www.rdrop.com/~tonymcc
-- "Blink your eyelids periodically to lubricate your eyes."
from the HP "Environmental, Health & Safety Handbook for Employees." --


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

Date: Thu, 26 Jun 1997 21:56:20 -0400
From: TechMaster Pinyan <jefpin@bergen.org>
Subject: Re: Newbie : FAQ location ?? ...can u solve my problem?
Message-Id: <Pine.SGI.3.96.970626215610.7430B-100000@davinci.bergen.org>

try perl.org

----------------
| "I don't contemplate it, I just sit and think about it."
| 	- Sonia Balsky
----------------
Jeff "TechMaster" Pinyan | http://www.bergen.org/~jefpin
HTML/CGI Designer and Consultant and JavaScripter
jefpin@bergen.org | TechMasterJeff@juno.com
Got a JavaScript/CGI/Perl question or problem?  Let me know!
webXS - the new eZine for WebProgrammers! webXS@juno.com
Visit us @ http://www.bergen.org/~jefpin/webXS



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

Date: Tue, 24 Jun 1997 18:30:19 +0100
From: Andre Pinheiro <l41325@alfa.ist.utl.pt>
Subject: Newbie question: 500 Server Error
Message-Id: <Pine.OSF.3.96.970624182949.21032A-100000@alfa.ist.utl.pt>

I have this script on my server, in the cgi-bin directory.
By the way, I have other .pl scripts there, and they all work fine.
The script is called "games_search.pl".
Here is its source:

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

&showHTML_header;
&showHTML_footer;

exit;


sub showHTML_header {
 print 'Content-type: text/html' . "\n\n";
 print '<HTML><HEAD><TITLE>xxxx</TITLE></HEAD>' . "\n";
 print '<BODY TEXT="#000000" LINK="#008000" VLINK="#800000"
BGCOLOR="#FFFFCC">' . "\n";
 print '<CENTER>' . "\n";
 print '<IMG SRC="Images/Logo.jpg" WIDTH=272 HEIGHT=175 BORDER=0
ALT="xxxxxxx">' . "\n";
 print '<BR>' . "\n";
 print '<IMG SRC="Images/GreenBlackStripe.gif" WIDTH=536 HEIGHT=5><BR>' .
"\n";
 print '<IMG SRC="Images/GreenBlackStripe.gif" WIDTH=536 HEIGHT=5>' .
"\n";
 print '<P>' . "\n";
}


sub showHTML_footer {
 print '<FONT SIZE=-1>' . "\n";
 print 'Feedback:<BR>' . "\n";
 print '<P>' . "\n";
 print '</FONT>' . "\n";
 print '</CENTER></BODY></HTML>' . "\n";
}
----

When I specify http://bla, bla, bla/cgi-bin/games_search.pl the browser
says:
----
500 Server Error

The server encountered an internal error or misconfiguration and was
unable to complete your request.

Please contact the server administrator and inform them of the time the
error occurred, and anything you might have done that may have caused the
error.

Error: HTTPd: malformed header from script
/usr/local/etc/httpd/cgi-bin/games_search.pl 
----

Can anyone tell me what's happening?




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

Date: Thu, 26 Jun 1997 21:52:47 -0400
From: TechMaster Pinyan <jefpin@bergen.org>
To: Eric Bohlman <ebohlman@netcom.com>, packer@fermi.gsfc.nasa.gov
Subject: Re: Pattern-matching when strings have embedded "$"
Message-Id: <Pine.SGI.3.96.970626215110.7430A-100000@davinci.bergen.org>

>: I've discovered that if these text lines have embedded dollar
>: signs, such as "it cost $3.5 million", I don't get a match
>: when the two strings are, in fact, identical. I didn't find
>: anything in the various Perl FAQs that addressed this question.
>: I hope I don't have to create two temporary variables stripped
>: of "$" to do the match, 'cause it would slow down my program, no?

>You don't have to.  Look up the \Q metacharacter and the quotemeta() 
>function, which are there to address exactly the problem you've encountered.

when printing things in double quotes (") all scalar values are
interpolated... they are shown as Perl scalars...
using single quotes (') avoids this.  It prints $ as $ not the start of a
scalar variable.

----------------
| "I don't contemplate it, I just sit and think about it."
| 	- Sonia Balsky
----------------
Jeff "TechMaster" Pinyan | http://www.bergen.org/~jefpin
HTML/CGI Designer and Consultant and JavaScripter
jefpin@bergen.org | TechMasterJeff@juno.com
Got a JavaScript/CGI/Perl question or problem?  Let me know!
webXS - the new eZine for WebProgrammers! webXS@juno.com
Visit us @ http://www.bergen.org/~jefpin/webXS



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

Date: 26 Jun 1997 22:05:42 GMT
From: Zenin <zenin@best.com>
Subject: Re: Perl and PGP interface
Message-Id: <5oup3m$5p9$6@nntp2.ba.best.com>

Yvon D. Roustan <roustan@wwa.com> wrote:
>    open(OUT, "| pgp -eat '$filename' userID");
	>snip<

	See pgp -h and look for the -f (filter mode) option.

-Zenin
 zenin@best.com


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

Date: Thu, 26 Jun 1997 22:02:40 -0400
From: TechMaster Pinyan <jefpin@bergen.org>
Subject: Perl/CGI Scripting Ideas
Message-Id: <Pine.SGI.3.96.970626215652.7430C-100000@davinci.bergen.org>

I am a budding Perl scripter, who happens to be 15, and I need ideas for
some web site utilities... I use AccessWatch for my Hit Stats, and I made
a program called WebSite Stats which is comprised of WebStat (finds out
how big your website is, how much percentage the top level directories
take up, and when they were last updated) and WebTree (makes a tree of
your html files in each directory, and lists their file size and how many
images are in each file).  I also have a chat program, a poll program and
a guestbook program...

I am making a CGI/Perl Script Archive for my school (www.bergen.org/AAST)
and I want more web utility scripts.  I have enough ideas for interactive
scripts, but I want more utilities.

I would really like it if any of you could give me some ideas... to
decrease bandwidth, please email me, instead of cramming this newsgroup.

Thanks... :)

----------------
| "I don't contemplate it, I just sit and think about it."
| 	- Sonia Balsky
----------------
Jeff "TechMaster" Pinyan | http://www.bergen.org/~jefpin
HTML/CGI Designer and Consultant and JavaScripter
jefpin@bergen.org | TechMasterJeff@juno.com
Got a JavaScript/CGI/Perl question or problem?  Let me know!
webXS - the new eZine for WebProgrammers! webXS@juno.com
Visit us @ http://www.bergen.org/~jefpin/webXS



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

Date: Thu, 26 Jun 1997 19:01:27 -0400
From: Doug MacEachern <dougm@osf.org>
To: Mattias.Lonnqvist@uidesign.se
Subject: Re: Perlembed - cant compile
Message-Id: <33B2F4C7.5C88@osf.org>

Mattias Lvnnqvist wrote:
> 
> I am trying to get perlembedding in C working, so my first step was
> to check "man perlembed" which came up with some handy information,
> including the following piece of code:
> 
> --- start
> 
> #include <stdio.h>
> #include <EXTERN.h>
> #include <perl.h>
> 
> static PerlInterpreter *my_perl;
> 
> int main (int argc, char **argv, char **env)
> {
>   my_perl=perl_alloc;
>   perl_construct(my_perl);
>   perl_parse(my_perl, NULL; argc, argv, env);
>   perl_run(my_perl);
>   perl_destruct(my_perl);
>   perl_free(my_perl);
> }
> 
> --- end.
> 
> System stats:
> 
> "perl -e 'use Config; print $Config{archlib}'" provides:
> /usr/lib/perl5/i586-linux/5.003
> 
> "perl -e 'use Config; print $Config{libs}'" provides:
> -lgdbm -ldbm -ldb -ldl -lm -lcns1
> 
> "perl -v" provides:
> This is perl, version 5.003 with EMBED
>         built under linux at Jun 27 1996 21:52:16
>         + suidperl security patch
> 
> Copyright 1987-1996, Larry Wall
> 
> Perl may be copied only under the terms of either the Artistic License
> or the
> GNU General Public License, which may be found in the Perl 5.0 source
> kit.
> 
> The machine is running linux, I dont have root access, and according to
> the administrator,
> it was shipped with Perl prebuilt, meaning that he hasnt compiled it.
> 
> Compilation info:
> 
> First I tried with gcc, like this:
> 
> gcc -o interp interp.c -L/usr/lib/perl5/i586-linux/5.003/CORE
>  -I/usr/lib/perl5/i586-linux/5.003/CORE -lperl -lm
> 
> This generates millions of errors, first one being that it doesnt
> recognize bool as type in perl.h
> 
> I therefor tryed with g++, which handles bool, like this:
> 
> g++ -o interp interp.c -L/usr/lib/perl5/i586-linux/5.003/CORE
>  -I/usr/lib/perl5/i586-linux/5.003/CORE -lperl -lm
> 
> THis generates less errors, but still errors.
> 
> I then tried the following:
> 
> gcc -o interp interp.c -I/usr/lib/perl5/i586-linux/5.003/CORE
>  -L/usr/lib/Perl5 -lperl -lm
> 
> gcc -o interp interp.c -I/usr/lib/perl5/i586-linux/5.003/CORE
> / -lperl -lm
> 
> gcc -o interp interp.c -lperl -lm
> 
> gcc -o interp interp.c -I/usr/lib/perl5/* -L/usr/lib/Perl5/* -lperl -lm
> (where * = tried recursively adding subdirectories down to
> /usr/lib/perl5/i586-linux/5.003/CORE)
> 
> Still with no success. Can anyone help me figure out whats wrong?

You should grab the latest perlembed manpage which shows you how to use 
ExtUtils::Embed to figure out all the compiler and linker flags for you.
It also a good idea to install the latest Perl as it has many 
embedding-related bug fixes since 5.003, which you may or may not need 
depending on what you're trying to do.

latest Perl (includes most recent version of perlembed and ExtUtils::Embed):
http://www.perl.com/CPAN/src/latest.tar.gz

The ExtUtils::Embed kit on CPAN also ships with examples and tests that do 
not come with Perl:
http://www.perl.com/CPAN/modules/by-module/ExtUtils/

-Doug

> 
> /Mattias
> 
> --
> This was a message from Mattias Lonnqvist * mailto:malo@uidesign.se
> http://www.uidesign.se/~malo * phone +46 - (0)13- 37 12 05
> Unsolicited commercial email is subject to an archival fee of $400.
> See <http://www.uidesign.se/~malo/mail.html> for more info.


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

Date: Thu, 26 Jun 1997 15:16:38 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Wishwesh Gandhi - PCD ~ <wgandhi@pcocd2.intel.com>
Subject: Re: Problems compiling module
Message-Id: <Pine.GSO.3.96.970626151513.6142N-100000@kelly.teleport.com>

On 26 Jun 1997, Wishwesh Gandhi - PCD ~ wrote:

> readin.pm did not return a true value at /usr/perl/tmp3.pl line 7.

Thus sprache the perldiag(1) manpage:

     %s did not return a true value
         (F) A required (or used) file must return a true value
         to indicate that it compiled correctly and ran its
         initialization code correctly.  It's traditional to end
         such a file with a "1;", though any true value would do.
         See the require entry in the perlfunc manpage.

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 26 Jun 1997 15:56:01 -0700
From: Tony McCormick <tony@peregrinco.com>
Subject: Re: Reading Cookies
Message-Id: <33B2F380.9D931232@peregrinco.com>

mark wrote:
> 
> I'm trying to create a CGI script which, among other things, reads
> cookies.  I came across the following shell script on the Netscape
> site:
> 
> >#! /bin/sh
> >
> >echo "Content-type: text/html"
> >echo ""
> >echo "Here is your cookie (munch munch):<P>"
> >echo "$HTTP_COOKIE<P>"
> 
> It works fine as shell, but my perl equivilant ignores the
> $HTTP_COOKIE
> 
> >#!/usr/bin/perl
> >
> >print "Content-type: text/html\n\n";
> >print "Here is your cookie (munch munch):<P>\n";
> >print "$HTTP_COOKIE<P>\n";
> 
> Any ideas on how to read cookies?  Please send email.
> 
> Mark


Mark,

$HTTP_COOKIE is an environment variable.  Try

print "$ENV{"HTTP_COOKIE"}<P>\n";

-- 
Tony McCormick, Systems Analyst      (503) 690-1111
mailto://tony@peregrinco.com  or http://www.rdrop.com/~tonymcc
-- "Blink your eyelids periodically to lubricate your eyes."
from the HP "Environmental, Health & Safety Handbook for Employees." --


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

Date: Thu, 26 Jun 1997 15:58:09 -0700
From: Tony McCormick <tony@peregrinco.com>
Subject: Re: Reading Cookies
Message-Id: <33B2F401.F08A529B@peregrinco.com>

Tony McCormick wrote:
> Mark,
> 
> $HTTP_COOKIE is an environment variable.  Try
> 
> print "$ENV{"HTTP_COOKIE"}<P>\n";
> 

Oops, minor correction use single quotes around HTTP_COOKIE not
double.

-- 
Tony McCormick, Systems Analyst      (503) 690-1111
mailto://tony@peregrinco.com  or http://www.rdrop.com/~tonymcc
-- "Blink your eyelids periodically to lubricate your eyes."
from the HP "Environmental, Health & Safety Handbook for Employees." --


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

Date: 26 Jun 1997 22:21:26 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Regexps on streams
Message-Id: <5ouq16$pmo@agate.berkeley.edu>

In article <Pine.GSO.3.96.970626070536.9758H-100000@kelly.teleport.com>,
Tom Phoenix  <rootbeer@teleport.com> 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.

> 
> > The only reason it is not in the jumbo patch is that before your post
> > I could not squeeze an extra argument (refilling function and data)
> > into the RE engine API.  Your post somehow triggered an idea how to do
> > it... ;-)
> 
> Oh, no. :-)  Well, if a user-function is going to re-supply the stream
> data upon request, will there be some way for it to report failure? The
> reason I ask is because I'm thinking of what will happen if you abort a
> match halfway through. Where does control continue? Or is that event like
> a die() which could be trapped within eval{}? 

RE code is safe wrt die()ing inside.  And the function can reply that
in added 0 bytes to the string, which clearly indicates a failure.

> Also, if you've got a user function which can source the stream, it's only
> a small leap to having another user function to be a sink, thereby
> enabling s/// to work directly upon (yow) entire files of unlimited size. 

Yes, this is a part of specification. ;-)

Ilya


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

Date: 27 Jun 1997 01:57:26 GMT
From: Zenin <zenin@best.com>
Subject: Re: Script Fake a browser?
Message-Id: <5ov6m6$dsr$2@nntp2.ba.best.com>

Jonas Thvrnvall <labah@algonet.se> wrote:
> Is it possible for a Perl script to call a server and fake that it's a
> browser. Is there any script available for doing this? 

	use LWP::Simple;

	You'll probably need to d/l it from CPAN:
	http://www.perl.com/perl/CPAN


-- 
-Zenin
 zenin@best.com


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

Date: Thu, 26 Jun 1997 21:34:09 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: Source code comparison - know of a tool?
Message-Id: <tcyangECEJwy.80D@netcom.com>

This sounds like the joke you just submitted to rec.humor.funny for
the USAF Roswell report :)

==================================
Tom Phoenix typed before Poison Ivy kissed him:
: On Thu, 26 Jun 1997, Simon Goland wrote:

: > 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. 

: And of course, that's a sign that one of your students is destined
: to work for Microsoft, right? 

--
========= Try the low-crossposting robomoderated 'alt.culture.taiwan' ===

soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
   http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml


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

Date: 27 Jun 1997 00:29:42 GMT
From: regan@office.ao.com (Dave Regan)
To: sg@mda.ca
Subject: Re: Source code comparison - know of a tool?
Message-Id: <5ov1hm$pjo$1@bashir.peak.org>

In article <33B2B319.1806@mda.ca>,
	Simon Goland <sg@mda.ca> writes:

>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.

A long time ago I wrote a program to do something similar to this.
I broke the file into "words", and counted the number of occurances
of each word.  I then saved the ten (or so) longest words under
the assumption that long words are reasonably distinctive.
The first program saved all of these "signatures" to a file.

I then had a second program which could combine any number of signature
files looking for files which had a substantial number of long words
in common (say 70%), and printed out the pairs of filenames.
At one point I worked in the number of occurances into the matching
rules, although I eventually didn't worry about it.

Using this scheme, I was able to find many of the similar files.

Computers are faster and have more RAM and disk then when I was doing
this, and it may be possible to log all words (or more than 10 anyway).

Beware that doing this in the simple fashion that I did is an N^2
problem.  With lots of files it will take awhile to execute.  With
the 60 or 100 that you are talking about, brute force like this
will probably work.

If your students know what you are up to, they can frustrate your
efforts.  However, that is probably true regardless of how you
look for common traits.

Unfortuately, I no longer have access to the code I described above.
However, I hope the ideas are of use when working on your problem.

				Dave Regan
				regan@ao.com



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

Date: Thu, 26 Jun 1997 18:37:31 -0400
From: John Yang <hjy2@cornell.edu>
Subject: strange error:" dlopen: stub interception failed "
Message-Id: <33B2EF29.B1DFE77@cornell.edu>

I wrote a script to go onto search engines, and take the output and
format it so that users could add links from the search engine easily to
pages. The script worked fine on my NT box last night, but today at
work, it seemed to die on the Unix box. The error was as follows:


light/dcane/www/cgi/courses/ljdev: perl5 -w search.pl
dlopen: stub interception failed
Abort (core dumped)


This error message has stumped me. I tried to debug the script using the
perl debugger, but to no avail. it exited and gave the same error.  The
script will eventually run as CGI. I have HTML formating in there to
make it look nice.

Using perl 5. Unix machine is running SunOS 4.1.4.  My development
platform at home is NT Workstation 4, with perl 5.  got the script to
run fine on NT, died on Unix. any ideas? and help at all would be nice.
Thanks in advance. please cc response to my mail. Thanks.

The following is a copy of the script.

#!/usr/local/bin/perl5

#require "define_paths.pl";
#require "cgi_parse.pl";
#require "courseinfo_copyright.pl";

use Socket;


MAIN:
{
#        &parse_input(*input);
#        &define_paths;
# &fixsearch;
        &getandprintsearch;
#        &print_ack;
}

sub fixsearch{
 $FORM{'search'} =~ tr/\s/+/;
}

sub getandprintsearch {
#print "testing sockets";
my ($remote, $port, $iaddr, $paddr, $proto, $line);
$remote='www.excite.com';
$port=80;
$iaddr=inet_aton($remote) or die "no host: $!";
$paddr=sockaddr_in($port,$iaddr);
$proto=getprotobyname('tcp');
print "trying to connect";
socket (SOCK, PF_INET,SOCK_STREAM , $proto) or die "socket: $!";
connect (SOCK, $paddr) or die "connect:$!";
$req = "GET
/search.gw?search=cornell&trace=a&collection=web&perPage=20\n\n";
&print_content_header;
print  "<HTML><HEAD><TITLE>Search results</TITLE></HEAD><BODY>";
print  "<FORM action=\"\" method=\"post\">";
send SOCK,$req,MSG_OOB;
while ($line=<SOCK>){
 last if ($line =~ /<B>View by Web Site<\/B>/);
}
while ($line=<SOCK>){
 last if ($line =~ /<P>/);
}
$number=0;
while ($line=<SOCK>){
 if ($line =~ /<FONT SIZE=/){
  $line=<SOCK>;
 } elsif ($line =~ /<CENTER>/){
  for ($i=0;$i<10;$i++){
   $line=<SOCK>;
  }
 } elsif ($line =~ /<FONT COLOR=/){
  $number++;
  print "<input type=\"checkbox\" name=\"$number\" value=\"add\">\n";
  print "$line";
  $line=<SOCK>;
  print "$line";
  $line =~ tr/"/'/;
  print "<input type=hidden name=\"url$number\" value=\"$line\">\n";
 } elsif ($line =~ /<BR><B><I>Summary:/){
  print "$line";
  $line =~ tr/"/'/;
  print "<input type=hidden name=\"desc$number\" value=\"$line\">\n";
 } elsif ($line =~/<FORM ACTION=/){
  last;
 } else {
  print $line;
 }
}
print "<center><input type=submit></center></FORM></BODY></HTML>";
close (SOCK) or die "close: $!";
}




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

Date: 27 Jun 1997 02:35:54 GMT
From: "Rajiv Kukreja" <rajivk@worldnet.att.net>
Subject: Trouble using modules in Perl5.003 for Win32
Message-Id: <01bc82a3$a2351840$0b2174cf@default>

Well - I have a Windows NT 4.0 server that has a few of it's directories
mapped as different drive letters on a couple of Windows NT workstations. 
Now, is it all right to include drive letters along with the pathnames in
the @INC array?

The problem I am facing is this:

I can execute a perl test program from a specific directory - the program
does have a statement that uses external .pm modules.  But when I move the
perl program to any other directory, it chokes on the fact that it couldn't
locate the module......

It is clearly not a problem due to relative pathnames - all the pathnames
used in the push (@INC......) statements are absolute pathnames- like 
push(@INC, "k:\perl\lib");.....and so on

Does anyone have an idea as to how this can be solved?

Faisal Mohamood
fxm3318@rit.edu


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

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

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