[9856] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3449 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 14 17:07:13 1998

Date: Fri, 14 Aug 98 14:00:28 -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           Fri, 14 Aug 1998     Volume: 8 Number: 3449

Today's topics:
        Anyone ever successfully register some perl code as an  malloc@my-dejanews.com
    Re: Apache mod_rewrite, PROBLEM SOLVED <support@rosenet.net>
        BUG: Perl spontaneously jumps to other Perl code <glew@hf.intel.com>
        Calling Perl subroutines from C/C++ <ple@mitra.com>
    Re: Change NT IP Address Using Perl (-)
    Re: clp.moderated setup info? <jev@newton.pconline.com>
    Re: Error in Databases (Mike)
        execute shell-scripts from PERL? <oyvindba@nextel.no>
    Re: execute shell-scripts from PERL? <rootbeer@teleport.com>
    Re: execute shell-scripts from PERL? (Craig Berry)
    Re: File updating question <kpatel@mathworks.com>
    Re: File updating question <tchrist@mox.perl.com>
    Re: File updating question <kpatel@mathworks.com>
    Re: File updating question <tchrist@mox.perl.com>
    Re: File updating question <kpatel@mathworks.com>
    Re: Forked CGI process won't terminate browser connecti (Kenneth Herron)
    Re: freeware documentation <nonspammers.start.after.this.period.hot_redox@hotmail.com>
        Geanfammer : A biology program for genome analysis and  jong@salt2.med.harvard.edu
        help with reading a file to browser <fcalabro@aisvt.bfg.com>
    Re: help with reading a file to browser <rootbeer@teleport.com>
        How can I execute an external program from Perl with pa <oyvindba@nextel.no>
        Insert SQL in Perl script <alex@digi-q.com>
        Mirror packages msrivast@lads.is.lmco.com
    Re: Mirror packages <rootbeer@teleport.com>
        mod_perl stacked handlers amartinez@arturo.net
    Re: Opening a file as "+>>file" (Phil Taylor)
    Re: Parsing Word to ASCII <matt@steinhoff.net>
    Re: Perl spontaneously jumps to other Perl code <glew@hf.intel.com>
        Printing large numbers with commas heinrich7486@my-dejanews.com
    Re: Printing large numbers with commas <rootbeer@teleport.com>
    Re: Q: How to read all the file name in a directory (Ollie Cook)
    Re: re first language mchunziker@us.fortis.com
    Re: Recommend a good editor <tchrist@mox.perl.com>
    Re: Recommend a good editor <cmcurtin@interhack.net>
        RFA: searching for binary pattern in binary file via re (Steve McNabb)
    Re: RFA: searching for binary pattern in binary file vi <rootbeer@teleport.com>
        testing if file exists <dan@fearsome.net>
    Re: X-file (?=...), case postponed. (Ken Pizzini)
    Re: X-file (?=...), case postponed. (Dave Lorand)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Fri, 14 Aug 1998 19:02:37 GMT
From: malloc@my-dejanews.com
Subject: Anyone ever successfully register some perl code as an NT service?
Message-Id: <6r21kd$9k1$1@nnrp1.dejanews.com>

I've got a perl daemon that I would *love* to add as an NT service. I have
toyed with the sc.exe utility and the program registered itself as a service,
but it will not start. I'm not that keen on programming in the NT environment
- it's just not my background - but it looks like it's got to be native win
code to run. Is that true? It might be the way I've structured the parameters
to sc.exe, but I doubt it b/c I tried ever option and loophole I can think of
(including creating a batch file to call my perl daemon). Maybe if I prepare
a snippet of C code to just call the perl program? Might that would do it?
Anyone ever do anything like this? I would sell my soul for a NT version of
"nohup &" right now!!

 Any input is appreciated,
                          scott

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


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

Date: Fri, 14 Aug 1998 10:53:15 -0700
From: Rosenet Technical Support <support@rosenet.net>
Subject: Re: Apache mod_rewrite, PROBLEM SOLVED
Message-Id: <35D4798B.2C9F@rosenet.net>

Rosenet Technical Support wrote:
> 
> Hello all,
> 
> I have been searching and cannot seem to find the answer to this
> problem.  I hope someone can help...

I figured it out...

There are options that can be set per-directory in Apache.  The 
options for the /cgi-bin/ directory are 'supposed' to be set to 
"None" (for security reasons).  With the options set to None, CGI and 
perl scripts work just fine when you execute them normally.  I had to 
set the options to "ExecCGI" for this directory and call my perl 
script whatever.cgi in order for the script to execute through a 
mod_rewrite redirected URL.

Sorry if this was a bit off-topic.  I wasn't getting any assistance from
Apache users and I thought that some perl people may have run into this.

Thanks all...

Christopher Ostmo
a.k.a.  support@rosenet.net
Rosenet, Inc.

For a good time,
http://modems.rosenet.net/


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

Date: 14 Aug 1998 20:28:16 GMT
From: "Andy Glew" <glew@hf.intel.com>
Subject: BUG: Perl spontaneously jumps to other Perl code
Message-Id: <01bdc7bc$d9027d40$82dcb58f@aglew2>

