[18171] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 339 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 22 21:05:43 2001

Date: Thu, 22 Feb 2001 18:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <982893909-v10-i339@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 22 Feb 2001     Volume: 10 Number: 339

Today's topics:
    Re: (OFF TOPIC) Re: This is driving me nuts and I need  <mischief@velma.motion.net>
    Re: Array length (Craig Berry)
    Re: Console logging under Solaris <Jonathan.L.Ericson@jpl.nasa.gov>
    Re: Console logging under Solaris (Logan Shaw)
        DBD::Sybase <scott.cairns@nospm.panacya.com>
    Re: Disabling debugging support in Perl? <mischief@velma.motion.net>
        Execution Problem <whataman@home.com>
    Re: help with variables in my email <Jonathan.L.Ericson@jpl.nasa.gov>
    Re: help with variables in my email <richard.meldrum@fmr.com>
        Perl and Java applet <xu@redbird.co.uk>
    Re: Print out an url problem.. (Damian James)
        question about arrays <johnhamm@wpi.edu>
    Re: Quickest way to convert all keys in a hash from upp (Craig Berry)
    Re: Regexp to match Web urls? <elijah@workspot.net>
        starting apps from cgi (no, not a hacker :o) (erb)
        STDOUT and PID question <blaakso1@worldnet.att.net>
        Trying to use Mysql and insert <vivekvp@spliced.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 23 Feb 2001 00:17:00 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: (OFF TOPIC) Re: This is driving me nuts and I need a guru
Message-Id: <t9bavs13hsci0b@corp.supernews.com>

SJ Straith <straith@modusvarious.org> wrote:
> Chris Stith (reaching for the coffee) wrote:
> : SJ Straith <straith@modusvarious.org> wrote:
> :> Steven Smolinski (reaching for the coffee) wrote:
> :> : Frank Miller <no@email.com> wrote:


> soc. ne social
> soc. eq sociology

My mistake. Sociology does suffer if someone is using poor
communication and reference skills, too. Perhaps moreso, since
the references can't define things as accurately in one of the
few softer sciences that is actually softer than computer science.

> : It's about computers, computer languages, perl, miscellaneous
> : topics about Perl. That what comp.lang.perl.misc means. We're
> : here to discuss, not to be forgiving of those who make a mess
> : of the newsgroup.

> If I respond to this paragraph as I feel it deserves, this will
> turn into a flame, which I at least did not intend.

Thank you for being polite. I did not mean to offend, or to imply
ignorance. I only meant to reinforce. I'm sure the name is clear
to you, much moreso than the soc. heirarchy is to me, since I do
not visit any of those groups.

[snip]

> :> : - Type perldoc and read the usage message.  Pointer to the FAQ.

> :> The way the usage message reads, it appears as though one would need
> :> to know exactly what to ask for there.  Some of the RTFF responses 
> :> indicate that the question is a variation on a question in the FAQ.

> : So look through the perlfaq manpage.

> Sounds like a good idea.  One problem.  When I type "man perlfaq" I get

> "No manual entry for perlfaq."

This is another case of your specific installation being non-standard.
As you mention, this may be the fault of your ISP or web hosting
service, but we did not choose your hosting service for you.

> :> : - The main perl manpage points to the faq on the first page.

> :> Oh, really?

> : On my versions it does. 5.005_03 and 5.6.0

> :> I just took a look at the main perl manpage accessable from
> :> the shell I'm in and didn't see it in any part of the manpage.
> :> Now this COULD be because the manpage is old, as this cut from 
> :> it seems to indicate,

> :>     24/Mar/96         Last change: perl 5.003 with

[snip]

> : Don't blame others for your outdated documentation. It's free,

[snip]

> Did I say I was blaming anyone?  No.  I was simply showing that
> sometimes things aren't as you expect them to be.

Which is not the fault of someone expecting to find a standard
thing in a standard place. It is the fault of the one who (re)moved it.

> As for whether the perl was installed correctly or not, take that
> up with my ISP.  I don't, at the moment, have my linux boxen up
> with the complete install of the most recent version of perl.  I
> am using my shell account with my ISP and their perl installation.

> I use what's available.

I will not take it up with your ISP. I didn't choose your ISP, I don't
pay your ISP, and I don't have a complaint against the usability of
your ISP. It would seem that you do have a valid complaint against them.

