[10803] in Perl-Users-Digest
Perl-Users Digest, Issue: 4404 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 11 12:07:45 1998
Date: Fri, 11 Dec 98 09:00:19 -0800
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, 11 Dec 1998 Volume: 8 Number: 4404
Today's topics:
"printing" images to a web page <qcoldiro@unlinfo.unl.edu>
$var->$method vs $var->$method() <goldstrn@mail.zserv.tuwien.ac.at>
Re: Accessing MS SQL db from unix (Victor B Wagner)
Re: Beginner Book? lvirden@cas.org
Re: blank line <niral@corporate.planet.net>
CGI to capture "multiple select" output mclapham1234@my-dejanews.com
Re: CGI to capture "multiple select" output <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: Decent Editor anthony_w@geocities.com
Re: How can I read a serial port in Perl (with NT4.0 se (Bbirthisel)
Re: how to make directory tree?? (Clay Irving)
Re: ip to name lookup (reverse name lookup) (Victor B Wagner)
Re: Is Tcl/Tk better than Perl ? lvirden@cas.org
Re: localtime () - perl's bug ? (Albert W. Dorrington)
Re: PC to Unix Problem (Victor B Wagner)
Re: Perl tip needed: High CPU Usage (Andrew M. Langmead)
Re: Send variables with <a href> (Larry Rosler)
Sending file attachments in email <ldc023@nabu.isg.mot.com>
Re: SSI in perl? (Victor B Wagner)
Tranact-SQL print <jtsaur@lehman.com>
Use Perl from C <Ben_CIP@csi.com>
Re: using the command system() in perl cgi (Victor B Wagner)
Re: Writing to filehandles and STDOUT <merlyn@stonehenge.com>
Re: Writing to filehandles and STDOUT (Tad McClellan)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 11 Dec 1998 10:27:57 -0600
From: quinn coldiron <qcoldiro@unlinfo.unl.edu>
Subject: "printing" images to a web page
Message-Id: <3671480D.20426731@unlinfo.unl.edu>
I'm using Perl (duh), Apache, MySQL on RedHat Linux 5.2
I want to store images in my MySQL database "print" them to my web
pages, but the only way I have figured out how to do this is to write
the image to a temp file (temp.gif) and the viewing it with the standard
<img src="temp.gif"> tag. this is not the solution I hoped for.
Does anybody have an idea, or a URL for a FAQ?
Quinn
------------------------------
Date: 11 Dec 1998 16:46:08 GMT
From: Martin GOLDSTERN <goldstrn@mail.zserv.tuwien.ac.at>
Subject: $var->$method vs $var->$method()
Message-Id: <74ri8g$90s$1@news.tuwien.ac.at>
I have a package Who.pm which provides subroutines
sub wer { ... } and sub new { ... }
Elsewhere I tried to use:
use Who; $obj = new Who;
$_= "wer";
/(.*)/ and print '$obj->$1: ', $obj->$1; # Syntax error!
/(.*)/ and print '$obj->$1(): ', $obj->$1(); # But this works.
($x) = /(.*)/ and print '$obj->$x: ', $obj->$x; # Syntax error!
($x) = /(.*)/ and print '$obj->$x(): ', $obj->$x(); # But this works.
print '$obj->wer: ', $obj->wer; # this works!!
print '$obj->wer(): ', $obj->wer(); # this too (of course)
Why doesn't perl allow the form without parentheses if the method is
given by a variable?
Martin.Goldstern@tuwien.ac.at
------------------------------
Date: 11 Dec 1998 14:02:02 GMT
From: vitus@brass.fe.msk.ru (Victor B Wagner)
Subject: Re: Accessing MS SQL db from unix
Message-Id: <74r8kq$jlu$3@zware.space.ru>
Jonathan Nicholson (jjn@sanger.ac.uk) wrote:
: Is there a perl module out there that will allow me to access a NT MS SQL
: database from UNIX.
DBD::Sybase?
: Regards,
: Jonathan
: ----------------------------------------------------------------------------
: = Jonathan Nicholson - System Administrator +44 1223 494987 (internal 4987) =
: = The Sanger Centre, Wellcome Trust Genome Campus, Hinxton, Cambs, CB10 1SA =
: = Email: jjn@sanger.ac.uk (Work) (finger jjn@byron.sanger.ac.uk for PGP Key) =
: ----------------------------------------------------------------------------
--
--------------------------------------------------
Victor Wagner vitus@ice.ru
Programmer Office:7-(095)-964-0380
Institute for Commerce Home: 7-(095)-135-46-61
Engineering http://www.ice.ru/~vitus
------------------------------
Date: 11 Dec 1998 01:45:50 GMT
From: lvirden@cas.org
Subject: Re: Beginner Book?
Message-Id: <74ptge$hnr$1@srv38s4u.cas.org>
According to Greg Ward <gward@cnri.reston.va.us>:
:> In article <3650788e.14819289@news.newsguy.com>,
:> jeff.kennedy@natdecsys.com (Jeff Kennedy) wrote:
:> > I need a book geared to an ABSOLUTE BEGINNER! No perl experience, no
:> > programming experience, no real shell scripting experience.
:
:Are you absolutely *sure* about this? I don't think Perl is a good
:choice for a first programming language; the syntax is occasionally
:hairy and the semantics delightfully subtle. And it builds a lot on
:existing programming languages (C, awk, and Bourne shell especially); if
:you don't know any other languages, many of Perl's most useful features
:will seem bizarre and inexplicable.
On the other hand, telling someone that before they can do what they want
(write programs in perl) they need to learn C, awk, and Bourne shell,
as well as learn how to program, seems a bit much, does it not?
It just seems a shame that perl keeps being pushed into a category of
'only really useful for someone with extension unix programming background'.
--
<URL: mailto:lvirden@cas.org> Quote: Saving the world before bedtime.
<*> O- <URL: http://www.purl.org/NET/lvirden/>
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
------------------------------
Date: Fri, 11 Dec 1998 11:16:39 -0500
From: Niral Trivedi <niral@corporate.planet.net>
To: Tri Tram <tram@olympic.seas.ucla.edu>
Subject: Re: blank line
Message-Id: <36714567.99B6CFB9@corporate.planet.net>
do following:
$_ =~ s/^\n$//;
--
Regards...
********************************************
Niral K. Trivedi, Planet Access Network Inc.
Email : niral@corporate.planet.net
Phone : 973-691-4704
------------------------------
Date: Fri, 11 Dec 1998 16:29:53 GMT
From: mclapham1234@my-dejanews.com
Subject: CGI to capture "multiple select" output
Message-Id: <74rh9s$r4e$1@nnrp1.dejanews.com>
Hi,
I have an HTML form : select name=color multiple size=5
and the values such as red,ble, yellow etc.
I want the cgi/perl program to capture the output
of the form.
I know if only one item was selected, I could use
$var=$Query->param('color') to capture this.
But if color has multiple values selected, how would
I capture all the values selected for this ?
Please email replies to mclapham@hotmail.com
Thanks.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 11 Dec 1998 17:46:15 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: CGI to capture "multiple select" output
Message-Id: <834sr2mxt4.fsf@vcpc.univie.ac.at>
Re: CGI to capture "multiple select" output,
mclapham1234 <mclapham1234@my-dejanews.com> said:
mclapham1234> I know if only one item was selected,
mclapham1234> I could use
mclapham1234> $var=$Query->param('color') to capture
mclapham1234> this.
mclapham1234> But if color has multiple values
mclapham1234> selected, how would I capture all the
mclapham1234> values selected for this ?
Method param() in CGI.pm returns an array for
multiple values.
FETCHING THE VALUE OR VALUES OF A SINGLE NAMED PARAMETER:
@values = $query->param('foo');
-or-
$value = $query->param('foo');
Pass the param() method a single argument to fetch the value
of the named parameter. If the parameter is multivalued
(e.g. from multiple selections in a scrolling list), you can
ask to receive an array. Otherwise the method will return a
single value.
e.g.
my @cols = param('color');
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: Fri, 11 Dec 1998 13:48:13 GMT
From: anthony_w@geocities.com
Subject: Re: Decent Editor
Message-Id: <74r7qs$i8d$1@nnrp1.dejanews.com>
In article <74oht0$lj9$1@callisto.clark.net>,
"T.E.Dickey" <dickey@shell.clark.net> wrote:
> Michael Rubenstein <miker3@ix.netcom.com> wrote:
> > On Wed, 9 Dec 1998 19:38:26 -0000, "Antony McNulty"
> > <tony_mc@hotmail.com> wrote:
>
> >>OK people calm down, let's not get worked up here....
> >>
> >>
> >>I'm on a Windows platform, have access to a UNIX platfom, but prefer to use
> >>Windows.
> >>
> >>I noticed many editors mentioned were UNIX, any ideas for the PC then ??
>
> > Emacs and vi have excellent Windows versions. My preference is GNU
> > emacs, but if you prefer vim is an excellent vi-like editor. Both GNU
> > emacs and vim provide either character mode or windowed editing.
> Likewise elvis and vile:
>
> ftp://ftp.cs.pdx.edu/pub/elvis/README.html
>
> The current version of vile is 8.2
> It's available at
> http://www.clark.net/pub/dickey/vile/vile.html
> ftp.clark.net/pub/dickey/vile
> id.wing.net/pub/pgf/vile
> ftp.phred.org/pub/vile
>
> > --
> > Michael M Rubenstein
>
> --
> Thomas E. Dickey
> dickey@clark.net
> http://www.clark.net/pub/dickey
>
I'd like to add that GNU Emacs is the best editor I've ever met (and I've
tried quite a few) and it has builtin support for Perl with Perl Mode, which
features syntax highlighting among other things, and you can add automatic
display of the current function name in the mode line, and seek to a named
function. You can also restrict editing to just a single function should you
so desire ...... It is just bursting with features that I like.
Anyway, the Win95/NT port is available at
http://www.cs.washington.edu/homes/voelker/ntemacs.html
The downfall is, that with so many features, it takes over 20Mb of disk space,
which is a lot more than many of the other editors available for windows.
Anthony
--
anthony_w@geocities.com
http://www.geocities.com/SiliconValley/Network/4311/index.html
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 11 Dec 1998 16:48:38 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: How can I read a serial port in Perl (with NT4.0 server)
Message-Id: <19981211114838.01083.00000839@ng-fq1.aol.com>
Hi Thierry:
>I'm trying to read a serial port on a PC running under NT4.0 server
>with the following script and it does not works very well.
Known problem. The solution is: "use Win32::SerialPort;"
Available on CPAN under authors/id/B/BB/BBIRTH
-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)
------------------------------
Date: 11 Dec 1998 09:18:23 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: how to make directory tree??
Message-Id: <74r9jf$2v2@panix.com>
>Clay Irving (clay@panix.com) wrote:
>: In <366f2350.0@nemo.idirect.com> "Gorbatchev Dmitri" <dimag@idirect.com> writes:
>: # skip files until directory found
>: $skip_entry = 1;
>: while ($skip_entry) {
>: $current_entry = readdir($dirh);
>: if (! defined ($current_entry)) {$skip_entry = 0} # End Of Dir
>: elsif ( ($current_entry ne '.') && ($current_entry ne '..') && (-d $tree
> There's something missing right around here somewhere? (syntax error)
Hmm? Let me try again...
#!/usr/local/bin/perl
##############################################################################
#
#
# Display a tree structure like the DOS tree command #
#
#
# Usage: perl tree.pl [source [depth]] #
#
#
##############################################################################
my $tree;
my $prefix;
my $maxlevel;
$tree = $ARGV[0];
$maxlevel = $ARGV[1];
if (! defined $tree) {$tree = '.'}
if ($tree =~ /\?/) {die ("Usage: perl tree.pl [source [depth]]\n")}
if ($maxlevel !~ /d*/) {die ("Usage: perl tree.pl [source [depth]]\n")}
if ($maxlevel == 0) {$maxlevel = -1}
$prefix = '';
disptree ($tree,$prefix,$maxlevel);
sub disptree {
my $tree;
my $maxlevel;
my $current_entry;
my $next_entry;
my $prefix ;
my $more_dirs;
my $dirh;
my $skip_entry;
$tree = $_[0];
$prefix = $_[1];
$maxlevel = $_[2];
if ($maxlevel == 0) {return}
$tree =~ s|/*$|/|; # keep exactly one /
# Read the target directory
$dirh = 'DIRH'.$maxlevel; # create a unique dir handle
(opendir ($dirh , $tree)) || (warn "Can't read $tree $!\n");
# skip files until directory found
$skip_entry = 1;
while ($skip_entry) {
$current_entry = readdir($dirh);
if (! defined ($current_entry)) {$skip_entry = 0} # End Of Dir
elsif ( ($current_entry ne '.') && ($current_entry ne '..') && (-d $tree.$current_entry)) {$skip_entry = 0;}
}
#
# --- Now check the rest of the entries for directories
#
if (defined $current_entry) { # did we hit EOD (EndOfDir) ?
$more_dirs = 1; # No, raise the 'more_dirs' flag
while ($more_dirs) {
# skip files until directory found
$skip_entry = 1;
while ($skip_entry) {
$next_entry = readdir ($dirh);
if (-d $tree.$next_entry) { $skip_entry = 0 } ;
}
# process the current dir
print ($prefix.'+ '.$current_entry."\n"); # print the current directory
if (defined $next_entry) { # is this the last dir ?
disptree ($tree.$current_entry , $prefix.'| ' , $maxlevel-1);
# no, prepend the 'history'
$current_entry = $next_entry;
} else {
disptree ($tree.$current_entry , $prefix.' ' , $maxlevel-1);
# yes. print this entry plainly
$more_dirs = 0;
}
}
}
closedir $dirh;
}
--
Clay Irving
clay@panix.com
------------------------------
Date: 11 Dec 1998 13:49:01 GMT
From: vitus@brass.fe.msk.ru (Victor B Wagner)
Subject: Re: ip to name lookup (reverse name lookup)
Message-Id: <74r7sd$jlu$1@zware.space.ru>
Al Degutis (adegutis@isi-info.com) wrote:
: Is it possible to do a reverse name lookup of an IP address using perl? I'd
: like to writing a firewall log analyzer and want to display the IP address
: and host.domain where available.
This have nothing to do with modules. gethostbyaddr is core perl
functionality.
man perlfunc or perldoc -f gethostbyaddr for more info
: Thanks
: Al
--
--------------------------------------------------
Victor Wagner vitus@ice.ru
Programmer Office:7-(095)-964-0380
Institute for Commerce Home: 7-(095)-135-46-61
Engineering http://www.ice.ru/~vitus
------------------------------
Date: 11 Dec 1998 01:55:00 GMT
From: lvirden@cas.org
Subject: Re: Is Tcl/Tk better than Perl ?
Message-Id: <74pu1k$rbs$1@srv38s4u.cas.org>
According to Eric Bohlman <ebohlman@netcom.com>:
:Note that both Tcl and Perl (as well as Python and possibly some other
:languages) support Tk, so its availability is not a deciding factor.
Not _possibly_ - definitely a number of other languages support Tk. Feel
free to stop by <URL: http://www.purl.org/NET/Tcl-FAQ/part4.html> and
<URL: http://www.purl.org/NET/Tcl-FAQ/part5.html> to see what is being done
with Tk. This software catalog covers more than just Tcl. In fact,
if someone is writing apps in Tk for any language, they can send along
the maintainer of those pages (me) info to have their applications added.
--
<URL: mailto:lvirden@cas.org> Quote: Saving the world before bedtime.
<*> O- <URL: http://www.purl.org/NET/lvirden/>
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
------------------------------
Date: 11 Dec 1998 11:06:33 -0500
From: awdorrin@mail.delcoelect.com (Albert W. Dorrington)
Subject: Re: localtime () - perl's bug ?
Message-Id: <74rfu9$itd@ws051eng.delcoelect.com>
In article <oee90gsp6kr.fsf@alpha.hut.fi>, Jarkko Hietaniemi <jhi@alpha.hut.fi> writes:
<snip>
:>
:> Why not pack the whole thing into bitfields? I count only
:> 6+6+5+5+4+7+9+1 = 43 bits needed (assuming here 7 bits for years since
:> 1970, which gives us 59 years past the Y2K38, I'm being generous here)
:>
Why not? Because if that was done, now you'd be complaining:
'Why did they pack the structure into bitfields? Its such a
pain to work with. If they would have put each number into
an int, it would be much easier...' :-)
- Al
--
Al Dorrington
FIRMS & Web Admin, Oracle DBA Phone: 765-451-9655
IC-DELCO CIM, Delphi Delco Electronics Systems Fax: 765-451-8230
------------------------------
Date: 11 Dec 1998 13:56:18 GMT
From: vitus@brass.fe.msk.ru (Victor B Wagner)
Subject: Re: PC to Unix Problem
Message-Id: <74r8a2$jlu$2@zware.space.ru>
oleynikl@geocities.com wrote:
: I've been learning Perl 5.0 for 2 days now. I'm trying to use Perl to solve a
: problem. Whenever I create an ascii file in a PC environment and upload it to
: a UNIX account, what I get is newline characters appearing everywhere. (ie: I
: get ^M in vi and <cr> in nedit).
: I wrote this short Perl program hoping to rid the newline characters, but it
: doesn't seem to work.
: #!/usr/bin/perl -w
: $^I = '.old'; # backup file
: while(<>) {
: s/^\s/ /g; # replace newlines,etc. with a single space
: print; # write to file
: }
First, you need to replace whitespace at the end of line, not on the
start of line. Second, it can be simplier to just replace ^M (\r in perl
notation everywhere.
perl -i.bak -p -e 's/\r//' *.cgi
does the job for all CGI files.
Other way around is to do this job on PC side. If you have DOS version
of perl use following
binmode STDOUT;
while (<>) {
print;
}
: Thank you for any suggestions.
: William
: -----------== Posted via Deja News, The Discussion Network ==----------
: http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
--
--------------------------------------------------
Victor Wagner vitus@ice.ru
Programmer Office:7-(095)-964-0380
Institute for Commerce Home: 7-(095)-135-46-61
Engineering http://www.ice.ru/~vitus
------------------------------
Date: Fri, 11 Dec 1998 15:29:39 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Perl tip needed: High CPU Usage
Message-Id: <F3t4DF.7sE@world.std.com>
lr@hpl.hp.com (Larry Rosler) writes:
>In article <74pegb$fgp$3@marina.cinenet.net> on 10 Dec 1998 21:29:47
>GMT, Craig Berry <cberry@cinenet.net> says...
>> wyndo@cxo.com wrote:
>...
>> : >> system calls, mainly to system("chmod 666 $filename");
>>
>> This is a double baddy. First, why not just juse Perl's built-in chmod()
>> function? Second, this version of the system call spawns a whole separate
>> shell for the command, eating time and other resources. See the doc on
>> system() for alternatives.
>Actually, this version of the system call *doesn't* spawn a whole
>separate shell for the command. See the doc on system():
Well spawning a shell to spawn chmod would be worse, but the basic
concept of using the system call chmod() instead of calling the
function system() to execute the program "chmod" is still appropriate.
I wanted to do something like this:
#!/usr/bin/perl -w
use Benchmark;
for $iterations ( 500, 1000, 1500 ) {
timethese($iterations, {
'shell' => 'system "chmod 666 /tmp/foo;"', #note the ";" metacharacter
'exec' => 'system "chmod 666 /tmp/foo"', #direct exec() by perl
'call' => 'chmod 0666, "/tmp/foo"' #system call.
});
}
But I could never get a value for $iterations that showed a decent
value for the perl function "chmod" but gave a value for the system()
ones that I'd be willing to wait for.
--
Andrew Langmead
------------------------------
Date: Fri, 11 Dec 1998 07:55:07 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Send variables with <a href>
Message-Id: <MPG.10dae03875575901989951@nntp.hpl.hp.com>
In article <367123F4.801928EB@cat.at> on Fri, 11 Dec 1998 14:53:56
+0100, Gernot Homma <gernot@cat.at> says...
> > petra_danielsson@my-dejanews.com wrote:
> >
> > print "<td width=\"12%\" align=\"center\" height=\"36\" ><strong><a href=
> > \"two.pl\"?$Refnr><b>$Refnr</b></a></strong></td>"
>
> You have to put a field=value pair in the href. So your code have to look like
> this
> print "<td width=12% align=center height=36 ><strong>
> <a href=two.pl?yourfield=$Refnr><b>$Refnr</b></a></strong></td>"
>
> You don't have to put the attributes of the <TD>-Tag parameters under "".
You *should* use quotes to conform to the HTML spec, and you *must*
use quotes if the values of the attributes contain spaces or some other
characters. The thing to do is to do it legibly.
In this case you could use unescaped single-quotes. But if you want to
use double-quotes within a double-quoted string, you should make things
legible by using the alternate quoting mechanism qq{}. That turns your
statement into (adding a termination):
print qq{<td width="12%" align="center" height="36" ><strong><a href=
"two.pl"?$Refnr><b>$Refnr</b></a></strong></td>};
Now it is easier to see that the query -- which is part of the URL that
is the value of 'href' -- is in fact after the terminating double-quote.
So the proper statement is:
print qq{<td width="12%" align="center" height="36" ><strong><a href=
"two.pl?$Refnr"><b>$Refnr</b></a></strong></td>};
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 11 Dec 1998 10:45:06 -0500
From: David Capredoni <ldc023@nabu.isg.mot.com>
Subject: Sending file attachments in email
Message-Id: <36713E02.FEA8552A@nabu.isg.mot.com>
Hi
I was just wondering if anyone knows how to send a word document
attachment in an email. I can send text document. However, when I try
to send a word document as an attachment, a zero size file is sent
through the mail. Below is a sample code if anyone has anyidea on what
I might be doing wrong.
Thanks
#!/usr/local/bin/perl
$updaterid="user\@email.com";
$boundary = "------------7B9B$$413F";
$filename="test.doc";
open(EMAIL,"|/usr/lib/sendmail -t") || die "unable to send mail: $!\n";
print EMAIL "To: $updaterid\n";
print EMAIL "cc: $updaterid\n";
print EMAIL "Error-To: $updaterid\n";
print EMAIL "Reply-To: $updaterid\n";
print EMAIL "Return-Path: $updaterid\n";
print EMAIL "From: Attachment mail\n";
print EMAIL "Subject: Test to send word document as attachment email\n";
print EMAIL "X-Mailer: " . $ENV{'SERVER_SOFTWARE'} . " via script '" .
${Prog} . "'\n";
print EMAIL "MIME-Version: 1.0\n";
print EMAIL "Content-Type: multipart/mixed; boundary=\"" . $boundary .
"\"\n";
print EMAIL "\n";
print EMAIL "This is a multi-part message in MIME format.\n";
print EMAIL "\n--$boundary\n";
print EMAIL "Content-Type: text/plain; charset=us-ascii\n";
print EMAIL "Content-Transfer-Encoding: 7bit\n";
print EMAIL "Content-Disposition: inline\n\n";
print EMAIL "Test to send word document as attachment email\n";
print EMAIL "\n";
print EMAIL "\n--$boundary\n";
print EMAIL "Content-Type: application/msword; type=us-ascii;
name=\"${filename}\"\n";
print EMAIL "Content-Transfer-Encoding: base64\n";
print EMAIL "Content-Disposition: attachment,
filename=\"${filename}\"\n\n";
while ($bytesread=read("/usr/tmp/ERN.doc", $buffer, 1024)) {
print EMAIL "$buffer";
}
close("/usr/tmp/ERN.doc");
close(EMAIL);
------------------------------
Date: 11 Dec 1998 14:37:10 GMT
From: vitus@brass.fe.msk.ru (Victor B Wagner)
Subject: Re: SSI in perl?
Message-Id: <74ramm$jlu$5@zware.space.ru>
News (dixonmat@pouch.com) wrote:
: I have a header sub routine that I want to add this SSI line tag.
: print "<!--#exec cgi="../banad/cgi/banner.cgi"-->\n";
: now I know it is not correct what should I do to make it work?
: please help.
If you are running this sub from Apache::Registry script, read
perldoc Apache::Include.
If it is just plain CGI, you probably should just do
open INCLUDE "../banad/cgi/banner.cgi|";
while (<INCLUDE>) {
print;
}
close INCLUDE;
instead of emitting SSI include. Note that in Apache 1.2 and prior
you CANNOT use more than one content hanlder on the same page, so
either cgi or ssi, but not both. In 1.3.x it is possible, but why?
If you are running Apache 1.3.x and really want stackable handler, ask
in Apache newsgroups, not here.
--
--------------------------------------------------
Victor Wagner vitus@ice.ru
Programmer Office:7-(095)-964-0380
Institute for Commerce Home: 7-(095)-135-46-61
Engineering http://www.ice.ru/~vitus
------------------------------
Date: Fri, 11 Dec 1998 11:24:41 -0500
From: Jiryih Tsaur <jtsaur@lehman.com>
Subject: Tranact-SQL print
Message-Id: <36714749.FAEDF535@lehman.com>
The print keyword displays a user-defined message or the contents of a
local variable on the user's screen. This is true when using isql
utility.
However, no messages will be printed if perl is used. Is there anyway
to have print messages shown when using perl?
Please respond to my email address. I appreciate it.
Jiryih Tsaur
MailTo:jtsaur@lehman.com
------------------------------
Date: Fri, 11 Dec 1998 16:48:22 +0100
From: "106617,1161" <Ben_CIP@csi.com>
Subject: Use Perl from C
Message-Id: <#SrNe2RJ#GA.330@nih2naac.prod2.compuserve.com>
Hi
I try to use Perl from within Visual C++ 6.0 on Windows NT. However, all the
examples I found (perlembed.htm, FAQ, ...) provide no sufficient
information. I suggest that some LIBs are missing from the distribution
(Activestate).
Has anyone sufficiently created a project like the one mentioned above?
Where can I find information on how to proceed?
Thanks in advance
axel.bender@cityweb.de
------------------------------
Date: 11 Dec 1998 14:15:04 GMT
From: vitus@brass.fe.msk.ru (Victor B Wagner)
Subject: Re: using the command system() in perl cgi
Message-Id: <74r9d8$jlu$4@zware.space.ru>
Liew Fook Sin (lfs97@tm.net.my) wrote:
: Hi,
: I am running a cgi script that is suppose to automate the process of
: decrypting a series
: of files in a particular directory.
: To decrypt the files use pgp commands. Since perl command system() allows
: other
: programs to be executed within the perl script, this approach was
: attempted.
: My problem is when I execute the Perl cgi script manually it works nicely.
: However, when I execute the same script via a URL in a HTML form, the
: script runs but command
: embed inside the system() command simply does not respond.
: Can anybody please tell me what is wrong, and how can this be solved.
: Thank you.
1. Are you sure that PATH of your CGI includes directory, where pgp
lives?
run the following cgi
#!/usr/local/bin/perl
print "Content-Type: text/plain\n\n";
print "PATH=$ENV{'PATH'}\n";
print "User name I'm running under =",scalar(getpwuid($>)),"\n";
and see what it prints,
Typically pgp is in /usr/local/bin and this is typically not included
in CGI PATH. So , you should either assing $ENV{'PATH'} in your script
$ENV{'PATH'}.=":/usr/local/bin";
or call pgp using full PATH name.
2. Have user under which CGI scripts are executed permissions to run PGP
Note that CGI - scripts typically runs as nobody or special user www.
3. How does pgp get passphrase? There are several ways to pass
passphrase without resort to interactive prompt, which is VERY hard to
handle
1. via commandline option (pretty unsecure, anybody can earsdrop using
ps command)
2. via environment variable (set ENV{'PGPPASS'} inside your script) -
insecure too, becouse it can be seen via /proc/\d+/environ
3 via file descriptor, passed via PGPPASSFD. - secure, but
complicated.
If you don't use them or mistyped password and pgp asks for it, it
would result in unrecoverable hang when running pgp. Don't expect that
it would ask your for passphrase via browser.
--------------------------------------------------
Victor Wagner vitus@ice.ru
Programmer Office:7-(095)-964-0380
Institute for Commerce Home: 7-(095)-135-46-61
Engineering http://www.ice.ru/~vitus
------------------------------
Date: Fri, 11 Dec 1998 14:58:24 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: Writing to filehandles and STDOUT
Message-Id: <8cogpawwsd.fsf@gadget.cscaper.com>
>>>>> "charlie66" == charlie66 <charlie66@my-dejanews.com> writes:
charlie66> 1. To open and write to the local file:
charlie66> $exclusive_lock = 2;
charlie66> $unlock = 8;
charlie66> open(NEWREV,">$loc_path$my_file.html") || print $!;
charlie66> flock (NEWREV, $exclusive_lock);
charlie66> print NEWREV <<End_of_Stuff;
charlie66> Bla bla bla
charlie66> ...
charlie66> End_of_Stuff
charlie66> 2. To close the local file:
charlie66> flock (NEWREV, $unlock);
charlie66> close (NEWREV);
Don't be unflocking. Modern versions of Perl catch this as a special
case, but merely to workaround a very common mis-use of unflocking.
Just leave the unflock out. close() will also automatically unflock
the file in the right sequence.
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Fri, 11 Dec 1998 10:25:31 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Writing to filehandles and STDOUT
Message-Id: <r1hr47.e66.ln@magna.metronet.com>
charlie66@my-dejanews.com wrote:
: 2. To close the local file:
: flock (NEWREV, $unlock);
Big mistake there.
Your "locked" file could get corrupted doing it that way.
You have a race condition.
See Perl FAQ, part 5:
"I still don't get locking. I just want to increment the
number in the file. How can I do this?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
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 4404
**************************************