I have looked for this in the FAQs, and not found it yet.
I am not aware of any archive of outstanding bug reports.
I am hoping that somebody can tell me if this is an outstanding bug in Perl,
or in me, and save me the effort of having to isolate this bug from outr
of the middle of 12,000 lines of code (i.e. the bug seems only to occur
in large context, and I have not yet succeeded in isolating it in 
a small example).


In developing perl-sql, a large perl application,
I have repeatedly encountered situations where
Perl seems to SPONTANEOUSLY jump from one piece
of Perl code to another - usually in a different module -
with no control flow statements to explain it.

I have reported similar examples of this to this newsgroup in the
past, but have usually been able to work around them. No such luck today.


In today's example, I am in the middle of one routine in one module

addon::merge_tuple_pair(/afs/cs.wisc.edu/p/multiscalar/glew/agss/src/perl-sql/lib/Perl_SQL/addon.pm:495):
495:	    my $old_into = ( exists $arg{into} 
496:			    ? $arg{into} 
497:			    : die "merge_tuples requires into keyword argument\n" );
  DB<13> n
db_algorithms::process(/afs/cs.wisc.edu/p/multiscalar/glew/agss/src/perl-sql/lib/Perl_SQL/db_algorithms.pm:1224):
1224:		if( $args{options}->{filter} ) {
  DB<13> 
db_algorithms::process(/afs/cs.wisc.edu/p/multiscalar/glew/agss/src/perl-sql/lib/Perl_SQL/db_algorithms.pm:1225):
1225:		    if( defined $eret and ref $eret eq 'ARRAY' ) {
  DB<13> 

and I get moved "spontaneously" somewhere else, as shown by the above debugger.

There is no control flow nearby: 

    my $unchanged_keys = ( exists $arg{unchanged_keys} # TBD: change from unchanged_keys to fieldname_transform...
		    ? $arg{unchanged_keys} 
		    : {} );
    
    my $old_into = ( exists $arg{into} 
		    ? $arg{into} 
		    : die "merge_tuples requires into keyword argument\n" );
    my %new_into = %$old_into;
    my $into = \%new_into;

    my $new = ( exists $arg{new} 
		    ? $arg{new} 
		    : die "merge ...

Unless somebody can spot an error in the above code fragment that is causing this,
the only strangeness in the vicinity is that
(a) I called sort, with its special handling of the compare function, recently,
and
(b) I am also using the compare function of sort outside of sort, to accomplish my purposes,
trying to emulate the special call environment used by sort (package globals $a and $b, etc.)



=====

Related and similar behavior:


The sort POD says that the sort compare function cannot be recursive, and should not
be exited by loop/block control or goto.

To this, I can add that *any* call of another function, not just a recursive call,
seems to be dangerous in the sort compare routine.

Also, *any* use of GOTO, not just one exiting the compare function, can cause this
"spontaneous change of flow of control" misbehaviour.

=====

Hypothesis: 

Perhaps the interpreter is getting screwed up?

Perhaps the sort compare function is specially munged for use in sort,
and cannot be used outside of the sort environment?


======


Please respond by email 
as well as replying to this newsgroup;
I do not regularly read this newsgroup,
and I do not have a filter intelligent enough to
look for replies to my posts.









-- 
Andy Glew, of Intel & U. Wisc.,
but neither is responsible for my posts.


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

Date: Fri, 14 Aug 1998 15:05:21 -0400
From: Phuong Le <ple@mitra.com>
Subject: Calling Perl subroutines from C/C++
Message-Id: <35D48A71.5A47A718@mitra.com>

I am very thrill to be able to extending perl and embedding perl 
into the C/C++ library so that my perl script can call my C/C++ 
library functions and my C/C++ library can call perl subroutines.

However I only able to accomplish this feat on Unix.

For window I have no problem calling C/C++ library functions from perl
but
I am unable to call perl subroutines from my C/C++ library.

This is how I call perl subroutines from C/C++ library but this call
only 
available on Unix and not on windows.  


---------------------------------------------------------
char *perl_cb;
void *perl_cb_data;
 ...

//#ifndef WINDOWS
   if ( perl_cb != (char *)0 )
   {
      int cb_retval = 0;
      
      dSP;
      ENTER;
      SAVETMPS;
      PUSHMARK(sp);
      XPUSHs(sv_2mortal(newSViv((long)perl_cb_data)));
      PUTBACK;
      SPAGAIN;
      perl_call_pv(perl_c_store_setup_cb, G_SCALAR);
      cb_retval = POPi;

      PUTBACK;
      FREETMPS;
      LEAVE;

      return cb_retval;
   }
//#endif
------------------------------------------------------------

I build my library by link in with perl.lib(using Visual C++ 5) 
that I got from the binary distribution of perl
"perl5_00402-bindist04-bc.zip".
The linker complain about unresolved external symbol
( it cannot find it in any .obj or .lib file )

Do I need to link in with any other library beside perl.lib?

There is also a GD.lib and GD.dll from the binary distribution.  
However the GD.lib does not seem to be a valid .lib file.  
If I use dumpbin(similar to nm on Unix) on GD.lib I got

	warning: LNK4048: Invalid format file

When I use dumpbin on GD.dll I found that all the functions call and
symbols 
that require for my C/C++ library to call a perl subroutine are in
there.
I think my problem would be solved if I have a good GD.lib file that I
can link with.

Any feedback in regard to calling perl subroutine from C/C++ function
would be greatly appreciate

Phuong Le
ple@mitra.com


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

Date: Fri, 14 Aug 1998 18:51:44 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Change NT IP Address Using Perl
Message-Id: <35d48707.268535298@news2.cais.com>

"wkchiu" <wkchiu@yahoo.com> Said this:

>Is it possible to change the IP Address and Gateway using Perl ? What Perl
>command can I use ?
>

Don't you still have to reboot an NT machine to change the IP address
anyway?  

Get a linux box, and you can do it "on the fly" any way you like,
perl, shell script, whatever. ;)




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

Date: 14 Aug 1998 19:20:02 GMT
From: John Erjavec V <jev@newton.pconline.com>
Subject: Re: clp.moderated setup info?
Message-Id: <6r22l2$34m$1@bell.pconline.com>

Craig Berry <cberry@cinenet.net> wrote:
: My ISP's news admin appears to have misconfigured clp.moderated such that
: I can't post to it (well, I can, but it doesn't go to the moderators and
: thus doesn't propagate properly).  He's attempting to fix this, but
: neither of us can find the config info needed to install it properly.  And
: to compound the problem, I'm not entirely sure what such info consists of.
: 
: So: If any clp.moderated moderator or other knowledgable person could
: either email me this information, or post it here, I would be most
: grateful.  Thanks in advance...

I am running into the exact same problem.  (It's at least nice to know that
it isn't just me...)

I would also appreciate the information as I would like to be able to at
least get into the group.  Thanks.

-JEV
-- 
John Erjavec V	PGP fingerprint:
jev@pconline.com	7593 1B5A AE11 C0FE BA09  EB5E 8DE9 D2E5 BF5B 87AD
http://www.pconline.com/~jev/index.html


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

Date: 14 Aug 1998 17:39:29 GMT
From: schutzmd@SPAMFREEjmu.edu (Mike)
Subject: Re: Error in Databases
Message-Id: <6r1soh$fcd$1@lark.jmu.edu>

Kowalski (coolwater@cyberdude.com) wrote:
> How do I get information out of a database (MSAccess) using perl?

The best way would be to read a little before asking.  I think this
specific question has been asked at least a dozen times in the past week.

- mike -



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

Date: Fri, 14 Aug 1998 21:28:36 +0200
From: "Xyvind Bangsund" <oyvindba@nextel.no>
Subject: execute shell-scripts from PERL?
Message-Id: <35D48FE4.E25BAE29@nextel.no>

How can read the output from a shell-script within a perl-script?

--
Med vennlig hilsen
Xyvind Bangsund,
Webmaster,
Telenor Internett Kundeservice




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

Date: Fri, 14 Aug 1998 20:01:17 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: execute shell-scripts from PERL?
Message-Id: <Pine.GSO.4.02.9808141259380.10161-100000@user2.teleport.com>

On Fri, 14 Aug 1998, =D8yvind Bangsund wrote:

> How can read the output from a shell-script within a perl-script?

The methods in the docs are recommended. :-)  Start with perlfunc, perlop
(qx//), and perlipc. Hope this helps!

--=20
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 14 Aug 1998 20:01:15 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: execute shell-scripts from PERL?
Message-Id: <6r252b$ndk$1@marina.cinenet.net>

Xyvind Bangsund (oyvindba@nextel.no) wrote:
: How can read the output from a shell-script within a perl-script?

See the discussion of backticks `` or qx() in perlop.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Fri, 14 Aug 1998 14:31:07 -0400
From: Ketan Patel <kpatel@mathworks.com>
Subject: Re: File updating question
Message-Id: <35D4826B.9F89DE7F@mathworks.com>

Jeff Yoak wrote:

> As another poster pointed out, you probably don't want $print above,
> but let's assume that's just a typo.

Yes, that was just a typo in the post...

> You're next problem is that you took out your "column" divider with
> the split and you when you implicity put humpty back together with
> your print statement, you don't re-add the divider.  Perhaps have a
> look at:

Ok, here is the 'new' script:

#!/usr/local/bin/perl5
($^I) = '.bak';
open(DATAX,"+<test.txt");
flock DATAX, 2;
while(<DATAX>) {
	@array = split(/\|/,$_);
	$array[2] = int($array[2]);
	$array[2]++;
	$new = join("\|",@array);
	print DATAX;
}
close(DATAX);

Now, here are the 'before' and 'after' files (on the web so posting
doesn't screw up all the lines etc...):

before: http://www.thebigsite.com/before.txt
 after: http://www.thebigsite.com/after.txt

Is this 'screw-up' somehow logical!?!?!  Am I missing something!?!?!

Thanks for all the help!


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

Date: 14 Aug 1998 18:33:17 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: File updating question
Message-Id: <6r1vtd$n0i$1@csnews.cs.colorado.edu>

 [politesse and courtesy cc of this posting denied to cited author as
 a penalty for address munging]

:no no no. as i mentioned in another post to someone esle, you CANNOT READ
:AND WRITE AT THE SAME TIME IF YOU'RE GOING TO CHANGE THE SIZE OF THE FILE.
:sorry for the shouting. 

Goodness, but you have no earthly idea what you're taking about, and you
had to scream your confusion as well.  I don't suppose you're a Windows
user, eh?  I hear cluelessness runs deep in that crowd.

--tom
-- 
	    "Perl is to sed as C is to assembly language."  -me


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

Date: Fri, 14 Aug 1998 14:38:18 -0400
From: Ketan Patel <kpatel@mathworks.com>
Subject: Re: File updating question
Message-Id: <35D4841A.2E3C0AD8@mathworks.com>

Ketan Patel wrote:
> Ok, here is the 'new' script:
> 
> #!/usr/local/bin/perl5
> ($^I) = '.bak';
> open(DATAX,"+<test.txt");
> flock DATAX, 2;
> while(<DATAX>) {
>         @array = split(/\|/,$_);
>         $array[2] = int($array[2]);
>         $array[2]++;
>         $new = join("\|",@array);
>         print DATAX;
> }
> close(DATAX);

In case someone brings up that:

	print DATAX;

should be:

	print DATAX $new;

I ran it both ways and it gives the same results...


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

Date: 14 Aug 1998 19:05:12 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: File updating question
Message-Id: <6r21p8$o06$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    Ketan Patel <kpatel@mathworks.com> writes:
:open(DATAX,"+<test.txt");
:while(<DATAX>) {
:	@array = split(/\|/,$_);
:	$array[2] = int($array[2]);
:	$array[2]++;
:	$new = join("\|",@array);
:	print DATAX;
:}
:Is this 'screw-up' somehow logical!?!?!  Am I missing something!?!?!

Yes, the `screw-up' is completely logical and predictable.  You aren't
understanding how files work.  You cannot possibly do that.  Do you
understand what seek pointers are?   Just use -i.

--tom
-- 
Besides, it's good to force C programmers to use the toolbox occasionally.  :-)
        --Larry Wall in <1991May31.181659.28817@jpl-devvax.jpl.nasa.gov>


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

Date: Fri, 14 Aug 1998 16:22:38 -0400
From: Ketan Patel <kpatel@mathworks.com>
Subject: Re: File updating question
Message-Id: <35D49C8E.B7C3D35C@mathworks.com>

Tom Christiansen wrote:
> 
> Yes, the `screw-up' is completely logical and predictable.  You aren't
> understanding how files work.  You cannot possibly do that.  Do you
> understand what seek pointers are?   Just use -i.

As far as I understand, '-i' has to be used at the beginning of the file
like: 

#!/usr/local/bin/perl5 -i.bak

Right?  Well, the script I posted before is actually a subroutine in a
'file of subroutines' which I 'require' into other scripts that need
that sub.  Where do I put the '-i'?  At the beginning of the calling
script!?  Won't that affect all prints in the original script?  Doesn't
setting the value of $^I when it's needed produce the same effect?  Why
does the error occur at that one particular spot?  Where can I find more
info on this?!?  I have the blue camel book, but I can't find anything
to answer these questions...  Any particular chapters I should check
out!?

Thanks!

-- confused!


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

Date: 14 Aug 1998 20:17:29 GMT
From: kherron@campus.mci.net (Kenneth Herron)
Subject: Re: Forked CGI process won't terminate browser connection
Message-Id: <6r260p$iqh$1@news.campus.mci.net>

In article <6r0m8e$ch2$1@nnrp1.dejanews.com>,
 <glen_a_smith@my-dejanews.com> wrote:
|		if (fork() == 0) {
|			exec("$bg_process_cmd");
|		} else {
|			print "Done. The task has been commenced\n";
|			exit 0;
|		}

If you'll check one of the CGI programming groups,
comp.infosystems.www.authoring.cgi for example, you'll probably find
that this is a FAQ.

The web server gets the cgi program's output by reading from a pipe
connected to the cgi program's stdout and stderr; the web server won't
consider the cgi process to be finished until it sees end-of-file on
this pipe.  Pipes only indicate end-of-file when every instance of the
writer end of the pipe is closed.  The new process has the same stdin,
stdout, and stderr as the original process, so until the new process
exits or closes its stdout and stderr, it holds the pipe open.
-- 
Kenneth Herron -- kherron@campus.mci.net
"When Microsoft first took control of the Funk & Wagnalls Encyclopedia
product, there was a flattering biography of Bill Gates.  But it said he
was known as a tough competitor.  Now it says that he's known for his
charitable contributions." -- Gary Reback, <http://www.ljx.com/reback/>


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

Date: 14 Aug 1998 20:59:00 GMT
From: "Sabre Taylor" <nonspammers.start.after.this.period.hot_redox@hotmail.com>
Subject: Re: freeware documentation
Message-Id: <01bdc7c6$44b66ca0$c1620c8a@lnxcompaq.lexis-nexis.com>

> Either you're new or a sadist or both.  :-)

Apologies.


Sabre



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

Date: Fri, 14 Aug 1998 19:02:55 GMT
From: jong@salt2.med.harvard.edu
Subject: Geanfammer : A biology program for genome analysis and protein family maker.
Message-Id: <6r21ku$9ka$1@nnrp1.dejanews.com>

   Anncouncement

  Geanfammer : A biology program for genome analysis and protein family
maker.

   Language: Perl5

   http://cyrah.med.harvard.edu/Project/Geanfammer

ftp://unix.hensa.ac.uk/mirrors/perl-CPAN/modules/by-category/23_Miscellaneous_Modules/Bio/



--
jong@salt2.med.harvard.edu

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


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

Date: Fri, 14 Aug 1998 15:13:49 -0400
From: Finn Calabro <fcalabro@aisvt.bfg.com>
Subject: help with reading a file to browser
Message-Id: <35D48C6D.E8E4662@aisvt.bfg.com>

I'm trying something very simple, yet I'm too dumb to get it to work.
I'd appreciate any help.

I have a script to read an ascii file and print it to the browser.
Right now it works fine when run from the command prompt through telnet,
but when run in the browser nothing comes up (the html tags do, but
nothing from the document being read).

#!/usr/local/bin/perl
print "Content-type: text/html\r\n"; # The first line must specify
content type
print "\r\n";                        # A blank line ends the headers

print "<html><head></head><body><pre>";

open(FILE,"toc.txt");
@data = <FILE>;
print @data;
print "</pre></body></html>";


I also tried:
#!/usr/local/bin/perl
print "Content-type: text/html\r\n"; # The first line must specify
content type
print "\r\n";                        # A blank line ends the headers

print "<html><head></head><body><pre>";

open(FILE,"toc.txt");
while (<FILE>) {
        print <FILE>;
        }
print "</pre></body></html>";



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

Date: Fri, 14 Aug 1998 19:45:26 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: help with reading a file to browser
Message-Id: <Pine.GSO.4.02.9808141244580.10161-100000@user2.teleport.com>

On Fri, 14 Aug 1998, Finn Calabro wrote:

> open(FILE,"toc.txt");

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 14 Aug 1998 22:02:15 +0200
From: "Xyvind Bangsund" <oyvindba@nextel.no>
Subject: How can I execute an external program from Perl with parameters?
Message-Id: <35D497C7.1F5F93A2@nextel.no>

Like:

$output = `externalprogram.exe parameters`;
print $output;

???

--
Med vennlig hilsen
Xyvind Bangsund,
Webmaster,
Telenor Internett Kundeservice




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

Date: Fri, 14 Aug 1998 11:47:37 -0700
From: Alex Guberman <alex@digi-q.com>
Subject: Insert SQL in Perl script
Message-Id: <35D48649.588D@digi-q.com>

Hi,

Does anybody know how to embed SQL in Perl, so I can work with mSQL?  A
sample would be great.  All I have so far is:

#!/usr/bin/perl

print "Content-type: text/html\n\n";

#############################
print  <<"PAGE";
<title>Test</title>
</head><body><center>
PAGE
#############################



my $dbh = Msql->connect() || die "Boo hoo";
$dbh->selectdb('find');

my $sth = $dbh->query(qq[SELECT id, name FROM test]);
@result = $sth->fetchrow;
print "@result";



Please help!!

Alex
-- 
___________________________________

 DIGI-Q Productions Co.

 Web Site:	http://www.Digi-Q.com
 E-Mail:	alex@digi-q.com
 Phone:		(408) 252-4091
 Toll Free:	(888) 55 DIGI-Q
		(888) 553-4447
___________________________________


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

Date: Fri, 14 Aug 1998 20:21:10 GMT
From: msrivast@lads.is.lmco.com
Subject: Mirror packages
Message-Id: <6r267m$jit$1@nnrp1.dejanews.com>

I am looking for a relatively cheap mirror package that will allow two or more
sites to be in relative synch with each other. I know of two so far W3mir and
WebMirror any others?

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


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

Date: Fri, 14 Aug 1998 20:38:12 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Mirror packages
Message-Id: <Pine.GSO.4.02.9808141337570.10161-100000@user2.teleport.com>

On Fri, 14 Aug 1998 msrivast@lads.is.lmco.com wrote:

> I am looking for a relatively cheap mirror package that will allow two
> or more sites to be in relative synch with each other. I know of two
> so far W3mir and WebMirror any others?

If you're wishing merely to _find_ (as opposed to write) programs,
this newsgroup may not be the best resource for you. There are many
freeware and shareware archives which you can find by searching Yahoo
or a similar service. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 14 Aug 1998 19:04:19 GMT
From: amartinez@arturo.net
Subject: mod_perl stacked handlers
Message-Id: <6r21nj$9l3$1@nnrp1.dejanews.com>

Anyone here familiar with Mod_perlstacked handlers?

I'm needing to filter output from a database call for SSI's and the SSI's for
dynamic URL's .  I've been trying to stack the output using the following in
the httpd.conf file

<Files ~ "\.htm$">
SetHandler perl-script
PerlHandler Apache::OutputChain Apache::Registry Apache::SSIChain
Apache::PassHtml
Options ExecCGI
</Files>

But I can't find any documentation or examples either in the perldocs or on
the mod_perl archives about what you have to add the code to make it work.  I
think I'm missing somthing.

Any help or direction would be greatly appreciated.

Art
artm@mail.utexas.edu

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


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

Date: Fri, 14 Aug 1998 18:26:34 GMT
From: phil@ackltd.demon.co.uk (Phil Taylor)
Subject: Re: Opening a file as "+>>file"
Message-Id: <35d480d7.1009781@news.demon.co.uk>

On 14 Aug 1998 12:11:58 GMT, Tom Christiansen <tchrist@mox.perl.com>
wrote:

> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, phil@ackltd.demon.co.uk (Phil Taylor) writes:
>:I have read the faq, but the problem with the examples are that they
>:open the file with a mode of "+>" and in another article in this group
>:someone has stated you can't do this if you are going to change the
>:size of the file.
>
>What are you talking about?  
>
Apologies, the above should have read "mode of "+<". I'm sorted now.

Thanks again

Phil



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

Date: Fri, 14 Aug 1998 13:50:30 -0400
From: Matt Steinhoff <matt@steinhoff.net>
Subject: Re: Parsing Word to ASCII
Message-Id: <35D478E6.3A44@steinhoff.net>

Finn Calabro (fcalabro@aisvt.bfg.com) wrote:
> I'm looking for a script that will convert ms Word 97 documents
> to ascii.  They eventually need to be in HTML, but I can get
> them from ascii to html.  Thanks

    If you don't mind skipping the ascii step and going right
to html, here's a most wonderful solution based on LAOLA...
    http://www.csn.ul.ie/~caolan/docs/MSWordView.html

    Matt

+----------------------------------------------------------------+
| Matt Steinhoff                                    407-420-6121 |
| matt@steinhoff.net                  Unix Systems Administrator |


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

Date: 14 Aug 1998 20:56:49 GMT
From: "Andy Glew" <glew@hf.intel.com>
Subject: Re: Perl spontaneously jumps to other Perl code
Message-Id: <01bdc7c0$d5a090c0$82dcb58f@aglew2>

Urgh. Blush. Embarassed.

Uncaught die exceptions in evals...




Andy Glew <glew@hf.intel.com> wrote in article <01bdc7bc$d9027d40$82dcb58f@aglew2>...
> I have looked for this in the FAQs, and not found it yet.
> I am not aware of any archive of outstanding bug reports.
> I am hoping that somebody can tell me if this is an outstanding bug in Perl,
> or in me, and save me the effort of having to isolate this bug from outr
> of the middle of 12,000 lines of code (i.e. the bug seems only to occur
> in large context, and I have not yet succeeded in isolating it in 
> a small example).
> 
> 
> In developing perl-sql, a large perl application,
> I have repeatedly encountered situations where
> Perl seems to SPONTANEOUSLY jump from one piece
> of Perl code to another - usually in a different module -
> with no control flow statements to explain it.
> 
> I have reported similar examples of this to this newsgroup in the
> past, but have usually been able to work around them. No such luck today.
> 
> 
> In today's example, I am in the middle of one routine in one module
> 
> addon::merge_tuple_pair(/afs/cs.wisc.edu/p/multiscalar/glew/agss/src/perl-sql/lib/Perl_SQL/addon.pm:495):
> 495:	    my $old_into = ( exists $arg{into} 
> 496:			    ? $arg{into} 
> 497:			    : die "merge_tuples requires into keyword argument\n" );
>   DB<13> n
> db_algorithms::process(/afs/cs.wisc.edu/p/multiscalar/glew/agss/src/perl-sql/lib/Perl_SQL/db_algorithms.pm:1224):
> 1224:		if( $args{options}->{filter} ) {
>   DB<13> 
> db_algorithms::process(/afs/cs.wisc.edu/p/multiscalar/glew/agss/src/perl-sql/lib/Perl_SQL/db_algorithms.pm:1225):
> 1225:		    if( defined $eret and ref $eret eq 'ARRAY' ) {
>   DB<13> 
> 
> and I get moved "spontaneously" somewhere else, as shown by the above debugger.
> 
> There is no control flow nearby: 
> 
>     my $unchanged_keys = ( exists $arg{unchanged_keys} # TBD: change from unchanged_keys to fieldname_transform...
> 		    ? $arg{unchanged_keys} 
> 		    : {} );
>     
>     my $old_into = ( exists $arg{into} 
> 		    ? $arg{into} 
> 		    : die "merge_tuples requires into keyword argument\n" );
>     my %new_into = %$old_into;
>     my $into = \%new_into;
> 
>     my $new = ( exists $arg{new} 
> 		    ? $arg{new} 
> 		    : die "merge ...
> 
> Unless somebody can spot an error in the above code fragment that is causing this,
> the only strangeness in the vicinity is that
> (a) I called sort, with its special handling of the compare function, recently,
> and
> (b) I am also using the compare function of sort outside of sort, to accomplish my purposes,
> trying to emulate the special call environment used by sort (package globals $a and $b, etc.)
> 
> 
> 
> =====
> 
> Related and similar behavior:
> 
> 
> The sort POD says that the sort compare function cannot be recursive, and should not
> be exited by loop/block control or goto.
> 
> To this, I can add that *any* call of another function, not just a recursive call,
> seems to be dangerous in the sort compare routine.
> 
> Also, *any* use of GOTO, not just one exiting the compare function, can cause this
> "spontaneous change of flow of control" misbehaviour.
> 
> =====
> 
> Hypothesis: 
> 
> Perhaps the interpreter is getting screwed up?
> 
> Perhaps the sort compare function is specially munged for use in sort,
> and cannot be used outside of the sort environment?
> 
> 
> ======
> 
> 
> Please respond by email 
> as well as replying to this newsgroup;
> I do not regularly read this newsgroup,
> and I do not have a filter intelligent enough to
> look for replies to my posts.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> Andy Glew, of Intel & U. Wisc.,
> but neither is responsible for my posts.
> 


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

Date: Fri, 14 Aug 1998 18:46:38 GMT
From: heinrich7486@my-dejanews.com
Subject: Printing large numbers with commas
Message-Id: <6r20me$7ls$1@nnrp1.dejanews.com>

I am trying to display a large floating point with a precision of 2 and
commas for ease of viewing.  Currently I am using printf with %.2f.  This
works fine for the precision problem, but is there an easy way to print
commas in a number?

$a=123456.987654

output should be

123,456.98 or rounded to 123,456.99

I display many sizes of numbers, so if
$a=5.678

output should be
5.67 or 5.68

not 000,005.67

Thanks.

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


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

Date: Fri, 14 Aug 1998 19:44:26 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Printing large numbers with commas
Message-Id: <Pine.GSO.4.02.9808141244110.10161-100000@user2.teleport.com>

On Fri, 14 Aug 1998 heinrich7486@my-dejanews.com wrote:

> Subject: Printing large numbers with commas

FAQ.

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 14 Aug 1998 20:34:51 GMT
From: oliver.REMOVE.cook@bigfoot.DELETE.com (Ollie Cook)
Subject: Re: Q: How to read all the file name in a directory
Message-Id: <35d49ea2.959671@news.ukonline.co.uk>

On 14 Aug 1998 13:48:05 GMT, Tom Christiansen <tchrist@mox.perl.com>
wrote:
>Let me guess: you're a Windows ``programmer'', aren't you?  Do you
>know why Unix programmers make more money than Windows ``programmers''?
>Because we Unix people know how to read the manual -- and you don't.

Actually, Perl is the only language, apart from DOS Basic that I've
ever programmed in.

Don't you think it's odd how two people answered my answer kindly,
nicely and to the point, and you flew off the handles?

OC
----
Oliver COOK, Web Site Designer for
Premiere Web Designs - Http://Www.Premiere.Uk.Com/
+
Webmaster of The Audio-Visual Archive 
 * over 900 images and 700 sounds, free
 * Http://Www.Premiere.Uk.Com/ava/ 


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

Date: Fri, 14 Aug 1998 19:51:43 GMT
From: mchunziker@us.fortis.com
Subject: Re: re first language
Message-Id: <6r24gf$fj0$1@nnrp1.dejanews.com>

<snip>

> But doing it in that order is likely to have the student
> frequently saying things like "Is *that* how it's done
> in assembler? What a pain in the ass!"

>
> --
> John Porter

Sounds like me talking when I took over as a backup administrator
to an AS/400 after doing Unix for the last couple of years...
"That's how it's done on an AS/400? What a pain in the ass!"

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


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

Date: 14 Aug 1998 18:14:01 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Recommend a good editor
Message-Id: <6r1up9$m9r$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, "Steve Bohler" <skbohler@sprynet.com> writes:
:I've searched through previous posts, but am not finding a recommendation
:for an easy-to-use Perl editor that runs on Windows.  I've used emacs
:before, but was wondering if there was something better.

Probably not, but you could try vi(m).  It's easier in some ways,
harder in others.

But don't expect to find a `Windows product' that can compare with
either of them.

And what the devil is a `Perl editor'?  Surely you have something
to edit text with.

--tom
-- 
PL/1, "the fatal disease", belongs more to the problem set than to the
solution set.
                --E. W. Dijkstra


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

Date: 14 Aug 1998 15:57:46 -0400
From: Matt Curtin <cmcurtin@interhack.net>
To: "Steve Bohler" <skbohler@sprynet.com>
Subject: Re: Recommend a good editor
Message-Id: <8690kribet.fsf@scooter.cis.ohio-state.edu>

"Steve Bohler" <skbohler@sprynet.com> writes:

> I've searched through previous posts, but am not finding a
> recommendation for an easy-to-use Perl editor that runs on Windows.
> I've used emacs before, but was wondering if there was something
> better.

XEmacs is, in my opinion, the ultimate developer's environment.  Its
cperl-mode is excellent.  I'd suggest giving it a whirl.

XEmacs 21, in beta now, is available for Win32 platforms.
<http://www.xemacs.org/> 

-- 
Matt Curtin cmcurtin@interhack.net http://www.interhack.net/people/cmcurtin/


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

Date: 14 Aug 1998 20:31:09 GMT
From: smcnabb@interlog.com (Steve McNabb)
Subject: RFA: searching for binary pattern in binary file via regex
Message-Id: <6r26qd$he3$1@nntp2.uunet.ca>

Hi All -- dug around in the FAQ's for quite a while, but couldn't find an 
answer to this:

I have one binary file, and I want to search that file for a large pattern 
(actually, it's a whole other binary file -- a trojan horse that some of you 
may have heard of by now, cDc's back orfice)

Here is my planned methodology (suggestions,directions,etc greatly 
appreciated)

1)  convert both files to hex to simplify processing
2)  write a system that will take a chunk out of the middle of Boserv.exe            
    (the trojan) and scan the suspect hex-converted binary file for said 
    pattern.  If this pattern is found, the  file gets marked "suspicious" 
    (since I'm sure it's possible that said pattern could be found in other 
     regular non-trojan binaries anyhow
3)  move the suspicious files OFF the network via Jazz drive (onto a     
    stand-alone PC) 
4)  scrutinize the suspicious files further to see if they really are     
    infected with the trojan
5)  panic as required :-)

So, my question is, how can I convert a whole file to hex so that I can scan 
through it as hex?  I tried the sprintf "%lx",$foo; as suggested in the Camel 
book, but that's only for a long int, which, since I want to look at a whole
file as hex, doesn't get me very far.  I suppose I could chunk the file down
into little pieces, but I'd rather slurp and regex the whole beastie at once
if possible..Alternately, if there is a way I can do a binary-based regex, 
that would be nifty too :)


Any suggestions, directions, queries or critiques welcomed.

Many thanks in advance,

Steve McNabb
smcnabb@interlog.com




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

Date: Fri, 14 Aug 1998 20:50:17 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: RFA: searching for binary pattern in binary file via regex
Message-Id: <Pine.GSO.4.02.9808141338430.10161-100000@user2.teleport.com>

On 14 Aug 1998, Steve McNabb wrote:

> I have one binary file, and I want to search that file for a large
> pattern (actually, it's a whole other binary file -- a trojan horse
> that some of you may have heard of by now, cDc's back orfice)

> 1)  convert both files to hex to simplify processing

Nah, don't need to do that. Instead, you can make the pattern match binary
data directly. 

    /\x68\x6f\x72\x73\x65\x2e/	# matches 'horse.' (Not /horse./ !)

To turn the search string into a pattern like that, use something
like this:

    $hex = join '', map { sprintf "\\x%02x", ord $_ } split //, $horse;

(Of course, you could make the pattern simpler, but then the
pattern-generating code would be more complex...) Now you can read in your
binary and scan it for any binary string you wish. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 14 Aug 1998 21:50:46 +0100
From: "Daniel Adams" <dan@fearsome.net>
Subject: testing if file exists
Message-Id: <903127895.9553.0.nnrp-08.c2deb1c5@news.demon.co.uk>

As part of a larger perl script, I am trying to write a subroutine which
conducts an "if, then, else" statement on whether a file exists.

i.e. in plain language: "If file foobar.htm exists then goto subroutine
'exist' else goto subroutine 'notthere'.

The bit I am stuck on is the "foobar.htm exists" part, the rest I can do,
the if/then statements etc -but  how do I write "if foobar.htm exists" in
Perl?

or, more accurately "if /disk1/usr/public_html/foobar.htm exists"

Bemusedly,

Dan Adams
dan@fearsome.net




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

Date: 14 Aug 1998 17:05:16 GMT
From: ken@halcyon.com (Ken Pizzini)
Subject: Re: X-file (?=...), case postponed.
Message-Id: <slrn6t7plr.ggu.ken@pulsar.halcyon.com>

On Wed, 12 Aug 1998 15:51:59 GMT, Dave Lorand <davel@spc.uchicago.edu> wrote:
>Or else:
>
>  ($temp, @arr, $temp) = split //, 'abcde';

That won't do what you meant it to: the @arr assignment is greedy...

		--Ken Pizzini


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

Date: Fri, 14 Aug 1998 19:53:04 GMT
From: davel@spc.uchicago.edu (Dave Lorand)
Subject: Re: X-file (?=...), case postponed.
Message-Id: <davel-1408981453040001@honeybee.spc.uchicago.edu>

[ courtesy copy cc'd to the original author ]

In article <slrn6t7plr.ggu.ken@pulsar.halcyon.com>, ken@halcyon.com wrote:

> On Wed, 12 Aug 1998 15:51:59 GMT, Dave Lorand <davel@spc.uchicago.edu> wrote:
> >Or else:
> >
> >  ($temp, @arr, $temp) = split //, 'abcde';
> 
> That won't do what you meant it to: the @arr assignment is greedy...
> 
>                 --Ken Pizzini

Oops - I should type slower.  Thanks for pointing that out.

Luckily, split behaves in a way natural enough that I don't need to do
things like that to get a list of the chars in a string.

Regards,

Dave

 ____________________________________________________________
| Dave Lorand                       | davel@spc.uchicago.edu |
| Programmer/Analyst                | 773-702-3792           |
| Social Science Research Computing | 773-702-0793 (dept.)   |
| University of Chicago             | 773-702-2101 (fax)     |
+-----------------------------------+------------------------+


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

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

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