> :> : - www.perl.com has "FAQ" on their main navigation.

> :> A lot of people don't think to STFW.  I've had to be reminded of 
> :> this occasionally

> : A lot of people don't think in general.

> I have to agree.  That's why "common sense" isn't.

> : Sometimes, people just don't think about who's going to be the
> : designated driver. Does that mean it's okay to drive drunk?

> Now THAT has to be one of the most ridculous comparisons I have
> even seen made in an arguement.

Is it? The drunk driving example and failing to read documentation
before posting both boil down to leaving out one detail crucial to
the days activities which cause you to be in an undesirable state
among a group of your fellow humans. One has much greater potential
cost, but the nature of inconsideration of others is the same no
matter how it manifests itself.

> :> : - It's mentioned on this ng several times a day.

> :> That one I won't argue.  In tin, which I commonly use for
> :> reading ngs, all I had to do was type FAQ in the search
> :> and it took me to the first of the FAQ segments.

> : There's a newsgroup FAQ, too, which mentions the Perl FAQ. Try
> : searching for that and reading it, as it is common netiquette to
> : do before posting, if you have any questions about the newsgroup
> : policy or need to find resources about Perl to search (like
> : perl.com if you should happen to actually dare to STFW).

> <G>

> :> : - a search for "perl faq" on google yields the thing as the first
> :> :   listing.

> :> See above.

> : See the discussion of driving drunk above.  

> <G> See response to the discussion of driving drunk above.

:-/  Again, I admit it's hyperbole, but it is intended as such. Perhaps
my explanation of why I feel it's an appropriate comparison will at least
make it read as a failed analogy instead of an absurd one.

> :> : It's hard work to avoid konwing about the FAQ!

> :> Not quite as hard as you think.  I will say, that while I read
> :> this group I have only asked for help once, maybe twice.  I 
> :> won't do THAT again.  Only my perl programmer roomie is allowed
> :> to heap that kind of abuse on me. <G>

> : Know the software you are going to use. Read the Free Manual.
> : Read the Fine Manual. Read the F******* Manual. Then, Read the
> : Full Manual when you have time.

> You DO realize that reading Manualese is a talent, knack, ability
> (pick one) that not everybody has, don't you?

I realize that reading a manual and understanding exactly what it
means outside the context of the tools is very difficult. However,
you should have Perl readily available to you when you are reading
the online documentation. Open three or four windows if you must,
one beside another. One for docs, one for an editor, one for STDOUT
of the program, and maybe one other for another doc source or for
tailing a log file if your program makes one.

Most abilities, regardless of talent, can be learned to some extent
with education, practice, and determination. Even sports and music
can be taught and learned to a great deal, although those with
natural talents excel easier and farther than the rest. Reading for
comprehension and comparing results of tests to documentation are
no more difficult than rehearsing a musical piece and changing
what you do based on how you sound. In fact, being a strong amateur
musician who sings and plays many instruments, I'd say reading
documentation for Perl is much easier.

> The fact that I can make sense out of most manuals, some of which
> really appear to be written with information obfuscation in mind,
> doesn't mean that I expect everyone (even other programmers) to
> be able to do so.

If one can't make sense of a manual, then one needs to do something
other than technical work. Public service employees with no technical
knowledge read and comprehend procedural manuals on a regular basis.
High school students (at least where I went to school) must be able to
follow a dissection manual, a lab experiment manual, a writing style
guide, and perhaps a cooking recipe or a prose assembly specification
among other possible types of instruction manuals, including a syllabus
for some classes. I went to a public high school, too, so it's probably
not that special a case.

Most people presume at least a high school diploma if not an associate's
degree as a very minimum for a programmer, especially for someone who
develops software full-time. Much more likely is an undergraduate degree
or perhaps a graduate or advanced degree. I would guess you have at least
an undergraduate degree yourself from your writing, so you should know
how much reading and writing that can take. 

> Do have a good day, won't you?

I would hope you do the same. :-)

Chris

-- 
Christopher E. Stith
Disclaimer: Actual product may not resemble picture in ad in any way.



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

Date: Fri, 23 Feb 2001 00:48:46 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Array length
Message-Id: <t9bcreah7qft2a@corp.supernews.com>

