[12577] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6177 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 30 12:07:22 1999

Date: Wed, 30 Jun 99 09:00:20 -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           Wed, 30 Jun 1999     Volume: 8 Number: 6177

Today's topics:
    Re: alphabetical sorting <mdz4c@node13.unix.Virginia.EDU>
    Re: alphabetical sorting <uri@sysarch.com>
    Re: Appending to pages using CGI scripts <swiftkid@bigfoot.com>
    Re: Appending to pages using CGI scripts <mike@crusaders.no>
        Can't compile PDL-2.002 <kness@gfai.de>
    Re: Extracting specific text from specific files in a l <leejk@cat.com>
    Re: Extracting specific text from specific files in a l (John Borwick)
        hash problem(?) <mid@voyager.net>
    Re: how do I open a % based on a $ ? <tchrist@mox.perl.com>
    Re: How to remove the x number of lines from top of a f <leejk@cat.com>
    Re: How to send attachments with email <tneohcb@pc.jaring.my>
        HTML posts <paul.mutyambizi@citicorp.quit.spam.com>
        inplace edit <kpmasse@cs.sandia.gov>
    Re: menu (Jerome O'Neil)
    Re: menu <jcreed@cyclone.jprc.com>
        Perl in Web Server <igberso@iglobal.es>
    Re: Perl or PNP...which is better? (Ben Coleman)
        Picture doesn't appear j_a_p@my-deja.com
    Re: Picture doesn't appear <cw@dwc.ch>
        Problem installing DBI::mysql... ammar_aganovic@my-deja.com
    Re: Problem installing DBI::mysql... <craig@mathworks.com>
        SMTP Error jdeuser@my-deja.com
        Spell Checker pyammine@my-deja.com
    Re: Starting asynchronous process from Perl <tchrist@mox.perl.com>
    Re: system() and exit status <garethr@cre.canon.co.uk>
    Re: troubling extra space when reading in a text file . (Tad McClellan)
    Re: Using WindowsNT and ActivePerl and Job Scheduling ( <c4jgurney@my-deja.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Wed, 30 Jun 1999 11:13:11 -0400
From: Matthew Zimmerman <mdz4c@node13.unix.Virginia.EDU>
Subject: Re: alphabetical sorting
Message-Id: <Pine.A41.4.05.9906301104580.19278-100000@node13.unix.Virginia.EDU>

Philip 'Yes, that's my address' Newton wrote:
> Matthew Zimmerman wrote:
> > 
> > sub alphabetically
> > {
> >   $tempa = $a;
> >   $tempb = $b;
> >   $tempa =~ tr/A-Z/a-z/;
> >   $tempb =~ tr/A-Z/a-z/;
> >   ($tempa cmp $tempb);
> > }
> 
> How about something that respects locales and works under 'use strict'?
> Such as sort { lc $a cmp lc $b } @array? (Saves a few bytes and some
> temporary variables into the bargain.)

That works... Thanks! I do have one question. When I did the sort using

#####
sub alphabetically 
{
  $a =~ tr/A-Z/a-z/;
  $b =~ tr/A-Z/a-z/;
  $a cmp $b;
}
#####

it converted all of the array elements to lowercase, which I didn't want
(and is why I used the temporary variables). Why did your method not do
this?

Thanks! 
Matt

--
Matthew Zimmerman            http://www.people.virginia.edu/~mdz4c
Interdisciplinary Biophysics Program        University of Virginia
------------------------------------------------------------------
"You got to be very careful if you don't know where you're going,
because you might not get there."                    -- Yogi Berra



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

Date: 30 Jun 1999 11:53:37 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: alphabetical sorting
Message-Id: <x7674565xa.fsf@home.sysarch.com>

>>>>> "MZ" == Matthew Zimmerman <mdz4c@node13.unix.Virginia.EDU> writes:

  >> >   $tempa = $a;
  >> >   $tempb = $b;
  >> >   $tempa =~ tr/A-Z/a-z/;
  >> >   $tempb =~ tr/A-Z/a-z/;
  >> >   ($tempa cmp $tempb);

  MZ> That works... Thanks! I do have one question. When I did the sort using

  MZ>   $a =~ tr/A-Z/a-z/;
  MZ>   $b =~ tr/A-Z/a-z/;
  MZ>   $a cmp $b;

  MZ> it converted all of the array elements to lowercase, which I didn't want
  MZ> (and is why I used the temporary variables). Why did your method not do
  MZ> this?

tr modifies the bound variable. if that is $a or $b then thay are
aliases to the actual sort elements so they get modified. this is for
performance reasons. it is documented that you should not modify $a/$b
in a sort sub. the lc version works since it doesn't modify its
argument, but creates a lower case version of its value.

uri


-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Wed, 30 Jun 1999 19:51:45 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: Appending to pages using CGI scripts
Message-Id: <7lee6r$5if11@news.cyber.net.pk>

> I'm trying to append text from a form to another web page using a PERL
> script. If I run the PERL script from UNIX, it does exactly what it's
> supposed to. However, when I click on the submit button on the form on
> my web page (run from NT) I get the error message:
>
> "The server encountered an internal error or misconfiguration and was
> unable to complete your request."
>
> I can fix this by removing "or die" statements from my PERL script but
> then the script doesn't do what it should. Any ideas???


Check permissions again and give the full path to the file you are trying
to write to.

--
Faisal Nasim (the Whiz Kid)
Web: http://wss.hypermart.net/
AOL: Whiz Swift  ICQ: 4265451
FAX: (815) 846-2877




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

Date: Wed, 30 Jun 1999 17:55:09 +0200
From: "Trond Michelsen" <mike@crusaders.no>
Subject: Re: Appending to pages using CGI scripts
Message-Id: <07re3.283$Gx.2321@news1.online.no>


<mfawley@praxis-cs.co.uk> wrote in message
news:7ld90b$fai$1@nnrp1.deja.com...
> I'm trying to append text from a form to another web page using a PERL
> script. If I run the PERL script from UNIX, it does exactly what it's
> supposed to. However, when I click on the submit button on the form on
> my web page (run from NT) I get the error message:
> "The server encountered an internal error or misconfiguration and was
> unable to complete your request."
> I can fix this by removing "or die" statements from my PERL script but
> then the script doesn't do what it should.

Well, this should indicate that whatever is to the left of "or die" fails.

 >Any ideas???

You should try to find out what is wrong with the statement on the left of
"or die" and fix it ;-)

If you're trying to open a file; are you SURE that the file is readable from
the webserver (normally user nobody)?

Or you could simply watch the error_log of the server
    tail -f /var/log/httpd/error_log    (the path could of course be
different on your system)
then submit the form and see what happens

It could also help to insert this "use CGI::Carp qw(fatalsToBrowser);"
pretty close to the top of your program

--
Trond Michelsen





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

Date: Wed, 30 Jun 1999 15:23:31 +0200
From: Karsten =?iso-8859-1?Q?Ne=DF?= <kness@gfai.de>
Subject: Can't compile PDL-2.002
Message-Id: <377A1A53.E6EBA753@gfai.de>

Hallo all,

I can not compile the PDL-modules. I'm using perl 5.005.02 on a
SPARC-Station with Solaris 2.7. Compiler is gcc 2.8.1. I get the
following Msg:

pdlcore.c: In function `pdl_mess':
pdlcore.c:355: `mess_sv' undeclared (first use in this function)
pdlcore.c:355: (Each undeclared identifier is reported only once
pdlcore.c:355: for each function it appears in.)
pdlcore.c:365: warning: unused variable `msg'
pdlcore.c:353: warning: `sv' might be used uninitialized in this
function
pdlcore.c: In function `pdl_barf':
pdlcore.c:441: `in_eval' undeclared (first use in this function)
pdlcore.c:442: `restartop' undeclared (first use in this function)
make[2]: *** [pdlcore.o] Error 1
make[2]: Leaving directory `/tools/PDL-1.9900/Basic/Core'
make[1]: *** [subdirs] Error 2
make[1]: Leaving directory `/tools/PDL-1.9900/Basic'
make: *** [subdirs] Error 2

Anyone, who know, what is wrong?

K. Ness
kness@gfai.de




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

Date: Wed, 30 Jun 1999 11:21:43 -0400
From: "Keith Lee" <leejk@cat.com>
Subject: Re: Extracting specific text from specific files in a list
Message-Id: <7ldclu$6ut$1@ns1.cat.com>

I'll answer my own post here. I new it was something simple. The ( in my
scalar variable $string was causing the pattern match to fail, because I
failed to \ it. Rookie mistake.

Keith Lee <leejk@cat.com> wrote in message news:7ld8go$5rp$1@ns1.cat.com...
> Yes, I have tried this and other different variations of this, but each
time
> I get an error back saying:
>
>  "Uncaught exception from user code: /^assembly(name="1322500.vdi/:
> unmatched () in regexp at ./vdimerge.cgi line 20, <FOO> chunk 1"
>
> I am new to writing pattern matches, and I have the feeling that this is a
> simple fix and when some of you point out what is wrong here, I am going
to
> feel pretty stupid. Anybody?
>
> $string = 'assembly (name="';
> open(FILE, ">newfile") or die "Can't write new file: $!";
> for my $file (@input) { #multiple filenames gathered from user input
>    if (-f "$vdi_dir/$file" && open(FOO, "$vdi_dir/$file")) {
>       while (<FOO>) {
>          print FILE <FOO> if /^$string$file/ ... eof;
>       }
>     close(FOO);
>    }
> }
> close FILE;
>
> Tom Phoenix <rootbeer@redcat.com> wrote in message
> news:Pine.GSO.4.02A.9906291602560.4425-100000@user2.teleport.com...
> > On Tue, 29 Jun 1999, Keith Lee wrote:
> >
> > > ### I need some kind of pattern matching here to start reading at a
> > > ### certain place in the file
> > >         print FILE <FOO>; #new file's filehandle
> >
> > Maybe you want something like this.
> >
> >     while (<FOO>) {
> > print FILE if /start_here/..eof;
> >     }
> >
> > Or maybe this.
> >
> >     my $printing;
> >     while (<FOO>) {
> > print FILE if $printing;
> > $printing ||= /start_after_here/;
> >     }
> >
> > Good luck!
> >
> > --
> > Tom Phoenix       Perl Training and Hacking       Esperanto
> > Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/
> >
>
>




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

Date: Wed, 30 Jun 1999 15:15:07 GMT
From: John.Borwick@sas.com (John Borwick)
Subject: Re: Extracting specific text from specific files in a list
Message-Id: <377e3366.183173830@newshost.unx.sas.com>

On Wed, 30 Jun 1999 10:10:42 -0400, "Keith Lee" <leejk@cat.com> wrote:

>Yes, I have tried this and other different variations of this, but each time
>I get an error:
> "Uncaught exception from user code: /^assembly(name="1322500.vdi/:
>unmatched () in regexp at ./vdimerge.cgi line 20, <FOO> chunk 1"

if you are looking for the string
 qq{assembly (name="file}
then you should escape your open paren, like so:
 $string = 'assembly \(name="';

perl, i believe, was clear in explaining where the problem was.

>I am new to writing pattern matches, and I have the feeling that this is a
>simple fix and when some of you point out what is wrong here, I am going to
>feel pretty stupid. Anybody?
>
>$string = 'assembly (name="';
>open(FILE, ">newfile") or die "Can't write new file: $!";
>for my $file (@input) { #multiple filenames gathered from user input
>   if (-f "$vdi_dir/$file" && open(FOO, "$vdi_dir/$file")) {
>      while (<FOO>) {
>         print FILE <FOO> if /^$string$file/ ... eof;
>      }
>    close(FOO);
>   }
>}
>close FILE;

_ 

John Borwick


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

Date: Wed, 30 Jun 1999 11:32:36 -0400
From: "rdl" <mid@voyager.net>
Subject: hash problem(?)
Message-Id: <7lddba$eci@newsops.execpc.com>

Hello,

So sorry, this post is longer than I intended :-(

I *think* this is a Perl question rather than a CGI or HTML question, maybe
not though...

I have a web page that lets users query a database.  If the user enters a
keyword that yields no results, that keyword get written into a DBM type
data file for an administrator to audit later.  The format of the hash is
$SOMEHASH{$some_missing_keyword}=$time_and_date_of_query.

The 'audit' script does a dbmopen(%SOMEHASH,"audit_file",0666) then
generates an HTML document with the data from the hash as a table.  The
@values from %SOMEHASH are supposed to be HTML "textfield"s, and the @keys
are plain text "prompts" to each textfield.

What I want to happen:  The administrator brings up the HTML doc, fills in
the table's textfields with the correct information.  On click of 'submit',
the script reads the main database into a hash, updates that hash with the
new $key,$value pairs and writes out updated hash to the main database file.

Here's where I'm running into problems:  When the sub{ } that updates the
main hash with the %SOMEHASH info, the $values in the %SOMEHASH are
undefined. Therefore when a user queries the main database with one of the
$keys that this script was supposed to add to the database, the query script
finds the $key but the $value is undefined.

The main loop of the script is like this:

foreach $keyword (keys(%MISSING)) {
    print "<tr>";
        print "<td>$keyword</td>";
        print "<td><input type='textfield' size=70 name=$keyword
value=$MISSING{$keyword}></td>";
    print "</tr>";
}

The hash update sub:

sub update_data {
    foreach $keyword(keys(%MISSING)) {
        $val=param(qw($keyword));
        if(defined($val)) {
            $MAIN_DATABASE{$keyword}=$val;
        }
    }
}


I'd love to research the answer on my own, but can't figure out what FAQ
topic(s) to research.

Any hints would be appreciated.

Thanks

Bob






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

Date: 30 Jun 1999 09:58:16 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: how do I open a % based on a $ ?
Message-Id: <377a3e98@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, "Matt A" <mda@unb.ca> writes:
:I am trying to open a hash based on the name of a variable.

"open a hash"?  

In any event, you're going about this wrong.  This is a FAQ.
It's asked nearly daily.  The answer is on your system.
How did you miss it? :-(

% man perlfaq7

[VERBA DELETA]

  How can I use a variable as a variable name?

    Beginners often think they want to have a variable contain the
    name of a variable.

        $fred    = 23;
        $varname = "fred";
        ++$$varname;         # $fred now 24

    This works *sometimes*, but it is a very bad idea for two
    reasons.

    The first reason is that they *only work on global variables*.
    That means above that if $fred is a lexical variable created
    with my(), that the code won't work at all: you'll accidentally
    access the global and skip right over the private lexical
    altogether. Global variables are bad because they can easily
    collide accidentally and in general make for non-scalable and
    confusing code.

    Symbolic references are forbidden under the `use strict' pragma.
    They are not true references and consequently are not reference
    counted or garbage collected.

    The other reason why using a variable to hold the name of
    another variable a bad idea is that the question often stems
    from a lack of understanding of Perl data structures,
    particularly hashes. By using symbolic references, you are just
    using the package's symbol-table hash (like `%main::') instead
    of a user-defined hash. The solution is to use your own hash or
    a real reference instead.

        $fred    = 23;
        $varname = "fred";
        $USER_VARS{$varname}++;  # not $$varname++

    There we're using the %USER_VARS hash instead of symbolic
    references. Sometimes this comes up in reading strings from the
    user with variable references and wanting to expand them to the
    values of your perl program's variables. This is also a bad idea
    because it conflates the program-addressable namespace and the
    user-addressable one. Instead of reading a string and expanding
    it to the actual contents of your program's own variables:

        $str = 'this has a $fred and $barney in it';
        $str =~ s/(\$\w+)/$1/eeg;             # need double eval

    Instead, it would be better to keep a hash around like
    %USER_VARS and have variable references actually refer to
    entries in that hash:

        $str =~ s/\$(\w+)/$USER_VARS{$1}/g;   # no /e here at all

    That's faster, cleaner, and safer than the previous approach. Of
    course, you don't need to use a dollar sign. You could use your
    own scheme to make it less confusing, like bracketed percent
    symbols, etc.

        $str = 'this has a %fred% and %barney% in it';
        $str =~ s/%(\w+)%/$USER_VARS{$1}/g;   # no /e here at all

    Another reason that folks sometimes think they want a variable
    to contain the name of a variable is because they don't know how
    to build proper data structures using hashes. For example, let's
    say they wanted two hashes in their program: %fred and %barney,
    and to use another scalar variable to refer to those by name.

        $name = "fred";
        $$name{WIFE} = "wilma";     # set %fred

        $name = "barney";           
        $$name{WIFE} = "betty";     # set %barney

    This is still a symbolic reference, and is still saddled with
    the problems enumerated above. It would be far better to write:

        $folks{"fred"}{WIFE}   = "wilma";
        $folks{"barney"}{WIFE} = "betty";

    And just use a multilevel hash to start with.

    The only times that you absolutely *must* use symbolic
    references are when you really must refer to the symbol table.
    This may be because it's something that can't take a real
    reference to, such as a format name. Doing so may also be
    important for method calls, since these always go through the
    symbol table for resolution.

    In those cases, you would turn off `strict 'refs'' temporarily
    so you can play around with the symbol table. For example:

        @colors = qw(red blue green yellow orange purple violet);
        for my $name (@colors) {
            no strict 'refs';  # renege for the block
            *$name = sub { "<FONT COLOR='$name'>@_</FONT>" };
        } 

    All those functions (red(), blue(), green(), etc.) appear to be
    separate, but the real code in the closure actually was compiled
    only once.

    So, sometimes you might want to use symbolic references to
    directly manipulate the symbol table. This doesn't matter for
    formats, handles, and subroutines, because they are always
    global -- you can't use my() on them. But for scalars, arrays,
    and hashes -- and usually for subroutines -- you probably want
    to use hard references only.

[ET ALIA VERBA DELETA]
-- 
"355/113 -- Not the famous irrational number PI, but an incredible
simulation!"


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

Date: Wed, 30 Jun 1999 10:57:32 -0400
From: "Keith Lee" <leejk@cat.com>
Subject: Re: How to remove the x number of lines from top of a file
Message-Id: <7ldb8k$6iv$1@ns1.cat.com>

Look at the Perl FAQ #5. It gives you a basic concept.


Dariush_news <dazimi@yahoo.com> wrote in message
news:7ld75q$1lm$1@clio.net.metrotor.on.ca...
> Hi there;
>
> How can I remove the x number of lines from top of a file.?
>
> Can you suggest anything?
>
> Thank you.
> Please forward ans to
> Dariush_Azimi@mta1.metrodesk.metrotor.on.ca
>
>




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

Date: Wed, 30 Jun 1999 22:59:04 +0800
From: Simon Tneoh Chee-Boon <tneohcb@pc.jaring.my>
To: Thomas Dunbar <tdunbar@vt.edu>
Subject: Re: How to send attachments with email
Message-Id: <377A30B8.2D31@pc.jaring.my>

Hello,
   Maybe you like to try a module that is written by me,
SendMail.pm. I just sent invitation emails for people to
test it, it's still a beta version. With SendMail.pm and
other two modules, you can send attachments through a CGI
script. I have tested it on unix (apache) and NT (IIS)
web servers with the same script without any modifications,
it works on both platform. And I can receive and open the
attachments without any problem in Netscape Mail reader,
eudora and Hotmail. You can try it at
http://www.tneoh.zoneit.com/perl/SendMail/2.0/
  Hope this helps.

Regards,
Simon.

Thomas Dunbar wrote:
> How can i include attachments in email messages
> generated via either piping directly to sendmail or
> via Mail::Mailer or something similar
> thanks,
>        thomas

--
Simon Tneoh Chee-Boon
Application Developer	Hitechniaga Sdn. Bhd.
tneohcb@pc.jaring.my	60-3-9660966
http://www.tneoh.zoneit.com/simon/


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

Date: Wed, 30 Jun 1999 15:42:37 +0100
From: Paul Mutyambizi <paul.mutyambizi@citicorp.quit.spam.com>
Subject: HTML posts
Message-Id: <377A2CDB.C4F8D424@citicorp.quit.spam.com>

All, and Tom,

Apologies for the previously posted HTML formatted items.

--
*************************************
Opinions expressed are solely my own!
To reply to me, remove 'quit.spam'
from the e-mail address shown above.
*************************************




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

Date: Wed, 30 Jun 1999 08:57:05 -0600
From: Kenneth Massey <kpmasse@cs.sandia.gov>
Subject: inplace edit
Message-Id: <377A3041.A8E0B85@cs.sandia.gov>

I read briefly somewhere that there is an inplace edit $^I
that is ideal for an application like replacing one line in a long
mailing list file.  However, I can't find any detailed documentation on
how to use this feature.  Thanks,

Kenneth


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

Date: 30 Jun 1999 15:19:41 GMT
From: jeromeo@atrieva.com (Jerome O'Neil)
Subject: Re: menu
Message-Id: <7ldcid$o42$1@brokaw.wa.com>

In article <slrn7nir18.1gv.abigail@alexandra.delanet.com>,
	abigail@delanet.com (Abigail) writes:
> User menu?  A perl user menu? 
> 
> What kind of a restaurant would serve that?

Umm... An oyster bar?

<DOH!>

-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


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

Date: 30 Jun 1999 11:50:38 -0400
From: Jason Reed <jcreed@cyclone.jprc.com>
Subject: Re: menu
Message-Id: <a1vhc5elgx.fsf@cyclone.jprc.com>

jeromeo@atrieva.com (Jerome O'Neil) writes:

> In article <slrn7nir18.1gv.abigail@alexandra.delanet.com>,
> 	abigail@delanet.com (Abigail) writes:
> > User menu?  A perl user menu? 
> > What kind of a restaurant would serve that?
> Umm... An oyster bar?
Not a pearl menu, is it? A perl -user- menu.

"I'd like a '99 script kiddie, well done*, hold the clue."
"An excellent vintage, sir."

---Jason

* they're certainly not rare.
  


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

Date: Wed, 30 Jun 1999 17:59:46 +0100
From: Ignacio Bernabeu <igberso@iglobal.es>
Subject: Perl in Web Server
Message-Id: <377A4D02.43D3B72D@iglobal.es>

Hi everybody in the group!!!

I have a little problem, I had made a CGI that needs some modules and
last version of Perl.

I use Netscape FastTrack Server that installs its Perl compiler, any
suggestions of how to update?
If I install the new version, the Web Server goes on executing its own
preinstalled version of Perl.

Any suggestions will be strongly appreciated.
Thanks in advance



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

Date: Wed, 30 Jun 1999 15:11:32 GMT
From: tnguru@termnetinc.com (Ben Coleman)
Subject: Re: Perl or PNP...which is better?
Message-Id: <377a333d.738657192@news.mindspring.com>

On Tue, 29 Jun 1999 12:20:03 -0400, tadmc@metronet.com (Tad McClellan)
wrote:

>   What is PNP?

PNP is a type of transistor(anyone remember discrete components?).  Which
makes the question on the subject line an "apple and walnut" comparison.

Ben
-- 
Ben Coleman
Senior Systems Analyst
TermNet Merchant Services, Inc.
Atlanta, GA


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

Date: Wed, 30 Jun 1999 14:45:24 GMT
From: j_a_p@my-deja.com
Subject: Picture doesn't appear
Message-Id: <7ldai0$g1i$1@nnrp1.deja.com>

I am trying to show a picture from one of my perl scripts.

#!/usr/local/bin/perl

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

print "<IMG SRC=\"picture.gif\">";

however the picture doesn't show up.  Is there something special that
needs to be done in order to display a picture.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 30 Jun 1999 17:32:29 +0200
From: Christoph Wernli <cw@dwc.ch>
Subject: Re: Picture doesn't appear
Message-Id: <377A388D.A5F50C65@dwc.ch>

j_a_p@my-deja.com wrote:
> 
> I am trying to show a picture from one of my perl scripts.
> 
> #!/usr/local/bin/perl
> 
> print "Content-type: text/html\n\n";
> 
> print "<IMG SRC=\"picture.gif\">";
> 
> however the picture doesn't show up.  Is there something special that
> needs to be done in order to display a picture.

Did you check your HTML ? Did you ask in comp.infosystems.www.authoring.* ?

-Christoph


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

Date: Wed, 30 Jun 1999 14:47:06 GMT
From: ammar_aganovic@my-deja.com
Subject: Problem installing DBI::mysql...
Message-Id: <7ldal6$g2j$1@nnrp1.deja.com>

I installed mysql.x.22.src in /usr/local/mysql and theh installed DBI-1.08
(think). I then call "use DBI" within my perl script, but when I try to
connect to DB I get the following error message:

install_driver(mysql) failed: Can't load
'/usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/mysql/mysql.so' for
module DBD::mysql: libmysqlclient.so.6: cannot open shared object file: No
such file or directory at /usr/lib/perl5/5.00503/i386-linux/DynaLoader.pm
line 169.

I guess I messed up something with paths when installing mysql and DynaLoader
doesent seem to be able to find the files, but I have no idea what would be
the correct way to install it? I tried to copy libmysqlclien.so.6 in /usr/lib
dir but no effect. HELP! AA


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 30 Jun 1999 11:40:28 -0400
From: Craig Ciquera <craig@mathworks.com>
Subject: Re: Problem installing DBI::mysql...
Message-Id: <377A3A6C.B5ADB6BD@mathworks.com>

ammar_aganovic@my-deja.com wrote:

> install_driver(mysql) failed: Can't load
> '/usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/mysql/mysql.so' for
> module DBD::mysql: libmysqlclient.so.6: cannot open shared object file: No
> such file or directory at /usr/lib/perl5/5.00503/i386-linux/DynaLoader.pm
> line 169.
>

It seems that you are missing DBD::MySQL.

See CPAN.

Craig



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

Date: Wed, 30 Jun 1999 14:56:53 GMT
From: jdeuser@my-deja.com
Subject: SMTP Error
Message-Id: <7ldb7d$gb7$1@nnrp1.deja.com>

I have a web site that was recently moved from one NT server to
another. I have several Perl scripts that use an SMTP Server variable
which I have set to, ie. mail.????.com. On the old server this worked
perfectly, on the new server I get a "Mail Not Sent. SMTP Error"
message. Again, the Perl scripts worked fine on the old server and
nothing was changed except moving to a new NT server. I have contacted
my web host several times about this error and they do not have a clue.
Could this problem possibly be due to a missing Perl component? Any
ideas? Thanks.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 30 Jun 1999 15:39:37 GMT
From: pyammine@my-deja.com
Subject: Spell Checker
Message-Id: <7lddnn$hhc$1@nnrp1.deja.com>

Has anybody ever seen or worked with a spell checker with Perl.
Something that would spell check a users input before saving the data.

I appreciate the help.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 30 Jun 1999 09:52:53 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Starting asynchronous process from Perl
Message-Id: <377a3d55@cs.colorado.edu>

     [courtesy cc of this public news posting also privately 
      mailed to cited author]

In comp.lang.perl.misc, pweingart@worldnet.att.net writes:
:I've read about fork, and so far cannot see the usefulness of creating
:a copy of the existing process. It's another program I want to run,
:not the same one.  Clearly I'm missing something. Would you enlighten
:me concerning how this is usually used?

fork gives you a new execution context, identical to the existing one
in all respects save its "self" identifier and its "parent" identifier.
You are then free in the new process to diddle any of the process
related properties.  Some of the properties of a process are:

    * session and/or process group id

    * current proc's process id

    * parent's process id

    * address space for executing code pages

    * address space(s) for data and stack pages

    * register set: PC, SP, PSW (for trace info), etc;
      NB: one of these must differ in the child to know who's who.

    * master controlling process is this one is being traced

    * real user id

    * effective user id

    * real group id

    * effective group id

    * list of "secondary" groups

    * current working directory inode

    * chrooted directory inode

    * environment variables (technically, in data space)

    * current signal mask 

    * scheduling priority (user "nice" value, and internal system)

    * controlling tty

    * resource limits (filesize limits, execution time limits,
      memory limits, etc)

    * file creation mask

    * current set of open file descriptors (files, pipes, devices,
      sockets, etc) for active inodes (well, vnodes)

    * current seek pointers (I/O head) on each open file, when applicable

    * current file locks on each open file, when applicable

Some operating systems have more properties than this; a few have less.
There are separate system calls to manipulate each of those properties.

When you start a new execution context, you want a set of defaults from
which to take these properties.  That's half of why you have a parent.
The other half is so that you can have a related hierarchy of connected
contexts (think "jobs").  You really *do not* want to do all this by hand.
Just look at the work to build the first system process (init, pid==1,
traditionally found in locore.s in your kernel source tree) and you'll
see why you never want to do it without a blueprint.  It's a royal pain.

One system call that manipulates open file descriptors is close().

The system call that manipulates the current effective user id
is seteuid() in libc, or assignment to $> in Perl.

The system call the manipulates the process's scheduling priority
is called setpriority().

The system call the manipulates the process's current working directory
is called chdir().

The system call the manipulates the process's root inode 
is called chroot().

I could go on, but I'll cut to the chase.

The system call that manipulates the address space (code+data) property
is called exec() in Perl--and in libc, any of several flavors (most of
which are just wrappers), including execl(), execlp(), exect(), execv(),
execve(), and execvp().

That's why you seem have "two phases" to running another program.
You don't really, though; you really just have one: fork, which creates
a new execution context.  Everything else is a system call to manipulate
one of the process's properties.  exec() is merely one manipulator out
of a non-trivial number of the same.

If instead of these powerful primitives with user-level wrapper calls
like system() to group commonly used sets together, there had been
one inextricably atomic system call that handled both fork and exec in
tandem, this would have precluded manipulating all those cool properties
in the new execution context.  And don't even think about trying to tell
me that you could have passed them in as parameters.  I don't want a
function call with two dozen parameters, or even a pointer to a struct
that has two dozen fields.  Consider also what would happen to binary
and source compatibility once newer systems with properties the initial
creators never thought of show up.  Sheer madness!

#include <MANDATORY_microsoft_DENUNCIATION.rant>

--tom
-- 
 "Success covers a multitude of blunders."
	   -- Corporate motto of Microsoft
	      [Actually, it was George Bernard Shaw]


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

Date: Wed, 30 Jun 1999 14:53:25 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
To: Paul Mutyambizi <paul.mutyambizi@citicorp.com>
Subject: Re: system() and exit status
Message-Id: <silnd1wxi2.fsf@cre.canon.co.uk>

Paul Mutyambizi <paul.mutyambizi@citicorp.com> wrote:
> system ("valdate -f %m%d%Y $DOPT")  || die "blah, blah: $!"
> 
> when $DOPT does not conform to the valdate format specified above as
> described in ckdate(1) then the exit status should be 1 or fail
> (e.g. $DOPT = 06311999 should give $?==1) otherwise the exit status
> should be 0 or success (e.g. $DOPT = 06301999 should give $?==0).

You seem confused about the value in $?, which is *not* the exit value
of the last subprocess (though you can get the xit value from it).  See
the perlvar manpage:

     $?      The status returned by the last pipe close, backtick
             (``) command, or system() operator.  Note that this
             is the status word returned by the wait() system
             call (or else is made up to look like it).  Thus,
             the exit value of the subprocess is actually ($? >>
             8), and $? & 127 gives which signal, if any, the
             process died from, and $? & 128 reports whether
             there was a core dump.  (Mnemonic: similar to sh and
             ksh.)

Also, percent is shell metacharacter.  Use the list form of `system'
instead of the string form.

