[7675] in Perl-Users-Digest
Perl-Users Digest, Issue: 1301 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 11 11:15:04 1997
Date: Tue, 11 Nov 97 08:00:37 -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 Tue, 11 Nov 1997 Volume: 8 Number: 1301
Today's topics:
Re: @ARGV Limits or Attempts to avoid "glob: Too many a (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Re: Alternatives to CGI.pm (was Re: Continuations in pe (Rahul Dhesi)
Re: Alternatives to CGI.pm (was Re: Continuations in pe (Pete Barker)
Books FS:Netware,Mac,Unix,Internet... (Sax Therapy)
Re: can set default path? (Eric Bohlman)
Re: can set default path? (Eric Bohlman)
Re: Distribution of perl for windows platforms (Pete Barker)
find2perl script <barnett@houston.Geco-Prakla.slb.com>
Re: Foo - Bar <rootbeer@teleport.com>
Help Perl Banner not working... <nathan@cyberservices.com>
Help: Writing PerlMagick to STDOUT <Alan_Poindexter@bmc.com>
Re: how do i append todays date to the end of a filenam <rootbeer@teleport.com>
installing CGI.pm <bryan@simlab.net>
Re: multithreading (Malcolm Beattie)
Re: odd difference between C and Perl (Michael J. Fromberger)
Re: Passing Variables (Pete Barker)
problem in dumping the records from the DBM file navin.rao@Nextel.com
Re: Problem with read <mak@mark.dircon.net>
Q: seek and return value (Srdan Simunovic)
Re: sendmail? (Faust Gertz)
Re: sendmail? <rootbeer@teleport.com>
Re: Tuning Perl 5.004_03 (Casper H.S. Dik - Network Security Engineer)
VERY STRANGE: Simple perl script to display a PDF docum nkaiser@reisys.com
Re: VERY STRANGE: Simple perl script to display a PDF d (Honza Pazdziora)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 11 Nov 97 10:28:55 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: @ARGV Limits or Attempts to avoid "glob: Too many arguments" message
Message-Id: <34687a32$3$ofn$mr2ice@speaker>
In <01bcee8e$0fae9e40$26c0a4c1@kitkat.aethos.co.uk>, on 11/11/97 at 10:38 AM,
"James Richardson" <jamesr@aethos.co.uk> said:
+-----
| Hmm... well if you say so... certainly when writing Perl that has to run
| under SunOS4.1.3U1 and Solaris2.3/4/5, I ran into this problem when globs
| gave more than about 1000 files.......
+--->8
Older C shells have glob expansion count limits as well as length limits. I
don't know offhand what limits might apply to the ones Sun ships, mainly
because I avoid csh like the plague :-)
--
brandon s. allbery [Team OS/2][Linux] bsa@void.apk.net
cleveland, ohio mr/2 ice's "rfc guru" :-) KF8NH
"Never piss off a bard, for they are not at all subtle and your name scans to
`Greensleeves'." ---unknown, quoted by Janet D. Miles in alt.callahans
------------------------------
Date: 11 Nov 1997 12:16:41 GMT
From: c.c.eiftj@93.usenet.us.com (Rahul Dhesi)
Subject: Re: Alternatives to CGI.pm (was Re: Continuations in perl?)
Message-Id: <649ib9$3g3$1@samba.rahul.net>
The real choice is between server-is-stateless and server-is-stateful.
This choice determines the style of cgi programming.
In an environment where most clients will be anonymous, it could get
quite expensive to keep much state, never knowing when if ever a client
will send back a reply. If you send output to 100,000 clients, and
90,000 of them never respond, how long do you keep the state information
before timing it out?
Also, maintaining a very large number of active TCP/IP connections might
require the ability to keep TCP/IP connection information in pageable
memory. This sounds tricky.
--
Rahul Dhesi <dhesi@spams.r.us.com>
------------------------------
Date: 11 Nov 1997 15:37:26 GMT
From: on.maps.barker@cix.co.uk (Pete Barker)
Subject: Re: Alternatives to CGI.pm (was Re: Continuations in perl?)
Message-Id: <memo.19971111153603.82A@mt.cix.co.uk>
In article <6490sg$s1v$1@brokaw.wa.com>, ajh@rtk.com (Aaron Harsh)
wrote:
> I'm amazed at how little anyone else seems to notice this
problem (assum
> ing
> it's not just my imagination). Am I just missing some crucial
piece.
>
> Before I responsd to William's post I think I should mention
that I thin
> k
> CGI.pm is a good thing, I use it myself, and it's one of the few
pieces
> of
> software I use that I don't curse at. I think a better subject
for this
> thread might be 'Alternatives to traditional CGI programming'.
>
> Anyway, William had some good ideas that I think I should
respond to. F
> or
> reference, I'd like to present a little snippet of something
resembling
> perl
> code. I'm sorry it's large, but I think that's necessary to
make my poi
> nt.
> The snippet presumes the existence of a sub called 'show_form'
that yiel
> ds
> an HTML form to the HTTP server, causes the script to sleep
until anothe
> r
> request is made and returns in a hash reference any input the
user made
> on
> the form:
>
> my $customer_info;
> my @ordered_items; # Array of references to hashes that
describe items
> ordered
> my $database_handle = init_database_handle();
>
> for (;;) {
> show_form("intro.html");
> my $response;
> do {
> $response = get_next_product($database_handle,
\@ordered_items);
> } while ( $response->{-action} !~ /^(DONE|CANCEL)$/i );
>
> if ( $response->{-action} eq "DONE" ) {
> unless defined($customer_info) {
> $response = get_customer_info($database_handle);
> }
> unless defined($customer_info->{-credit_card_no}) {
> $response = get_credit_card_info($database_handle,
$customer_info)
> ;
> }
> add_order($database_handle, $customer_info,
\@ordered_items);
> }
> }
>
> sub get_next_product {
> my ( $database_handle, $orders_ref ) = @_;
> my $response = show_form("choose_product.html");
> return $response if $response->{-action} !~
/^(DONE|CANCEL)$/i;
>
> my $product_info = lookup_product($database_handle,
> $response->{-product_id});
> $response = show_form("choose_qty.html",
> -product_id => $product_info->{-product_id},
> -description => $product_info->{-description},
> -price => $product_info->{-price});
> push(@$orders, { $response->{-product_id},
$response->{-qty}})
> if ( $response ne "FORGET IT" );
> return $response;
> }
> sub get_customer_info { ... }
> sub get_credit_card_info { ... }
>
>
> The example is not particularly complex. I've noticed that CGI
applicat
> ions
> don't seem to get particularly tricky though (at least from an
end-user'
> s
> standpoint), so it might be a typical example.
>
> I agree the code is pretty ugly, but notice that:
>
> 1. The control flow is obvious. You can look at the code and
tell which
> HTML files are called, and in which order they're called (except
for the
> fact that some of it is hidden behind subroutines). In a
traditional CG
> I
> application, trying to examine the sequence of forms would
involve brows
> ing
> through the HTML files one at a time, building a mental linked
list of
> possiblities.
>
> 2. Subroutines split apart related sections of the code. In
particular
> the
> get_next_product routine actually groups together two forms
which are
> related. I'm sure you _could_ do this in a traditional CGI app
(just li
> ke
> you _could_ have an array of arrays in perl 4), but I doubt the
flow of
> the
> code would resemble the flow of the application.
>
> 3. Some of these routines could (and should) be in libraries.
In a
> traditional CGI app, each HTML page points to its successor, and
so isn'
> t
> really conducive to reuse. Of course, you _could_ stick the
code in a
> library, and pass the sub as a parameter the URL that the form
should po
> st
> to, but...
>
> I agree that this entire application could be stored in one CGI
script t
> hat
> passes its state along between forms. I imagine this script
would look
> like
> an ever-more-complicated state machine, I agree that someone
coulde mak
> e it
> work. But programming a state machine isn't nearly as
straightforward a
> s
> writing linear code.
>
> Imagine what the program would like if it was written as a
traditional C
> GI
> application. If someone has a reasonable implementation, I'd
love to se
> e
> it. Let's assume that we're using mod_perl and can keep the
database ha
> ndle
> around between invokations, although that technique won't scale
up to
> handles to cursors (for instance).
>
> Anyway, in response to William:
>
> William R. Ward wrote in message ...
> >"Aaron Harsh" <ajh@rtk.com> writes:
> >> But as an example of something that's just beyond the scope
of CGI.pm
> ,
> >> consider:
> >>
> >> - Keeping a database or statement handle between invocations
> >If it's just a matter of conveying a string (or something that
can be
> >mapped into one) from one page to the next, use a hidden field.
> >
> >> - Maintaining position in a file handle
> >You could save the position in a hidden field (it's just a
number) and
> >the seek it on the next page.
> >> - Preserving child processes (e.g., a pipe'd file handle)
> >That one would require a persistent server with some kind of
IPC.
> >> Plus there's the problem of a program losing its current
position, wh
> ich
> >> seems to be just as big an issue.
> >Hidden fields can eliminate this issue if used carefully.
>
> My response to all these is: Yes we can (and do) program like
this, but
> we
> could be a lot more productive if we could program in a linear
fashion.
>
> >> I know that mod_perl can help with some of this stuff, but
only in
> specific
> >> cases (I can't depend on the same httpd processing being
called each
> time).
> >You shouldn't expect mod_perl to give you anything more than
CGI does,
> >except with better performance.
>
> Agreed. I only mentioned this to cut off any replies about
mod_perl sav
> ing
> .
>
>
> >> Anyway, it sounds like the thing to do is to have a process
for each
> session
> >> running on the server side, and have CGI scripts which do
nothing but
> >> communicate with the persistent processes.
> >
> >I think you could probably do better than that by having a
single
> >daemon that all sessions connect to, using a session ID to tell
it
> >which session is which (and said session ID being carried along
from
> >page to page in hidden fields), that handles child processes or
> >network connections. The bulk of the processing can stay in
the CGI
> >script.
>
> If by 'better' you mean 'would cut down on overhead on the
server', I ag
> ree
> completely. The 'better' I'm looking for, though, is 'would
increase my
> productivity'.
>
> I would never write an application as a sequence of 7 files that
exec ea
> ch
> other based on user input, or that use a state-machine to
control a line
> ar
> sequence of actions, or that rebuild the contents of their
memory every
> iteration of a for loop -- it would be amazingly unproductive.
But this
> is
> exactly what I have to do when I program a CGI app.
>
>
> Anyway, enough of my whining. Is anyone actually interested in
a module
> for
> doing what I've been talking about? Does anyone have any
reasons why su
> ch a
> thing would have problems?
>
> Implementing a 'show_form' routine doesn't sound too tricky, but
is it
> enough? This seems like a nice weekend project unless I'm
missing somet
> hing
> big.
>
> I'm anxiously awaiting your responses
>
> Aaron Harsh
> ajh@rtk.com
>
>
>
I'm coming into this thread late, and as a relative newbie, but to
hold persistent stuff, maybe there should be a process which
starts when the server starts, and runs forever.
This could use some form of IPC to communicate with the script
that is called with the web page. You would need to use hidden
fields, but only to hold a session handle of some kind.
>From this session handle, you can access all the variables/state
required within the persistent process (which does the actual
tasks). You wouldn't be able to escape some form of state model
programming though :-(
Pete Barker
P.S. Please remove on.maps. to mail me.
------------------------------
Date: 11 Nov 1997 15:16:28 GMT
From: saxmania@ripco.com (Sax Therapy)
Subject: Books FS:Netware,Mac,Unix,Internet...
Message-Id: <649ssc$rle$1@gail.ripco.com>
Keywords: books,mac,unix,perl,cgi,unix,netware.programming
Computer Books For Sale
Title
Author / Publisher / Year / Pages / Price
Mastering OLE2-The Comprehensive Guide to Creating OLE-Supported 16-Bit
and 32-Bit Windows Programs
Bryan Waters Sybex inc. 1995 390pp with Disk $10.00
The WinG Bible:For Visual Basic 4 Programmers (Create Killer Games and
Stunning
Multimedia in Windows 95, Windows NT, and Windows 3.1x)
Natahan and Ori Gurewich Sybex 1995 800pp w/CD-ROM $12.00
OS/2 Warp Unleashed DeluxeEdition
Moskowitz, Kerr, Sams Pub. 3rd ed. 1995 1206pp with CD-ROM 15.00
Exploring Expect-A Tcl-based Toolkit for Automating Interactive Programs
Don Libes O'Reilly&Assoc. 1995 580pp 10.00
Netware Server Troubleshooting &Maintenance Handbook
Liebing & Neff McGraw Hill 1990 660pp 5.00
Novell's Guide to NetWare 4.0 NLM Programming
Day-Koontz-Marshall Sybex-Novell Press 1993 568pp 5.00
Novell NetWare 4 Utilities Reference
Novell Inc. 1994 516pp 5.00
Novell's Guide to Managing Small NetWare Networks (Indispensable to
NetWare Network Administratos Using DOS, Windows, OS/2, and Macintosh
Workstations) Covers Versions 2.2, 3.11, and 3.12
Kelley Lindberg Novell Press 1993 342pp $8.00
Novell's QuickPath to NetWare 4.1 Networks
Jeffrey Hughes and Blair Thomas Novell Press 1995 500pp
$8.00
Photoshop f/x
Cathy Abes Ventana Press 1994 344pp with CD-ROM 10.00
Adobe Premiere 4/Classroom in a Book
Adobe Press 1994 278pp CD included 15.00
Hypercard 2.2 in a Hurry
George Beekman Addison Wesley 1994 354pp 5.00
The Painter Wow! Book
Threinen-Pendarvis & Benson Peachpit 1996 212pp with CD-ROM 10.00
Photoshop 3.0 Knock Their Socks Off!
Peter Fink Ziff-Davis 1994 220pp 10.00
VISUAL QUICKSTART GUIDES from Peachpit Press
Illustrator 5.0/5.5 for Macintosh 244pp 1995 5.00
Painter 3.1 for Macintosh 204pp 1995 5.00
Director 4 for Macintosh 236pp 1995 5.00
Pagemill for Macintosh 1996 150pp 5.00
Quark Express Unleashed(Mac 3.3)
Brad Walword Random House 1994 492pp 10.00
Quark Express 3.2 By Example
Cynthia Williams M&T Books 1993 352pp 5.00
Macworld Freehand 4 Bible
Deke McClelland IDG Books 1994 702pp 6.00
Special Edition Using PageMaker 5 for the Mac
Rick Wallace Que Books 1993 1130pp 10.00
Live Wired:A Guide to Networking Macs
James Anders Hayden 1993 428pp with disk 5.00
Practical C Programming
Steve Oualline O'Reilly 1993 398pp 5.00
The Internet Business Book
J & M Ellsworth Wiley 1994 376pp 4.00
The Internet Unleashed
Sams.net 1995 1388pp 10.00
Foundations of WWW Programming with HTML & CGI
Tittel, Gaither, Hassinger, & Erwin IDG Books 1995 650pp w/CD-ROM
$12.00
Publish It On The Web {Mac Version}
Bryan Pfaffenberger AP Professional 1996 436pp with CD-ROM 10.00
60 Minute Guide to CGI Programming with Perl 5
Robert Farrell IDG Books 1996 272pp 7.00
HTML Publishing on the Internet for Macintosh
Heslop & Holzgang Vantana Press 1995 540pp with CD-ROM 12.00
Special Edition - Using Linux
Que publishing 1995 870pp with CD-ROM contains Linux 32-bit OS 15.00
The New Book of Linux-Definitive Guide fro Linux Users
edited by John Purcell Just Computers 1995 1198pp 18.00
Rescued by Unix
Augie Hansen Jamsa Press 1994 252pp 10.00
Programming for the Newton
McKeehan/Rhodes AP Professional 1994 400pp with Disk 8.00
The Waite Groups's UNIX System V Primer 2nd edition
Waite, Martin, Prata Sams Pub. 1992 566pp 8.00
SCO UNIX Operating System User's Guide 340pp 1992 5.00
Instant Delphi Programming
Dave Jewell Wrox Press 1995 450pp with Disk 10.00
Spinning The Web-A guide to serving information on the WWW
Yuval Fisher Springer 1996 538pp 10.00
Perl By Example
Ellie Quigley Prentice-Hall PTR 1995 360pp $10
Core Java (2nd edition)
Cornell & Horstmann Sunsoft Press 1997 768pp w/CD-ROM $12
Graphic Java - Mastering the AWT
Geary & McClellan Sunsoft Press 1997 600pp w/CD-ROM $12
Practical C Programming
Steve Oualline O'Reilly 1993 398pp 5.00
The Internet Business Book
J & M Ellsworth Wiley 1994 376pp 4.00
The Internet Unleashed
Sams.net 1995 1388pp 10.00
Teach Yourself More Web Publishing with HTML in a week
Laura Lemay Sams Pub. 1st edition 1995 452pp 4.00
shipping extra
--
______________________________________________________________________________
/~(_)~\ o/~~
II====== l =-} saul smaizys saxmania@ripco.com o/
\_(~)_/ web page=http://pages.ripco.com:8080/~saxmania (~)o/
vox 773/907/8229 data:fax 773/907/8521 \8/
______________________________________________________________________________
------------------------------
Date: Tue, 11 Nov 1997 14:52:31 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: can set default path?
Message-Id: <ebohlmanEJHLBJ.DG2@netcom.com>
Tsuyoshi Niwa (niwa@ultinet.net) wrote:
: I wonder if perl has any function that you can say
: this is the base (or default) path it's gonna use
: anytime it handles files. I'm looking for something like
: <Base Target="">thing in HTML
What you're calling the "base path" is more commonly known as the
"working directory," and Perl indeed has such a function: cwd(). Consult
your friendly neighborhood perlfunc(1) for more details.
------------------------------
Date: Tue, 11 Nov 1997 15:08:04 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: can set default path?
Message-Id: <ebohlmanEJHM1G.E3s@netcom.com>
Eric Bohlman (ebohlman@netcom.com) wrote:
: Tsuyoshi Niwa (niwa@ultinet.net) wrote:
: : I wonder if perl has any function that you can say
: : this is the base (or default) path it's gonna use
: : anytime it handles files. I'm looking for something like
: : <Base Target="">thing in HTML
: What you're calling the "base path" is more commonly known as the
: "working directory," and Perl indeed has such a function: cwd(). Consult
^^^
AARRGH!! Of course I meant "chdir" and I kept telling myself "no, the
function is *not* called cwd, it is called chdir" and needless to say, my
fingers didn't listen to my brain and I typed "cwd."
: your friendly neighborhood perlfunc(1) for more details.
------------------------------
Date: 11 Nov 1997 13:03:48 GMT
From: on.maps.barker@cix.co.uk (Pete Barker)
Subject: Re: Distribution of perl for windows platforms
Message-Id: <memo.19971111130231.65B@mt.cix.co.uk>
Aviel Rubin <rubin@quip.eecs.umich.edu> wrote:
: 2. Has anyone considered a self-extracting, self-installing
distribution
: of perl for windows, say perl.exe?
I downloaded the ActiveState distribution for Windows NT, and that
had a self-extracting Winzip type front end.
Pete Barker
P.S. Please remove on.maps. to mail me.
------------------------------
Date: Tue, 11 Nov 1997 09:22:10 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: find2perl script
Message-Id: <34687822.3A2A@houston.Geco-Prakla.slb.com>
I am working on a project to find files > 7 days old, and remove them.
For this, I am going to use the File::Find module.
The Camel book, 2nd ed., states that the find2perl will help create a
working script. It creates a script, but I've noticed a minor flaw, and
wanted to make sure whether it was just me.
I am on a Solaris 2.5 machine, running perl5.004_01. When I execute
find2perl . -mtime +7 -exec ls -al {} \; > filename, I get a script that
does indeed function, but doesn't function as expected. Here is the
results that appeared in filename:
#!/usr/local/bin/perl
eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
if $running_under_some_shell;
require "find.pl";
# Traverse desired filesystems
&find('.');
exit;
sub wanted {
(($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
(int(-M _) > 7) &&
&exec(0, 'ls','-al');
}
sub exec {
local($ok, @cmd) = @_;
foreach $word (@cmd) {
$word =~ s#{}#$name#g;
}
if ($ok) {
local($old) = select(STDOUT);
$| = 1;
print "@cmd";
select($old);
return 0 unless <STDIN> =~ /^y/;
}
chdir $cwd; # sigh
system @cmd;
chdir $dir;
return !$?;
}
__END__
When I run the script, I get an ls -al of the current directory,
followed by another one, followed by another one, ad nauseum.
If I edit the line "&exec(0, 'ls','-al')" to be "&xec(0,
'ls','-al','{}'), I get the results I expected. a.k.a., I get an ls -al
listing of only those files in current directory (and subs) that have
not been modified in over 7 days.
By running the above script with -w on the first line, and use
diagnostics turned on, I get a lot of possible typo errors (variables
used only once), but no other errors.
>From this, then, I must assume that there is something amiss in the
find2perl script. My question (finally) is: is find2perl part of the
standard distribution (same date/time stamp as /usr/local/bin/perl), or
is it an external script?
Thanks.
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: Tue, 11 Nov 1997 07:45:35 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Georg Edelmayer <ged@fortec.tuwien.ac.at>
Subject: Re: Foo - Bar
Message-Id: <Pine.GSO.3.96.971111074412.1225C-100000@usertest.teleport.com>
On Tue, 11 Nov 1997, Georg Edelmayer wrote:
> It could be any names, so why foo and bar?
http://www.wins.uva.nl/~mes/jargon/f/foo.html
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 11 Nov 1997 09:04:20 -0600
From: Nathan Stanford <nathan@cyberservices.com>
To: "Perl-Win32-Users@ActiveState.com" <Perl-Win32-Users@ActiveState.com>
Subject: Help Perl Banner not working...
Message-Id: <346873F4.42DFD210@cyberservices.com>
My HTML FILE
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=iso-8859-1">
<META NAME="Author" CONTENT="Nathan Stanford">
<META NAME="GENERATOR" CONTENT="Mozilla/4.03 [en] (Win95; I)
[Netscape]">
<TITLE>Testing</TITLE>
</HEAD>
<BODY>
<CENTER><B><FONT SIZE=+3>Testing</FONT></B></CENTER>
<img src="http://nathans/scripts/testing/banner.pl">
</BODY>
</HTML>
My Perl file
#############################################################################
# banner.pl
# by Nathan Stanford - The Perl N. u T.
# nathan_stanford@cabp.com
# nathan@cyberservices.com
#############################################################################
@files=
("c://webshare//scripts//testing//r1.gif","c://webshare//scripts//testing//r2.gif","c://webshare//scripts//testing//r3.gif");
print "Content-Type: multipart/x-mixed-replace;boundary=myboundary\n\n";
print "--myboundary\n";
foreach $file (@files)
{
print "Content-Type: image/gif\n\n";
open(LOGO,"$file");
print <LOGO>;
close(LOGO);
print "\n--myboundary\";
sleep(1);
}
------------------------------------------------------------------
Nathan Stanford nathan_stanford@cabp.com - Work
The Perl N. u T. nathan@cyberservices.com - Home
------------------------------
Date: Tue, 11 Nov 1997 09:31:08 -0600
From: "A. Poindexter" <Alan_Poindexter@bmc.com>
Subject: Help: Writing PerlMagick to STDOUT
Message-Id: <34687A3B.DD3A9D6C@bmc.com>
First, thanks to all those who've made PerlMagick what it is.
One question: the Write method takes a filename and writes to that file
(I tried using STDOUT as an argument, without quotes, and got a nice
little file named STDOUT
in my directory :-)
How can I make PerlMagick write to STDOUT?
Reason: I want to run my perl program with PerlMagick from an <img src>
and return the resulting image via stdout, and not have to write to
disk, reread it
back in and then send that to stdout.
I took a look at Magick.xs, but I couldn't see how to do this.
Please email (also) any help, and thanks in advance
ok to use above address or <a@nettown.com>
--
This E-Mail address is NOT-FORSALE or use for JUNK-EMail without the
EXPRESSED WRITTEN PERMISSION of the owner of the above E-Mail Address.
******************************WARNING*********************************
By US Code Title 47, Sec.227(a)(2)(B), a computer/modem/printer
meets the definition of a telephone fax machine. By Sec.227(b)
(1)(C), it is unlawful to send any unsolicited advertisement to
such equipment, punishable by action to recover actual monetary
loss, or $500, whichever is greater, for EACH violation.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: Tue, 11 Nov 1997 07:54:40 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Mitzi <Mitzi.Withrow@cwi.cablew.com>
Subject: Re: how do i append todays date to the end of a filename?
Message-Id: <Pine.GSO.3.96.971111075419.1225E-100000@usertest.teleport.com>
On Mon, 10 Nov 1997, Mitzi wrote:
> i cant seem to get the date into a string format, i am a very new perl
> programmer. thanks.
$date = localtime;
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Tue, 11 Nov 1997 10:36:13 -0600
From: Bryan Murtha <bryan@simlab.net>
Subject: installing CGI.pm
Message-Id: <34688977.11B387D9@simlab.net>
Hello,
I am trying to install the CGI-modules-2.75.tar.gz CGI library by
Licoln Stein. I was wondering if anyone could answer why my programs are
not compiling? I have unpacked the library in the same directory as Perl
5, and yet it still gives me an error whenever I try to compile my
program telling me that it can't find this library. I'm on a Sun 5.51
machine and I can't install it properly.
Thank you ,
Bryan Murtha
------------------------------
Date: 11 Nov 1997 13:29:03 GMT
From: mbeattie@sable.ox.ac.uk (Malcolm Beattie)
Subject: Re: multithreading
Message-Id: <649miv$t8h$1@news.ox.ac.uk>
In article <EJFx5v.2pr@bcstec.ca.boeing.com>,
Charles DeRykus <ced@bcstec.ca.boeing.com> wrote:
>In article <01bced60$074f1d80$18b186cf@cyberus.cyberus.ca>,
>Thane & Leslie Eisener <thaneles@removethis.cyberus.ca> wrote:
>>I have a script that gathers data from the network for me three times.
>>Currently these are performed in series. How can I make these three
>>function all at the same time?
>>
>
>perldoc -f fork or look for fork in "Learning Perl" by R.Schwartz
>and T.Christiansen.
>
>(Multithreading based on POSIX threads coming soon with 5.005
> Perl Release...)
It supports Win32 threads too.
--Malcolm
--
Malcolm Beattie <mbeattie@sable.ox.ac.uk>
Oxford University Computing Services
"I permitted that as a demonstration of futility" --Grey Roger
------------------------------
Date: 11 Nov 1997 13:36:29 GMT
From: sting@linguist.Dartmouth.EDU (Michael J. Fromberger)
Subject: Re: odd difference between C and Perl
Message-Id: <649n0t$5cb$1@dartvax.dartmouth.edu>
In <34682A19.3A74@mukh.asc.ox.ac.uk> John Davis <jd@mukh.asc.ox.ac.uk>
writes:
> [in translating an Islamic date]
>
> the C code
>
> x = (Hy * 0.970224) + 622.540000;
>
> produces 1948.836182 (x is declared as a float)
>
> whereas the Perl code
>
> $x = ($Hy * 0.970224) + 622.540000;
>
> produces 1948.836208
>
> The second of these is confirmed by my HPCalculator. which at 9
> decimal places gives 1948.836208000.
> I haven't yet discovered an input for which this makes a difference
> to the final result, but it may exist (you have to do further
> calculations with the fractional result, to calculate the month and
> day).
>
> But it would be interesting to know why the difference occurs.
It's my guess that you're seeing some kind of roundoff error in the C
computation. Perl does all internal computations using doubles,
unless you specifically request otherwise (by specifying 'use int',
for example).
Try declaring 'x' and 'Hy' as type 'double' in your C program, and see
what your results are.
Cheers,
-M
-- . -.. .. .- . ...- .- .-.. .. ... - -.-. --- -- .--. --- ... . .-.
Michael J. Fromberger
Software Engineer, Thayer School of Engineering
Dartmouth College, Hanover, New Hampshire, USA
Fromberger@Dartmouth.EDU / sting@linguist.dartmouth.edu
--. ..- .. - .- .-. .. ... - .-.. .. -. --. ..- .. ... - -- .--- ..-.
Baldanzi's Observation:
"We've had this conversation already; it's just the words were different."
------------------------------
Date: 11 Nov 1997 13:03:46 GMT
From: on.maps.barker@cix.co.uk (Pete Barker)
Subject: Re: Passing Variables
Message-Id: <memo.19971111130226.65A@mt.cix.co.uk>
Dale,
Yes it would make a big difference as when script A finishes the
environment variable is lost. Mark's suggestion about the hidden
field is the way to go (in my limited experience).
Pete Barker
P.S. Please remove on.maps. to mail me.
In article <uMiPC$l78GA.319@upnetnews03>,
myleslawrence@email.msn.com (Myles Lawrence) wrote:
> OK I'll try this but I'm not 'system'ing the second script. I'm
<form
> action=script.pl>. Would this make a difference.
> Myles
>
> Pete Barker wrote in message ...
> >In article <un5iAcM78GA.244@upnetnews03>,
> >myleslawrence@email.msn.com (Myles Lawrence) wrote:
> >
> >> I tried this under NT and nothing. Is there and equivalent to
> >the $ENV
> >> variables?
> >> myleslawrence@msn.com
> >> Mark Mielke wrote in message ...
> >> >Dale Chavez <dale@horizonint.com> writes:
> >> >
> >>
> >>
> >>
> >>
> >
> >With a little adjustment, Mark's scripts worked under NT for
me...
> >
> >Script A (a.pl)
> >---------------
> >$ENV{COMMAND} = "Be Happy!";
> >system "PERL b.pl";
> >
> >Script B (b.pl)
> >---------------
> >print $ENV{COMMAND},"\n";
> >
> >Under NT4, system "b.pl" would work assuming file associations
are
> >setup ok, but under NT 3.51, you need to prefix with PERL to
> >explicitly tell the command interpreter the program to run.
> >
> >Regards,
> >
> >Pete Barker
> >P.S. Please remove on.maps. to mail me.
> >
>
>
>
------------------------------
Date: Tue, 11 Nov 1997 07:22:08 -0600
From: navin.rao@Nextel.com
To: sampath.chakravarti@lhsus.com
Subject: problem in dumping the records from the DBM file
Message-Id: <879253266.18228@dejanews.com>
We are trying to dump the records from the DBM file.We are finding problem
in doing so.If the records in source text file called abcd.txt more than
23,the records are dumped incorrectly from the DBM file.The portion of the
source code to create the DBM file is as follows.
open (IN,"abcd.txt") || die "cannot open abcd.taxt :$!";
$DBMFILE = "abcd.dat";
dbmopen(%ABCDBM,$DBMFILE,0666) || die "cannot openDBM array files :$!";
$KEY = 0;
while (<IN>)
{
$LINE = $_;
chop($LINE);
@FIELDS = split(/\^/,$LINE);
$MAINFIELD = $FIELDS[$KEY];
$ABCDBM{$MAINFIELD} = $LINE;
}
The portion of the source code to dump from the DBM file is as follows.
use Fcntl;
use SDBM_File;
$DBMFILE = "abcd.dat";
tie(%ABCDBM,SDBM_File,$DBMFILE, O_RDWR|O_CREAT,0666);
open(OUTFILE,">$DBMFILE.out") || die "cannot open out file";
$KEYFIELD = "";
while (($KEYFIELD, $LINE) = each(%ABCDBM))
{
print OUTFILE "<$KEYFIELD><$LINE>\n";
}
untie %ABCDBM;
close (OUTFILE);
This works fine if the number of records in the abcd.txt file is less than
23 records.Is it because of buffer size or some variable we need to set to
increase the database size ?
Thanks
Navin Rao
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Tue, 11 Nov 1997 14:03:39 +0000
From: Mark Morgan <mak@mark.dircon.net>
Subject: Re: Problem with read
Message-Id: <346865BA.D9255567@mark.dircon.net>
COWBYS wrote:
> I am using the following code to read each line of a file, ($FILENAMES[2]),
> and write each line of output to a variable ($One_Line), which then gets
> appended to another variable ($Data2_Send), which will eventually contain all
> of the lines of the file I am reading In ($FILENAMES[2]). The reason I am
> doing this is because I need to email the contents of my input file
> ($FILENAMES[2]), to someone , but the contents of the message has to be the
> actual file, they cant receive it as an attachment.
>
> Anyway, my question is this:
>
> $Data2_Send ends up being a line by line copy of my input file ($FILENAMES2]),
> just like I wanted,
>
> EXCEPT that its missing the last 4 or so lines.
> It appears to either stop reading from my input file about 4 lines too soon, or
> it stops writing out to my output, is there some Perl limitation I am reaching
> here?, for the record, my input file is 400 lines long, and each line contains
> a record that is 105 chars (including spaces long).
>
> HERES MY CODE:
>
> $position=0; # set so 1st read is from
> beginning of first line
>
> open (READFROM, "$FILENAMES[2]") || die "cant open $FILENAMES[2]: $!\n";
> print "\nReading from $FILENAMES[2]"; # this is only here for sending output to
> my log file
> @records = <READFROM>;
> foreach $record (@records) {
> seek(READFROM,$position*105,0); # move to beginning of 1st line
> read(READFROM,$One_Line,105); # read the entire line into $One_Line
> $Data2_Send .=$One_Line; # append $One_Line to $Data2_Send
> $position++; # increment $position so
> next read is from beginning
> # of next line
>
> I tried using pack and unpack instead, with the same result... any advice?
> TIA .... DCF
Why not do the following:
open SENDMAIL, "|/usr/bin/sendmail destination@domain.com"; # the location for
sendmail on your system.
open INFILE, "input_file";
while (<INFILE>) {
print SENDMAIL $_;
}
The above will open a pipe to sendmail, and send all of the information in the
INFILE out to it...this is similar to doing:
sendmail destination@domain.com <input_file from the command prompt.
Hope this helps.
Mark.
------------------------------
Date: 11 Nov 1997 15:41:41 GMT
From: srdan@sadzac.MS.ORNL.GOV (Srdan Simunovic)
Subject: Q: seek and return value
Message-Id: <649ubl$3r2$1@stc06.ctd.ornl.gov>
Hi,
I am using perl mostly to write simple translators between different database
formats. I have a problem interpreting return value from seek command:
for($offst=0;;$offst+=$recln){
$k=seek FILEHANDLE, $offst, 0;
if($k==1){
read and do something;
}
else{
last;
}
}
seek should return 1 upon success, 0 otherwise.
I thought that seek should return 0 if $offst is larger than the size of the
file. However, it gives 1 until it reaches 2.14 Gb (checked with tell
command) which is the maximum file size for the system
(#define RLIM_INFINITY 0x7fffffff). The files that I read are
obviously smaller than that.
What would be a "perlish" way of checking if the seek was successful (i.e. in the
file)?
Thanks,
--
Srdan Simunovic
___________________________________________________________
Modeling and Simulation Group http://www-explorer.ornl.gov
Oak Ridge National Laboratory email: simunovics@ornl.gov
P.O. Box 2008, MS-6140 phone: 423-241-3863
Oak Ridge, TN 37831-6140 fax: 423-574-4839
------------------------------
Date: Tue, 11 Nov 1997 15:38:35 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: sendmail?
Message-Id: <346e7831.5912072@news.wwa.com>
On Tue, 11 Nov 1997 02:01:47 -0500, Tsuyoshi Niwa <niwa@ultinet.net>
wrote:
> Where can I learn how to write scripts using sendmail?
The usual sources. Pointers to them can be found in the FAQ
(http://language.perl.com/faq/).
> I have a trouble that only To: shows up in the header and
> the rest becomes a part of message.
Why not look at the Mail::Mailer module from a CPAN
(http://www.perl.com/CPAN) near you?
Here is some _untested_ code for using sendmail in a script.
:open (MAIL,"| /usr/lib/sendmail -oi -t") || die "$0 could not open pipe to sendmail: $!";
:print MAIL "To: faust\@wwa.com\n";
:print MAIL "From: niwa\@ultinet.net\n";
:print MAIL "Reply-to: niwa\@ultinet.net\n";
:print MAIL "Subject: Thanks for your help.\n";
:print MAIL "X-Spoiler: Rosebud is a sled.\n\n";
:print MAIL "Thanks for your help. You are the greatest!\n\nTsuyoshi Niwa\n";
:close (MAIL) || die "$0 can't close the pipe: $!/n";
Streben nach Wahrheit
Faust Gertz
Philosopher at Large
------------------------------
Date: Tue, 11 Nov 1997 07:48:52 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Tsuyoshi Niwa <niwa@ultinet.net>
Subject: Re: sendmail?
Message-Id: <Pine.GSO.3.96.971111074731.1225D-100000@usertest.teleport.com>
On Tue, 11 Nov 1997, Tsuyoshi Niwa wrote:
> Where can I learn how to write scripts using sendmail?
Besides its manpages and FAQ, there are a newsgroup and books about
sendmail. Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 11 Nov 1997 14:20:09 GMT
From: Casper.Dik@Holland.Sun.Com (Casper H.S. Dik - Network Security Engineer)
Subject: Re: Tuning Perl 5.004_03
Message-Id: <casper.879258230@uk-usenet.uk.sun.com>
[[ Reply by email or post, don't do both ]]
Simon <simon@fastfare.co.uk> writes:
>I would like to know how to tune the perl interpreter to be
>less memory hungry, as the memory taken up by the perl script
>after taking into account of the interpreter is 7 meg, this
>of course doubles when the script forks.
Big script.
>Initially when I tested the script, I could run 6 invocations
>before running into out of memory errors. (This is with
>64 Meg Ram (approx 40meg free) and 150 Meg Swap (free swap))
Looks like it takes 150/6 = 25 meg per invocation????
>1. Are shared libraries truly shared between all invocations ?
Yes, but if you link them statically to perl it's actually more
efficient (provided you use them)
>2. Is setting the sticky bit a red herring, or does it help ?
It has no effect in Solaris on executable files.
>3. vfork ... has solaris/perl have problems with this enabled ?
It shouldn't have, but the Sun C compiler requires the inclusion
of <unistd.h> and that files is not included by perl (that used
to be the case) so vfork() isn't used on Solaris by default.
(If the file is not included, perl dumps core after vfork)
Note that vfork() only gives you one thread of execution, it
seems that you want more.
>4. Perls internal memory manager ... should I disable it ????
Answer no when perl asks:
"Do you wish to use the malloc that comes with perl? [yes]"
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
------------------------------
Date: Tue, 11 Nov 1997 07:51:21 -0600
From: nkaiser@reisys.com
Subject: VERY STRANGE: Simple perl script to display a PDF document
Message-Id: <879255690.19978@dejanews.com>
Can someone please explain this one;
I have a simple program which display's a PDF document.
Here it is:
#!/usr/bin/perl
$|++;
&parseForm;
if ($FORM{'PDF'}){
print "Content-type: application/pdf\n\n";
open (P,"/vol1/htdocs_sec/program.pdf");
while (<P>) {
print "$_";
}
}
else {
print "Content-type: text/html\n\n";
print "<FORM METHOD=POST ACTION=/cgi-bin/sbir/read.cgi><INPUT TYPE=SUBMIT
NAME=PDF VALUE=PDF>\n\n";
}
So, all I do once they press the PDF button is open the pdf document and
display it. While this works with some browsers, on many it does not.
HOWEVER, if I comment out the "else" part and simply have the program
write out the PDF, it works fine!!
Can someone explain why this is happening to me?
Please email to nkaiser@reisys.com directly.
Thanks.
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Tue, 11 Nov 1997 14:10:05 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: VERY STRANGE: Simple perl script to display a PDF document
Message-Id: <adelton.879257405@aisa.fi.muni.cz>
nkaiser@reisys.com writes:
> Can someone please explain this one;
>
> I have a simple program which display's a PDF document.
> Here it is:
>
> #!/usr/bin/perl
> $|++;
> &parseForm;
> if ($FORM{'PDF'}){
> print "Content-type: application/pdf\n\n";
> open (P,"/vol1/htdocs_sec/program.pdf");
> while (<P>) {
> print "$_";
> }
> }
> else {
> print "Content-type: text/html\n\n";
> print "<FORM METHOD=POST ACTION=/cgi-bin/sbir/read.cgi><INPUT TYPE=SUBMIT
> NAME=PDF VALUE=PDF>\n\n";
> }
>
>
> So, all I do once they press the PDF button is open the pdf document and
> display it. While this works with some browsers, on many it does not.
> HOWEVER, if I comment out the "else" part and simply have the program
> write out the PDF, it works fine!!
First, the browser might not understand the application/pdf mime type.
Second, I might not be happy with html document not having correct
format (I'm talking about <HTML>, <BODY>, etc. ...).
Hope this helps,
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 1301
**************************************