wavetable (x@x.x) wrote:
: Although this seems like a simple task I couldn't find how to do it in the
: FAQ. Does anyone know how/if it is possible to get the length of an array?

Oddly enough, no.  Even though having the length of an array would seem an
incredibly useful and trivial thing, the designers of Perl have gone out
of their way to make sure it's completely impossible.  Not content simply
to provide no direct means of obtaining an array's length, they actually
implemented code analysis subroutines which detect indirect array-length
measurements and subvert them.  Observe:

  % perl -e '@foo = qw(a b c d); $n++ foreach @foo; print $n'
  17

Fiendish, hm?  Why would these evil geniuses work so hard to prevent us
from obtaining the <hint>scalar value of an array</hint>'s length?  I'll
tell you:  Infinite malice.  Malice is the secret fourth virtue of a
programmer, the one Larry Wall didn't mention.  But I've already said too
much.

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "When the going gets weird, the weird turn pro."
   |               - Hunter S. Thompson


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

Date: 22 Feb 2001 23:17:37 +0000
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: Console logging under Solaris
Message-Id: <861ysqb94e.fsf@jon_ericson.jpl.nasa.gov>

Rick Meldrum <richard.meldrum@fmr.com> writes:

> Has anyone succecssfully built a console logger in perl?

Why reinvent the wheel? Use script.

Jon


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

Date: 22 Feb 2001 18:31:04 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Console logging under Solaris
Message-Id: <974b08$56s$1@boomer.cs.utexas.edu>

In article <3A959984.95DF9EBF@fmr.com>,
Rick Meldrum  <richard.meldrum@fmr.com> wrote:
>Operative word "usually". The info I'm after is what was on the screen
>just before a crash or panic. Many times it is not in /var/adm/messages.

That's why you use "savecore" to get a crash dump.  I'm not sure if it
includes the last several messages, but it should have the information
you need to figure out what went wrong.

>...And I was attempting to write a console logging utility  in perl.....

This probably needs to be a device driver, or you need to take
advantage of devices drivers that already exist in Solaris.

If you *really* want the information, one way to do it is to hook a
teletype (i.e. terminal that has a printer instead of a screen), and
use "consadm" to redirect console messages there in addition to the
regular console.

Actually, if you really want, you can redirect console messages to a
program.  The "xterm" program does this with the "-C" option, and
"dtterm" can do it too, but I suggest "xterm" because source code is
available, so it's easier to find out how it does it if you're
interested.  But, last I checked, this was not completely reliable
because if the system is under heavy load and your process doesn't
respond quickly, the kernel will just write the output to the regular
console instead of the redirected location.  The behavior under that
circumstance might have changed (it has been a while since I observed
that behavior), but the problem still exists.

I've set follow-ups to comp.unix.solaris, since this isn't a Perl
issue.

  - Logan
-- 
my  your   his  her   our   their   *its*
I'm you're he's she's we're they're *it's*


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

Date: Thu, 22 Feb 2001 23:24:46 GMT
From: "sdc" <scott.cairns@nospm.panacya.com>
Subject: DBD::Sybase
Message-Id: <2dhl6.118863$B6.27271918@news1.rdc1.md.home.com>

Is DBD::Sybase supported on the Win32 platform?

I have it working great on Solaris and DBD::Oracle works great on Win32 but
I can't get DBD::Sybase to work on Win32 to save my life.




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

Date: Fri, 23 Feb 2001 01:50:09 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Disabling debugging support in Perl?
Message-Id: <t9bgehs6ubp54d@corp.supernews.com>

Joshua Cope <Joshua.Cope@compaq.com> wrote:
>   I have a site requirement to disable debugging support in all compilers and 
> interpreters, including Perl. Is there a simple way to disable the Perl 
> debugger in a runtime environment (that is, without recompiling the Perl
> executable)? 

As for your specific question, I doubt it. There's no mention of any such
thing in the perlrun manpage, and the debugger is part of the perl core.

I'm not a core hacker, but if I understand correctly, the debugger is rather
tightly coupled to the parser and code generator, but I could be mistaken
with all the work that's being done on making the interpreter more modular.
You could try making all calls to the debugger just stub calls, but I'm not
sure how well that would work. It may be the case (although again, my lack
or expertise about the core comes into play here) that the debugger or
parts of it actually are code shared among multiple parts of perl. Someone
with specific knowledge about the core could clarify this for us.