-- 
Gareth Rees


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

Date: Wed, 30 Jun 1999 05:52:25 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: troubling extra space when reading in a text file ...
Message-Id: <pcpcl7.cm.ln@magna.metronet.com>

Mark La Fleche (mark_lafleche@bc.sympatico.ca) wrote:

: I have a script that saves several lines of text from a form using a
: html input=textarea into a .txt file. When I read the .txt file back
: into an input=textarea box the original input has extra spaces (?) in
: it.

: For example:


: the data read back in from the text file into the textarea box looks
: like this:

: 1. test line one
:  2. test line two
:  3.
:  4. test line four


: P.S.  I've been reading stuff and working on this for a while.  I
: already eliminated a troubling extra line feed problem, but I'm at a
: loss for this one.  G.


   see if you are doing:

      print "@somearray";

   when you should be doing:

      print @somearray;


   If so, then look up the $" special variable in perlvar.pod.



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


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

Date: Wed, 30 Jun 1999 15:07:01 GMT
From: Jeremy Gurney <c4jgurney@my-deja.com>
Subject: Re: Using WindowsNT and ActivePerl and Job Scheduling (at command)
Message-Id: <7ldbqa$gjl$1@nnrp1.deja.com>

In article <37790163.CF7289F6@thegift.com>,
  Joe Devine <jdevine@thegift.com> wrote:

> 1. Has anyone tried to do this and if so, how?

I gave up with AT and swithced to a windows version of cron.

> 2. Is there anything obvious that I might be doing wrong?
> 3. Are there any PERL modules that might help with
>    reading remotely mapped drives?

Simply change your mapped drive letters to the full unc path
//servername/dirname/etc

However if you're trying to run this as a service then you may well hit
a few other snags.

Jeremy Gurney
SAS Programmer  |  Proteus Molecular Design Ltd.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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