I can, however, maybe shed some light on your situation.

If this is a hosting machine, you should reconsider having binary compilers
on it at all. Compile sources elsewhere and put them on the machine as
binaries. You could compile perl without its C debugging info, but that
just keeps you from debugging perl as easily, not programs written using it.

A site requirement such as that is generally done for security purposes --
that is, to keep someone from figuring out how a binary works by debugging
it with the added support of debugging-specific symbols left in by the
compiler. The compiler doesn't debug code (in most cases). It can either
leave in certain symbols when it compiles the source that an external
debugger will find helpful. Most programs can still be debugged without the
extra information, but the debugger becomes less helpful. 

Perl programs do not ship as binaries, as a rule. The ability to debug a
Perl program does not follow the specific interpreter. One can debug
a Perl program on another system's interpreter if they have the program,
because the program is in source and doesn't carry special debugging
symbols. It carries the whole program in human-readable form, which can
be bytecode compiled and interpreted by the interpreter system (and then
debugged at that point).

The exceptions to the above rule are the experimental compilation features
and perl2exe, and perhaps you could consider embedding Perl into C a way
to send the Perl program around as binary too, although this last one is
overkill. To get rid of all the debugging info in a binary made with
one of these methods, you'd have to know the specifics of how the binary
is being made. For example, if you use the Perl to C translation or
embedding, then compile the C code, you must have the debugging support
disabled for the C compiler. I'm not sure how to (or if you can) disable
debugging symbol output with perl2exe, although I bet you can since one
somewhat questionable reason many people want to compile their code in
the first place is for the bit of security a binary offers over source.

I hope some of this is helpuful.

Chris

-- 
Christopher E. Stith
If they can get you asking the wrong questions, they don't
have to worry about the answers.
  -- Thomas Pynchon, Gravity's Rainbow



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

Date: Thu, 22 Feb 2001 23:44:59 GMT
From: "What A Man !" <whataman@home.com>
Subject: Execution Problem
Message-Id: <3A95A4EF.795B3E0D@home.com>

This is a perl and CGI problem. BTW, the CGI ng has been
down now for over a week.

I have a program on a webhost that allows people to input
a URL and it processes their file into several other
directories and files. The problem is that some of these
files turn out to be executable files. I thought by
changing the .cgi, .pl, or .exe to .txt that this would
prevent them from being executed on my server, and
hopefully prevent any likelihood of possible damage.
Wrong!

This doesn't seem to be a good solution. I've discovered
that a file can still be executable even if it has no file
extension. Further, my server seems to want to even
execute .txt files.

I've set the user directory at 705, in order for users to
read their processed files. Should I umask the directory
also? If so, what should the permission and umask values
be? And how do I find out what umask value my host has
set? (because perldoc -f umask says that a umask value
subtracts from your chmod value).

Thanks,
Dennis


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

Date: 22 Feb 2001 23:07:17 +0000
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: help with variables in my email
Message-Id: <8666i2b9lm.fsf@jon_ericson.jpl.nasa.gov>

"John T." <j2lab.nospam@my-deja.com> writes:

> I currently have a script that opens a text file then emails the content
> of the text file line by line.  I would like to enter the current date
> into the email.  I tried assigning the current date to a variable and
> added the variable within the text file.  All I seem to get back is the
> $variablename in the email.  What is it that I'm doing wrong?

Umm... eval? (See perldoc -f eval)

  $ perl -ne '$_ = eval $_;print "$_\n"'
  $0
  -e
  $^O
  cygwin
  $]
  5.006001

Jon


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

Date: Thu, 22 Feb 2001 17:30:23 -0500
From: Rick Meldrum <richard.meldrum@fmr.com>
Subject: Re: help with variables in my email
Message-Id: <3A9592FF.21F78F5D@fmr.com>

Perl does no automatic expansion of variables within variables. (It doesn't
look for "$value" inside $_)
Now if you're trying a simple  while(<>){ print}  loop,  try adding eval:

while (<TEXT_FILE>){
    eval $_;
    print $_;
}

That should "look into" $_  for you....

"John T." wrote:

> I currently have a script that opens a text file then emails the content
> of the text file line by line.  I would like to enter the current date
> into the email.  I tried assigning the current date to a variable and
> added the variable within the text file.  All I seem to get back is the
> $variablename in the email.  What is it that I'm doing wrong?
>
> Any help would be greatly appreciated.
> -jt



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

Date: Fri, 23 Feb 2001 00:14:08 -0000
From: "Xu" <xu@redbird.co.uk>
Subject: Perl and Java applet
Message-Id: <9749hi$4am$1@newsg1.svr.pol.co.uk>

Is it possible for a Perl CGI script to respond to a client browser request
for a page  with a Java applet embedded in its <APPLET> tag?
 .




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

Date: 23 Feb 2001 01:40:56 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Print out an url problem..
Message-Id: <slrn99bfs3.ipd.damian@puma.qimr.edu.au>

[jeopardectomy performed]
>
>"Josef Moellers" <josef.moellers@fujitsu-siemens.com> skrev i meddelandet
>news:3A94E789.A518B412@fujitsu-siemens.com...
>"Fabian Thorbjörnsson" wrote:
>>
>> I can't figure out how to print out my html page from the script.
>>
>> Easy or hard?
>
>I'd say "veeery hard", because you have to do the entire layout and
>rendering of images yourself. Also, blinking fonts and animated GIFs
>don't really come out that good on paper (Sorry, could not resist that
>one B-{)

Paper is my favourite medium for viewing animated GIFs :-)

Thus spake Fabian Thorbjörnsson on Thu, 22 Feb 2001 12:19:36 GMT:
>I just want my paper printer to print out a simpe html document.

You probably want to investigate the CPAN modules HTML::FormatPS and
HTML::FormatText by Gisle Aas. Use the former if you have a PS printer, or
can find a suitable PS to whatever language your printer speaks convertor, 
otherwise use the latter.

HTH,

Cheers,
Damian
-- 
#!/usr/bin/perl -w
use strict;$|=1;$:=79;for $; (split//,<DATA>){print" "x($:-$_),
$;,"\x"x600,"\b"x($:-$_+1)for 0..--$:;print$;}; __END__
Just another Perl Hacker 


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

Date: Thu, 22 Feb 2001 20:18:48 -0500
From: John Hamm <johnhamm@wpi.edu>
Subject: question about arrays
Message-Id: <Pine.OSF.4.30.0102222015030.26728-100000@grover.WPI.EDU>

Hi there,
I'm using GD for creating images and for some weird reason it won't accept
an array that I create like:

for ($i=0;$i<10;$i++)
{
   $myarray[$i] = $i;
}

it has to be created like:

@myarray = [
	     0,
	     1,
	     2,
	     3,
	     4,
	     5,
	     6,
	     7,
	     8,
	     9,
	   ];


Anyone know what the difference between creating an array these two
different ways?  Thanks in advance for any help!!!

John Hamm

	=============================================================
			         John Hammond
	  		       johnhamm@wpi.edu
	   	         http://www.wpi.edu/~johnhamm
	=============================================================




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

Date: Fri, 23 Feb 2001 01:07:40 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Quickest way to convert all keys in a hash from uppercase to lowercase (or vice-versa)?
Message-Id: <t9bdus9d2rn2cf@corp.supernews.com>

Philip Obbard (pobbard@hotresponse.com) wrote:
: At one point in my code, I wind-up with a hashref containing uppercase key
: names when I eventually need lower case key names, so I do the following
: with my hashref $results:
: 
:  #Put keys in lowercase
:  while(my ($key, $value) = each(%$result)) {
:   $result->{lc($key)} = $value;
:   delete($result->{$key});
:  }
: 
: This works, but I'm wondering: is there a quicker way to do this (and
: wind-up with another hashref, perhaps)?

This approach creates a new hashref rather than modifying the existing
one.  I've included it in a working test framework.

#!/usr/bin/perl -w
# lckeys - demo of creating a hashref copy with keys lower-cased
# Craig Berry (20010222)

use strict;

my $h1 = { FoO => 1,
           BAR => 2,
           baZ => 3 };
my $h2;

# Use a hash slice to assign all the lc'd keys at once

@{$h2}{ map { lc } keys %$h1 } = values %$h1;

# Show that it worked

while (my ($k, $v) = each %$h2) {
  print "$k = $v\n";
}


-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "When the going gets weird, the weird turn pro."
   |               - Hunter S. Thompson


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

Date: 23 Feb 2001 00:35:07 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: Regexp to match Web urls?
Message-Id: <eli$0102221917@qz.little-neck.ny.us>

In comp.lang.perl.misc, Abigail <abigail@foad.org> wrote:
> Eli the Bearded (elijah@workspot.net) wrote on MMDCCXXXI September
> MCMXCIII in <URL:news:eli$0102211629@qz.little-neck.ny.us>:
> "" In comp.lang.perl.misc, Clay Shirky <clays@panix.com> wrote:
> "" > I need the canonical regexp to match urls beginning with http:// (I
> "" > don't need to worry about ftp:, telnet: or mailto:, in other words)
> "" > and though I don't want to roll my own, Google searches of the form 
> "" Maybe not cannonical, but
> ""   @parts =
> ""   m,\b
> ""    (http)                # scheme
> ""    ://(?:
> "" 	(?:
> "" 	    ([^:@/\s]+)  # username -- if password in URL
> "" 	:)?
> "" 	([^:@/\s]+)      # username if no password -- otherwise password
> "" 	 @
> ""       )?
> ""       ([^:@/\s]+)        # hostname
> ""       (?: :
> "" 	  (\d+)          # port number
> ""       )?
> ""    (                     # URI start
> ""      (/ [^\s"'>?]*)      # file part
> ""      (?: \?
> ""        ( [^\s"'>]* )     # CGI args
> ""      )?
> ""    )?                    # URI end
> ""   ,x;
> Sorry, that allows too much.

What does it allow? A sample URL please.

> Here's a better one (it cheats on ldap:// though) (remove the newlines):

Use /x.

> (?:http://(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?)\.
> )*(?:[a-zA-Z](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?))|(?:(?:\d+)(?:\.(?:\d+)
> ){3}))(?::(?:\d+))?)(?:/(?:(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F
> \d]{2}))|[;:@&=])*)(?:/(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{
> 2}))|[;:@&=])*))*)(?:\?(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{
> 2}))|[;:@&=])*))?)?)

That's the only part needed for http URLs, the rest is different shemes.

I notice also that this is somewhat strictly following the RFCs in
some regards, rather than following what works in practice. But it
still doesn't catch things like bad IP addresses.

	my $re = qr^$httppart^x;

	while(<>) {
	  if(/($re)/) {
            print "Matched <$1>\n";
          } else {
            print "No match\n";
          }
	}

http://eli:S3CrET@some.machine:8080/cgi/readmail?mess=17&f=1
Matched <http://eli>
http://2130706433/2130706433-is-127.0.0.1-as-one-number/
No match
http://18918181.1818181.23932939.83883:888888888888888/
Matched <http://18918181.1818181.23932939.83883:888888888888888/>

So I fail to see the advantage of this for http scheme URLs over my
RE, which does not claim to be strictly RFC compliant and would
match all three of these.

Elijah
------
got a parse error when he {y/\n//}ed the full RE


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

Date: 22 Feb 2001 23:00:10 GMT
From: erbmicha@msu.edu (erb)
Subject: starting apps from cgi (no, not a hacker :o)
Message-Id: <9745lq$2o20$2@msunews.cl.msu.edu>

i have an application on the server that does statistical analysis on a 
proprietary file format. i need to be able to pass variables from a web form 
to a script which then writes a control file, then executes the proprietary 
application, and then redirects the user. it cannot(!) redirect the user 
before the application is done though.

of course i tried to use:
    	system 'c:\ease3\winease.exe c:\ease3\files\control.bas';
to do it but if i execute the script from IE/Netscape the winease.exe 
program comes back with a:

    	"The instruction at "0x0034afe4" referenced memory at "0x00000000".     
	The memory could not be "read".

and then terminates.

however, if i execute the perl script via the command line, everything works 
like a charm, except the output doesn't "redirect" me obviously.

anyone know how to get around this?

i'm running ActivePerl (latest) on IIS (<- not my idea!)

thanks!!!


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

Date: Fri, 23 Feb 2001 01:57:45 GMT
From: Brian <blaakso1@worldnet.att.net>
Subject: STDOUT and PID question
Message-Id: <3A95C38C.4A37A41D@worldnet.att.net>

Hello All:
   This is a question that's been bugging me for a while now. I'm sure
that some one with more Perl experience can easily solve it. Here are
the particulars:

The perl program is to be run on a NT system (service pack 4).
I have loaded Active Perl 5.6
The program should be portable to a UNIX system.

The scenario:
   This perl program executes an executable to do some work. This
executable will never come back. (It is a Java server process. The
process is continuous.). The perl program must record the process ID of
the executable and since the executable dumps a lot of data to STDOUT
the perl must re-direct the output to a file. Simple enough right! Well
first off it seems that 'fork' and 'exec' do not work as documented on a
NT machine. However, 'open' seems to.

So here is a trial program: (This one almost works)

### start program

$fileName="c:/temp/logfile.txt";

$pid = open(PROGHANDLE, "./test1.exe > $fileName |");

open (PIDFILE, "> c:/temp/PIDFILE.txt");
print "$pid\n";
close (PIDFILE);

### end program

Simple and it looks like it will work right? Nope, the re-direct fires
off a shell for the work and the PID that comes back from 'open' is for
that shell. So the PID for the executable might be 300, for the shell
might be 301. The PID passed back from 'open' is 301.

Without the re-direct the 'open' does return the correct PID as follows:
open (PROGHANDLE, "./test1.exe |");

So my question is : How do I get the STDOUT from the executable? I
understand that the output is sitting in the handle PROGHANDLE and if I
want I could spin through it and print to another handle, but there's
got to be another way. 

Can I get the PID of the executable before re-directing STDOUT? Kind of
nested 'open' calls.

Is there a way to dump one handle to another automatically? That is,
everything that gets to PROGHANDLE is sent to another handle also. 

Or a great way of telling perl not to fire off a shell for the
re-direct.

Hope some guru out there can help.

Thanks much.
Brian Laakso

P.S. Please respond to this post or email at blaakso1@yahoo.com. I don't
get to read the account I'm posting from too often.


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

Date: Fri, 23 Feb 2001 01:08:22 GMT
From: "Victor Prasad" <vivekvp@spliced.com>
Subject: Trying to use Mysql and insert
Message-Id: <aKil6.277008$f36.10597001@news20.bellglobal.com>

Hello,

Below is a dbitrace of my insert script - why isn't it working?  I am not
sure where the error is or how to correct it.  I am not getting an error
when I run the perl script (ie perl <file_name>  but no insert happens:

DBI 1.13-nothread dispatch trace level set to 2
    -> prepare for DBD::mysql::db (DBI::db=HASH(0x1ef918)~0x1ef900 'INSERT
INTO wwinfo

carea,cnumber,harea,hnumber,first_name,first_name,last_name,street_1,city,se
lect_state,state,zip,country,flags1,birth_date_mon,birth_date_day,birth_date
_year,Sex,Marital )  VALUES

123,1234123,123,1231234,email%40email.com,John,Dope,123+House,Placeville,Ala
bama,AL,12345,United+States,1,01,19,1981,0,S )')
Setting mysql_use_result to 0
    <- prepare= DBI::st=HASH(0x15a870) at ww.cgi line 110.
    -> execute for DBD::mysql::st (DBI::st=HASH(0x15a870)~0x1f69cc '123'
'1234123' '123' '1231234' 'email@email.com' 'John' 'Dope' '123 House'
'Placeville' 'Alabama' 'AL' '12345' 'United States' '1' '01' '19' '1981' 0
'S')
    -> DESTROY for DBD::mysql::st (DBI::st=HASH(0x1f69cc)~INNER)
    <- DESTROY= undef at unknown location!
    -> DESTROY for DBD::mysql::db (DBI::db=HASH(0x1ef900)~INNER)
    IMPLICIT ROLLBACK ON DESTROY of database handle that is still connected!
Rollback ineffective while AutoCommit is on error 15 recorded: Rollback
ineffective while AutoCommit is on
imp_dbh->svsock: 1f9220
    <- DESTROY= undef at unknown location!
    -> DBI::END
    -> disconnect_all for DBD::mysql::dr (DBI::dr=HASH(0x17c420)~0x1ef8d0)
    <- disconnect_all= '' at DBI.pm line 424.
    <- DBI::END complete
    -> DESTROY in DBD::_::common for DBD::mysql::dr
(DBI::dr=HASH(0x1ef8d0)~INNER)
    <- DESTROY= undef during global destruction.

Any help?

Thanks,

V




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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V10 Issue 339
**************************************


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