[15988] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3400 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 17 09:05:27 2000

Date: Sat, 17 Jun 2000 06:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <961247111-v9-i3400@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 17 Jun 2000     Volume: 9 Number: 3400

Today's topics:
    Re: [Q] Perl implemented in Java? (Bart Lateur)
    Re: Bot for this group to auto-answer queries? <henry@penninkilampi.net>
    Re: Bot for this group to auto-answer queries? <flavell@mail.cern.ch>
    Re: Can you help me? <mike@gtnorthern.demon.co.uk>
        Collecting variables from HTML form <fromnews@pagepool.co.uk>
    Re: Collecting variables from HTML form <rootbeer@redcat.com>
    Re: Crazy enough that it might just work... <henry@penninkilampi.net>
    Re: Editor question <y-o-y@home.com>
    Re: flock, read, truncate, write to a file <rootbeer@redcat.com>
    Re: how do I "redirect" a substitution? (Bart Lateur)
        HTML form to variables in a perl program <fromnews@pagepool.co.uk>
    Re: I can't figure this one out...  (Newbie question) (Abigail)
    Re: I can't figure this one out...  (Newbie question) (Bart Lateur)
        Need help Spliting 1 vaiable in 2 <phuket@phuket-guide.com>
    Re: now this is strange... (Bart Lateur)
    Re: Passing a database handles to subs.... (Abigail)
    Re: perl generated html response problem <hedim@hta-bi.bfh.xxx>
    Re: print pdf tbb85@my-deja.com
        regexp: replace \t with tab, but not \\t <hedim@hta-bi.bfh.xxx>
        Spot the Syntax Error <grichards@flashcom.net>
    Re: Spot the Syntax Error <phill@modulus.com.au>
    Re: Ugh (Bart Lateur)
    Re: Ugh (jason)
        Variable variable names, was Re: now this is strange... <flavell@mail.cern.ch>
    Re: Very Strange Behaviour <ryanc@nci1.net>
        where libHTML documentation? drdubosc@my-deja.com
        Yet Another Abigail Admirer (WAS Re: Crazy enough that  (Gwyn Judd)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 17 Jun 2000 11:56:38 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: [Q] Perl implemented in Java?
Message-Id: <395365a5.14312795@news.skynet.be>

[posted on c.l.p.misc, cc to B.M. Kuhn]
Alun Moon wrote:

>Just what I need.
>
>Any news of its progress?

Here's a mail I got about this today. I'm forwarding it, with consent of
the original author.

	Bart.

-*- Forwarded message follows -*-

On Sat, 17 Jun 2000 00:06:05 -0400, "Bradley M. Kuhn" <bkuhn@ebb.org>
wrote:

[Randal and Bart, MJD forwarded me this message---I don't read USENET
 anymore.  Feel free to forward this there, though, if you think it'd be
 useful to the thread.]

I am indeed working on perljvm, a Perl to JVM compiler (see
http://www.ebb.org/perljvm).  It uses the B:: backend modules to
generate bytecode, and that bytecode uses a number of Java classes that
implement Perl's native data structures.

I haven't done a perljvm release in a while, and it is surely due.  I
have many changes locally that do need to be released.  I plan to do a
release in July right before TPC 4.0.

On CPAN, the module is non-intuitive if you don't know how it's
implemented---it's B::JVM::Jasmin.  The version there now is very basic.
I am adding array and hash support now, which I hope to have ready by
July.
By August or so, I hope to have most of Perl4-ish stuff supported.

B::JVM::Jasmin 0.01 was a prototype that BJEPSON wrote; 0.02 was the
only release I made on CPAN so far.


BTW, I am presenting a paper at TPC 4.0 on perljvm.  Also, there is
PerlCaffiene, which is a source-to-source translation effort.  There's a
paper about it at TPC 4.0 too---I am looking forward to learning more
about it myself.

> Larry wrote JPL (Java Perl Lingo) a year or two ago. 

JPL is very usable today if all you want to do is call Perl from Java
and Java from Perl on a Unix-like system.  There's a mailing list for
it, <jpl@perl.org>.

What I am working on will actually compile a Perl program to native JVM
bytecode, which would allow, for example, the program to run in an
embedded JVM.
 
> Mark Ethan Trostler is working on Java.pm... from the README:
>      Welcome to the Frightening World of Java/Perl interoperability!

This seems to be a way to talk to a running JVM via a network
connection.  A pretty cool approach, but it wouldn't actually allow
compilation, just mutual integration of Perl with Java (which is often
all you need).

> A Perl-to-JVM compiler has been frequently discussed, but not actually
> in progress, as far as I recall.

I am here, and I am working on it; but progress is slow.  I ran out of
cash and I had to get a day job.  :(

I have asked for a Perl/Java BoF at the TPC 4.0.  If you are there, and
are interested in Perl and Java integration, please stop by.

-- 
Bradley M. Kuhn  -  http://www.ebb.org/bkuhn



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

Date: Sat, 17 Jun 2000 20:49:36 +0930
From: Henry <henry@penninkilampi.net>
Subject: Re: Bot for this group to auto-answer queries?
Message-Id: <henry-ECDCEB.20493617062000@news.metropolis.net.au>

In article <8idube$995$1@srv38.cas.org>, lvirden@cas.org wrote:

>> They work on IRC, and they work with data mining.  Agents (call them 
>> bots, spiders, or whatever you want) are the easiest way to get the 
>> information you want.  People use them.
> 
> Can you point to some truly useful agents and bots?  I regret to
> say that in my limited experience on internet (about 60 hrs a week
> for 10-12 yrs) I don't recall encountering any of these - or if I
> did encounter one, it was so cleverly written that I mistook it
> for a human.

Google, AltaVista, NorthernLight, Sherlock, and thousands of IRC bots on 
channels all around the world...

34,000 hours on the Internet, and you've _never_ used a search engine???  
I find that hard to believe.


Anyway, Ilmari Karonen revealed (to my eyes, at least) the fundamental 
flaw with bots in another message in this thread.

Basically, if the bot actually _succeeds_ in its task of helping 
newbies, then laws of equilibrium mandate that _more_ newbies will flock 
to clpm in search of answers.

As someone else (more-or-less) said: "I don't want clpm turning into 
just a Help Desk."

So, there you have it.  If the bot fails, then it just causes 
miscellaneous colateral damage.  But if it succeeds, then it actually 
obliterates the social aspects of the group - which is what binds clpm 
together.  It's a lose-lose situation for the group.

Henry.


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

Date: Sat, 17 Jun 2000 13:34:35 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Bot for this group to auto-answer queries?
Message-Id: <Pine.GHP.4.21.0006171333520.21898-100000@hpplus03.cern.ch>

On Sat, 17 Jun 2000, Henry wrote:

> So, there you have it.  If the bot fails, then it just causes 
> miscellaneous colateral damage.  But if it succeeds, then it actually 
> obliterates the social aspects of the group - which is what binds clpm 
> together.  It's a lose-lose situation for the group.

I think that's a truly wise conclusion.  You have my respect.




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

Date: Sat, 17 Jun 2000 07:54:59 +0000
From: Mike Newman <mike@gtnorthern.demon.co.uk>
Subject: Re: Can you help me?
Message-Id: <Pine.LNX.4.21.0006170753310.6896-100000@gtnorthern.demon.co.uk>

On Sat, 17 Jun 2000, Wang Wei wrote:

>I can not send any mail because the destination always
>YOUR_ADDRESS_HERE@.. However, the book says it alow user to input the
>address I can not make it work.

Learning Perl, p21:

	"The mail will be sent to you if you type your own mail address
	where the code says 'YOUR_ADDRESS_HERE"

Mike

-- 
Sent by mike@gtnorthern.demon.co.uk
Uptime:  8:53am  up 1 day, 10 min,  2 users,  load average: 0.00, 0.06, 0.06



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

Date: Sat, 17 Jun 2000 08:47:45 +0100
From: "James" <fromnews@pagepool.co.uk>
Subject: Collecting variables from HTML form
Message-Id: <8ifafk$a94$1@gxsn.com>

Can someone please tell me the simplest way to get all the variables from an
HTML form?
Thanks

James
james@thoughtfortheday.org
http://www.thoughtfortheday.org - An inspirational and topical thought to
start your day.




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

Date: Sat, 17 Jun 2000 01:05:23 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Collecting variables from HTML form
Message-Id: <Pine.GSO.4.10.10006170104050.21108-100000@user2.teleport.com>

On Sat, 17 Jun 2000, James wrote:

> Can someone please tell me the simplest way to get all the variables
> from an HTML form?

Use the form's 'submit' button. :-)

Okay, I know what you _meant_. You want to read the docs for the CGI
module. Cheers!

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



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

Date: Sat, 17 Jun 2000 20:25:32 +0930
From: Henry <henry@penninkilampi.net>
Subject: Re: Crazy enough that it might just work...
Message-Id: <henry-DE3512.20253217062000@news.metropolis.net.au>

In article <8idphl$e9$1@news.NERO.NET>, stanley@skyking.OCE.ORST.EDU 
(John Stanley) wrote:

>>> Who is the "we" who is rejecting this post? 
>>
>> Execution via script.  Parameters determined by group consensus.
> 
> I'm sorry, I meant for you to think about what you were saying before
> whipping off another silly answer.

Are you _always_ such a facetious prick, or is this attitude something 
you've been saving up just for me?  What, did my viking ancestors raid 
your ancestor's little village at the turn of the last millenium, and 
this is payback for a blood feud?  Sheesh.


> Where is this "script",

It's stored on a hard drive, John, and because this is the Internet, 
John, it doesn't matter where it is, John.  Duh.


> and who runs it?

Have a wild guess - name rhymes with "CRON".


> How do we make sure that all articles posted go to that script
> and not to the group like they normally do?

YOU read the FAQs in news.groups.questions, and then _you_ ask a more 
intelligent question.


> Who mandates that they cannot be posted?

Read the original article, and my response to your previous post, 
_again_ - you're obviously having problems with sentences containing 
words with more than one syllable.


> Who prohibits other people from running a bot with a different set
> of rules? 

They can run all the bots they want, but since none of the posts route 
via unofficial bots, they will have no effect.  READ THE FAQs!


>> Please killfile me.  We'll both feel better.
> 
> Please stop posting nonsense. You are wasting resources around
> the world even if everyone killfiles you. But since you asked
> me to, I am now going to killfile you in the digest, like you
> asked.

You've _got_ to be kidding?

How can you _possibly_ be so stupid as to quote what I said, and then 
_add_a_bit_ and pretend that that is what I _actually_ said?

It defies words.



Look, John, if you didn't like the idea, then why not just say so, maybe 
state a couple of reasons, and then ignore the rest of the thread?

But noooo, you immediately accuse me of being a troll, and imply that I 
did "post an incredibly stupid or moronic idea to a newsgroup in the 
hopes of wasting everyone's time responding with why it is so stupid or 
moronic."

If you actually bothered to _read_ it, you would have discovered that 
the _whole_point_ of my idea was to protect gurus from parasites, 
decrease the burn-out rate, and thereby increase the flow of wisdom in 
this place.  It was a serious proposal, logically constructed, with 
assumptions explained, and it took _hours_ to write.  Are these the 
hallmark trappings of a post designed to waste _other_ people's time???

I never expected to get a deluge of responses - nor did I expect the 
responses that did come in to be positive.  The lurkers aren't affected, 
so there was likely to be no increase in the delurk rate.  The newbies 
would only be affected if their first question happaned to be out of the 
blue - and they are in the minority.  Parasites would hate it, but, 
being parasites, they aren't monitoring this group and thus aren't even 
aware of this thread's existence.  That leaves the gurus, few of which 
are currently at the "truly enraged level" and thus motivated to expend 
energy in favour of a change to the status quo.

What I _did_ expect was that the responses be civil, intelligent, and 
constructive.

It is a shame your's did not live up to the standard set by your peers.

Henry.


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

Date: Sat, 17 Jun 2000 09:20:58 GMT
From: Andy <y-o-y@home.com>
Subject: Re: Editor question
Message-Id: <_pH25.7348$A%3.77975@news1.rdc2.pa.home.com>

In article <394A32DF.AEDA9E1F@dmu.ac.uk>, Haris Siakalis 
<se97hs@dmu.ac.uk> wrote:

> Hello,
> I don't want to bore you with the same questions.
> I don't want to start long disussions of whats best.
> I know of editors like synedit,editplus,codemagic etc etc
> that support perl. What i am after and i cannot find is
> an editor that will break my perl program into subroutines
> or be configurable to do so, like Source Insight does for
> c/c++ programes.Its got to be on windows. Can you help please?
> 
> Thanks


Harris,

Have you looked at Multi_Edit 8.0? There is a free demo d/l available. 
See http://www.multiedit.com/80info.htm

Function tagging/scanning, bookmarking, version control system, macros, 
template creation/expansion, compiler tools, project tools, etc., etc. 
Totally customizable.

Like Prego, it's in there!

Regards,

Andy Burns


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

Date: Sat, 17 Jun 2000 01:03:26 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: flock, read, truncate, write to a file
Message-Id: <Pine.GSO.4.10.10006170055540.21108-100000@user2.teleport.com>

On Sat, 17 Jun 2000 fido99@my-deja.com wrote:

> Subject: Re: flock, read, truncate, write to a file

Please don't make the first article in a thread begin with "Re:"; this is
the prefix used for replies (like this one). (I'm not just being picky
here; many programs use that prefix and certain headers to organize
messages.) OTOH, if this wasn't the first article in the thread, then you
(or your software) seem to have omitted those certain headers. Tsk tsk!

> $LOCK_UN = 8;

Unless you understand all about Perl's internal buffering of I/O, don't
use LOCK_UN.

> $deleteline = "this line in sample.txt should be removed";

> for $line (@inbuff) {
>     print FILEHANDLE $line unless ($line eq $deleteline);
> }

It'll be hard for those to be equal, since $line will (almost certainly)
end with a newline character. :-)  (Did you test your program before you
posted it? And then you took out the newline after testing, right? :-)

> close (FILEHANDLE);
> flock FILEHANDLE, $LOCK_UN;
> 
> I'm not sure if the unlock is necessary after the close.

It's completely superfluous and does nothing but make your maintenance
programmer worry.

Cheers!

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




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

Date: Sat, 17 Jun 2000 11:44:17 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: how do I "redirect" a substitution?
Message-Id: <394d5fdd.12832292@news.skynet.be>

webqueen wrote:

>While I'm at it a "writeln" equivalent would be nice. How often do we
>use:
>
>  print "$scalar\n";
>
>where
>  println $scalar;
>
>would be neat.

Set $\ to "\n".

Here's my favourite way of writing a tab separated text file:

	my @header = qw(name age address);
	@record = (['Fred', 46, 'Bedrock'], ['Pebbles', 2, 'Bedrock']);
	($\, $,) = ("\n", "\t");
	print @header;
	foreach(@record) {
	    print @$_;
	}

-- 
	Bart.


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

Date: Sat, 17 Jun 2000 12:52:15 +0100
From: "James" <fromnews@pagepool.co.uk>
Subject: HTML form to variables in a perl program
Message-Id: <8ifopu$i28$1@gxsn.com>

Can someone please tell me the simplest way to get all the variables from an
HTML form?
Thanks

James
james@thoughtfortheday.org
http://www.thoughtfortheday.org - An inspirational and topical thought to
start your day.




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

Date: 17 Jun 2000 03:14:04 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: I can't figure this one out...  (Newbie question)
Message-Id: <slrn8kmac4.mlf.abigail@alexandra.delanet.com>

Tad McClellan (tadmc@metronet.com) wrote on MMCDLXXXII September MCMXCIII
in <URL:news:slrn8km4om.9tj.tadmc@magna.metronet.com>:
{} 
{} The problem may be that Perl's convention is the opposite
{} of Unix's convention.
{} 
{} In Unix, zero means success, non-zero means failure.
{} 
{} In Perl, true means success, false means failure.

Actually, not always. index() for instance returns a *true* value
on failure, and sometimes a false value on success.

system() is another exception.



Abigail
-- 
perl -wlne '}for($.){print' file  # Count the number of lines.


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

Date: Sat, 17 Jun 2000 11:44:19 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: I can't figure this one out...  (Newbie question)
Message-Id: <394e620a.13390055@news.skynet.be>

Uri Guttman wrote:

>	$num++ ;
>
>this is a SIDE EFFECT operation. it increments $num and returns the value
>AFTER that.
>
>	++$num ;
>
>that increments num and returns the value BEFORE the increment.

Swap that. ++$x returns the incremented value, $x++ returns the old
value.

And you can return ($x += 3) as well.

	$x = 18;
	print +($x += 3);

Note: the "+" for the print is intended to prevent a Perl warning.

-- 
	Bart.


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

Date: Sat, 17 Jun 2000 09:07:14 +0200
From: Johan =?iso-8859-1?Q?B=FCnger?= <phuket@phuket-guide.com>
Subject: Need help Spliting 1 vaiable in 2
Message-Id: <394B23A2.63F9F175@phuket-guide.com>

Hi,

I am a new beginner to the perl, I need help with the configuration of a
script. This is the problem I have:

I am building a web-site named Phuket-guide.com, we would now like to
have the latest headlines from the local newspaper direct on our first
page. To do so I was told to get a script called WrapHtml and then
configure it to work with their .ASP file. Now the problem is that I
have no idea about how to do so, I can collect the headlines and links
to the headlines. The problem is I can not format it correctly! I get a
“piped” version that look like this:

Robbers stab German resident to
death|http://www.phuketgazette.com/news/index.asp?id=941
Teens in ‘Romeo and Juliet’ double
suicide|http://www.phuketgazette.com/news/index.asp?id=940
THAI to launch new Oz-Phuket
service|http://www.phuketgazette.com/news/index.asp?id=939
Sweden pledges help for Cyber City
plan|http://www.phuketgazette.com/news/index.asp?id=938
Angel Air suspends
services|http://www.phuketgazette.com/news/index.asp?id=937
General coy about new job as
minister|http://www.phuketgazette.com/news/index.asp?id=936
Pattana Kathu Party wins landslide
victory|http://www.phuketgazette.com/news/index.asp?id=935
All saved as ferry burns and
sinks|http://www.phuketgazette.com/news/index.asp?id=934
BUPA launches special medical
coverage|http://www.phuketgazette.com/news/index.asp?id=933

This is not that fun to place on my firstpage, I would like to have the
headlines automatically linked to the URL included and just import it to
my web-site with SSI. I also need the link to open a new window if it is
clicked on.

I understad that I need to split the values and then get the 2 new
strings, then use the strings to format the link. I just do not know how
to split and get them in to the strings. Could any one out their with a
good hart help me?

This is the Script I use to call the headlines:

#!/usr/bin/perl
require "wraphtml.pl";
&Init(0);
&Wrap("Phuketgazette News","white");
&Font("black","Verdana","-1");
$content=&CallHTTP("www.phuketgazette.net/feedme/index.asp"); #MUST be
connected to internet to do this!
&Text($content);
&Wrap();

My thought was to get split $content in to $url, $headlines and then get
the &Text(<A HREF=”$url”>$headline</A>);

But I don’t know if this works?

Take a look at: http://phuketadult.com/cgi-bin/unixdemo.pl

I also need the link to open a new window if it is clicked on.

Sincerely
Johan Bünger
http://phuket-guide.com




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

Date: Sat, 17 Jun 2000 11:44:14 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: now this is strange...
Message-Id: <394c5eeb.12590732@news.skynet.be>

Kevin M. Sproule wrote:

>Oh you were so close!
>
>foreach $key (keys(%FORM)) {
>    $$key = $FORM{$key};
>}
>
>Note the extra $ which means use indirection.  This will assign the values
>to variables generated by $$key.  Cool stuff!

Give me one good reason why you want $$key instead of $FORM{$key}, or
$name instead of $FORM{name}.

It's dangerous. Don't do it.

-- 
	Bart.


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

Date: 17 Jun 2000 03:23:38 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Passing a database handles to subs....
Message-Id: <slrn8kmau2.mlf.abigail@alexandra.delanet.com>

David (david@dbillingham.demon.co.uk) wrote on MMCDLXXXI September
MCMXCIII in <URL:news:961222466.15154.0.nnrp-08.c2deb140@news.demon.co.uk>:
^^ Hi
^^ 
^^ I am writing as set of cgi scripts that use the Perl DBI to connect to a
^^ database. I want to connect to to the database and then call a sub, passing
^^ the sub the database handle or a handle returned by a prepare statement.
^^ I've tried to pass it by reference but can't find the right syntax - any
^^ suggestions?

Arguments to subs in Perl *are* passed by reference:

    sub inc ($) {$_ [0] ++}
    my $n = 1;
    inc $n;
    print $n;   # Prints 2.

There is no choice of passing by reference or value.

But I fail to see why you want to change the database or statement
handle in the sub.

^^ 
^^ Does anybody outhere know how to do this - or whether there is better
^^ approach?
^^ 
^^ For instance:
^^ 
^^ use strict;
^^ my $dbh = DBI->connect('dbi:ODBC:driver=Microsoft Access Driver
^^ (*.mdb);dbq=h:\db\Products.mdb') or die $DBI::errstr;
^^ 
^^ if ($FormData{search_button} eq 'Show Groups')
^^ {
^^ my $sql = "SELECT * FROM groups ORDER BY group_description";
^^ my $tbh = $dbh->prepare($sql) || &HandleError($DBI::errstr);
                                 ^^ You probably want "or" here.

^^ #Pass handle returned by $dbh->prepare - except it doesn't work....
^^ &ShowGroups($tbh);

\begin{IRC}
<Abigail> Doesn't work?
<purl> Look buddy, doesn't work is a strong statement. Does it sit on the
+couch all day? Is it making faces at you? Does it want more money? Please be
+specific!
\end{IRC}



Abigail
-- 
$" = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%_ = (Just => another => Perl => Hacker); &{%_};


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

Date: Sat, 17 Jun 2000 12:53:10 +0200
From: Markus Hediger <hedim@hta-bi.bfh.xxx>
To: verio <viciousdogs@zdnetmail.com>
Subject: Re: perl generated html response problem
Message-Id: <394B5896.64561C38@hta-bi.bfh.xxx>

> CGI Error
> The specified CGI application misbehaved by not returning a complete
> set of HTTP headers. The headers it did return are:

all these lazy guys told you to look at cgi docs - but actually the
answer is that easy. in any cgi-prog, normally, the first output at all
should be a valid http-header, in most cases done like this:

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

reason - explained as simple as possible:
when requesting a stupid html-page, the server sends such a line to the
client, but when running a cgi-prog, it doesn't do that because it's not
sure wheter what the script returns is of type text/html. so your prog
has to do it.

>> in my e-mail address replace .xxx with .ch


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

Date: Sat, 17 Jun 2000 12:01:29 GMT
From: tbb85@my-deja.com
Subject: Re: print pdf
Message-Id: <8ifpan$9r6$1@nnrp1.deja.com>


> Wait a minute... You don't want to *print* a PDF file (= send to
> printer), you want to *generate* a PDF file! Well, er, go to
> <http://search.cpan.org/> and look up "PDF". There are a number of
alpha
> softwares there, which might do this in a way you like. PDF::Create
> looks cute.
>
> --
> 	Bart.
>

I'm wondering which of the PDF modules listed on CPAN would be the best
to spend time installing and evaluating.  I need the capability to
insert GIF or JPG images into my PDF output files.  I looked through
some of the documentation for PDF::Create, but don't see any reference
to handling images.

http://search.cpan.org/doc/FTASSIN/PDF-Create-0.01/lib/PDF/Create.pm

Tony


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 17 Jun 2000 13:08:19 +0200
From: Markus Hediger <hedim@hta-bi.bfh.xxx>
Subject: regexp: replace \t with tab, but not \\t
Message-Id: <394B5C23.A5F5EAA2@hta-bi.bfh.xxx>

i have text data that i want to save to a file using tabstop- and
newline-separation. so it's smart i think to replace all tabs and
newlines within this text before storing it, otherwise that would
disturb the file's format...

       $POST_DATA{$_} =~ s/\\/\\\\/g;   # keep normal \ as \\
       $POST_DATA{$_} =~ s/\n/\\n/g;
       $POST_DATA{$_} =~ s/\t/\\t/g;

so far so good, but how can i undo that when reading the file? i tried
anything, but i can't find a working regexp. you see, i don't know too
much about regexps...

       $USER_PROFILE{$_} =~ s/\\\\/\\/g;

i have to do this to bring \\ back to \, but before, i'd have to do
something like "please replace all \t and \n, but please do not replace
\\t and \\n". i tried following, but it doesn't work if there are a few
tabstops each after the other.

       $USER_PROFILE{$_} =~ s/([^\\])\\t/$1\t/g;

do you have an idea? i'd be grateful, thanks!

>> in my e-mail address, please replace .xxx thru .ch


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

Date: Sat, 17 Jun 2000 03:24:09 -0700
From: "Gabe" <grichards@flashcom.net>
Subject: Spot the Syntax Error
Message-Id: <skmk8sftis428@corp.supernews.com>

I've been on this one for hours it seems. I'm blind and stupid so please
help me. And if you've got the time critique my code. I still feel I'm new
to programming and might not have a firm foothold on some conceptual issues.

The error message I get says syntax error on line 114 near "elsif". That's
the last "elsif" in this sub routine I'm posting.

 my @fldnames;
 my %fldsize = ();

 my $fldnum = $dbh->prepare("SELECT * FROM vehicles");
$fldnum->execute;
 my $gettbldef = $dbh->prepare("DESCRIBE vehicles");
$gettbldef->execute;
 my $tbldef = $gettbldef->fetchall_arrayref;
for (my $i=0; $i<$fldnum->{NUM_OF_FIELDS}; $i++) {
    unless ($tbldef->[$i]->[0] eq 'prosid' || $tbldef->[$i]->[0] eq 'vehid')
{
        if ($tbldef->[$i]->[2] ne 'YES' && $cgi->param($tbldef->[$i]->[0])
eq undef)

            print
$cgi->redirect('http://www.bestinsuranceinc.com/incomplete.html');
            exit;
       }
       else {
           $fldnames[$i] = $tbldef->[$i]->[0];
           $fldsize{$fldnames[$i]} = $1 if $tbldef->[$i]->[1] =~ /(\d+)/;
       }
    }
 }
 my $fldstr = 'prosid, ';
 my $plcehldr = '?, ';
 my $prosid = $cgi->param('prosid');
 push my @values, $prosid;
 foreach my $i (@fldnames) {
     if ($cgi->param($i)) {
       $fldstr .= "$i, ";
       $plcehldr .= '?, ';
       push @values, $cgi->param($i);
      }
 }
 substr($fldstr, -2) = "";
 substr($plcehldr, -2) = "";
 my $insquery = "INSERT INTO vehicles ($fldstr) VALUES ($plcehldr)";
 my $addpros = $dbh->prepare($insquery);
 $addpros->execute(@values) || die $dbh->errstr;
 if ($cgi->param('morevehicles') eq 'n') { &getcovpg($prosid)};
 elsif ($cgi->param('morevehicles') eq 'y') { &getvehpg($prosid)};
}





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

Date: Sat, 17 Jun 2000 20:47:17 +1000
From: Peter Hill <phill@modulus.com.au>
Subject: Re: Spot the Syntax Error
Message-Id: <394B5735.56EE@modulus.com.au>

Gabe wrote:
> 
> I've been on this one for hours it seems. I'm blind and stupid so please
> help me. And if you've got the time critique my code. I still feel I'm new
> to programming and might not have a firm foothold on some conceptual issues.
> 
> The error message I get says syntax error on line 114 near "elsif". That's
> the last "elsif" in this sub routine I'm posting.
[snip]
>  if ($cgi->param('morevehicles') eq 'n') { &getcovpg($prosid)};
>  elsif ($cgi->param('morevehicles') eq 'y') { &getvehpg($prosid)};


Refomatting for legibility:
  if ($cgi->param('morevehicles') eq 'n') { 
	&getcovpg($prosid)
  };
  #^^oops
  elsif ($cgi->param('morevehicles') eq 'y') { 
	&getvehpg($prosid)
  };

It's the semicolon.

-- 
Peter Hill,
Modulus Pty. Ltd.,
http://www.modulus.com.au/


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

Date: Sat, 17 Jun 2000 11:44:10 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Ugh
Message-Id: <394b31a7.1005676@news.skynet.be>

jason wrote:

>>Try this useful little script which I call
>>macorpc2unix:
>>
>>#!/usr/bin/perl -w -i
>>while (<>) {s/\r\n*/\n/g;}
>>continue   {print;}
>
>you should add that the above has to be done once over on UNIX otherwise 
>there will not be any "\r\n"s in the file as the filehandle was not 
>binmoded

True, but if this was done on a PC, it wouldn't matter. Bare "\r"
characters would still be there, and be replaced.

But the bare linefeeds in the output would still be converted into CRLF
pairs, unless you do binmode on the output handle.

n.b. The meaning of "\r" and "\n" is platform dependent. On a Mac, "\n"
is chr(13) (because that is what the Mac uses), and "\r" is "the other
one", i.e. chr(10).

>don't even know if you can with the <> construct .. if I'm reading the 
>(5.005_03) docs correctly the ARGV filehandle doesn't exist until the 
>first time the <> is used .. and once it is used it's too late to be 
>binmoding it

Now there indeed there is a generic problem. <> is intended to be used
on text, so I'm not sure it actually *is* a problem. But there isn't a
way to run some code fragment whenever a new file is opened. There's the
kludge using eof (see docs), but that only works between files, so, not,
for example, when the first file is opened.

-- 
	Bart.


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

Date: Sat, 17 Jun 2000 12:41:07 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Ugh
Message-Id: <MPG.13b60f1b93b57c3d989740@news>

Bart Lateur writes ..
>jason wrote:
>
>>>Try this useful little script which I call
>>>macorpc2unix:
>>>
>>>#!/usr/bin/perl -w -i
>>>while (<>) {s/\r\n*/\n/g;}
>>>continue   {print;}
>>
>>you should add that the above has to be done once over on UNIX otherwise 
>>there will not be any "\r\n"s in the file as the filehandle was not 
>>binmoded
>
>True, but if this was done on a PC, it wouldn't matter. Bare "\r"
>characters would still be there, and be replaced.

no they're not .. the filehandle is not binmoded - so the lines read in 
with <> will not contain "\r\n" .. they will contain "\n" as their line 
endings (once in Perl)

I might have caused some confusion by using the term "file" in my post 
above when I meant "strings read from the file by Perl"

>But the bare linefeeds in the output would still be converted into CRLF
>pairs, unless you do binmode on the output handle.

you did read that we're going from Windows -> UNIX didn't you ?

>n.b. The meaning of "\r" and "\n" is platform dependent. On a Mac, "\n"
>is chr(13) (because that is what the Mac uses), and "\r" is "the other
>one", i.e. chr(10).

the meaning is only platform dependant when reading from or writing to a 
non-binmoded filehandle

read from a text filehandle on Windows and all CRLF sequences are 
converted to LFs .. and the reverse is done on a write

the 'meaning' inside the Perl code is the same - and platform 
independent .. the only magic happens when writing to or from a non-
binmoded filehandle

-- 
 jason - elephant@squirrelgroup.com -


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

Date: Sat, 17 Jun 2000 14:05:32 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Variable variable names, was Re: now this is strange...
Message-Id: <Pine.GHP.4.21.0006171353570.21898-100000@hpplus03.cern.ch>

On Sat, 17 Jun 2000, Kevin M. Sproule wrote:

[a fullquote regularly presages disaster, and this seems no
exception...]

> foreach $key (keys(%FORM)) {
>     $$key = $FORM{$key};
> }
> 
> Note the extra $ which means use indirection.  This will assign the values
> to variables generated by $$key.  Cool stuff!

This seems to me to be an exhibit of the old saying that a little
knowledge is a dangerous thing.

See specifically http://www.plover.com/~mjd/perl/varvarname2.html

and the other two articles in the series.

Perl stalwarts: why can't I find this topic in the Perl FAQs? Is it
not there, or am I failing to find it?  Maybe I'm over-sensitive, but
it seems to me that it comes up with sufficient regularity to justify
a mention.

cheers




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

Date: Sat, 17 Jun 2000 06:30:00 -0400
From: "Ryan & Treena Carrier" <ryanc@nci1.net>
Subject: Re: Very Strange Behaviour
Message-Id: <394b51e8_2@news.cybertours.com>

I had the same problem - I needed to test my PERL scripts before publishing
them. I tried Microsoft Personal Web Server, but my Norton Anti-Virus would
hang up. I ended up using Apache. The biggest problem I had was setting up
httpd.conf correctly. You must ensure that:
1. ServerName 127.0.0.1
2. ScriptAlias /cgi-bin/ "C:/Apache/cgi-bin/"
3. <Directory "C:/Apache/cgi-bin">
    AllowOverride None
    Options ExecCGI
</Directory>
4. AddHandler cgi-script .pl

Just look through httpd.conf in the conf folder under Apache. Read through
it, and if you get stuck, send me an e-mail

I know some out there will say this is not PERL related. It is.

Jacobyte <jacobyte@goattee.co.uk> wrote in message
news:8iegpf$mq2$1@plutonium.btinternet.com...
> I am running a few web sites out there each with their own cgi-bins on
unix
> servers - all scripts work fine and well.
> I am also running 3 personal web servers one on Win98 , one Linux Mandrake
> and one on Corel Linux for the sole purpose of customizing my existing
> scripts on the remote servers. On win98 only %40 work, everything is set
up
> ok though while on the linux servers with Apache installed I cannot get
any
> to work through the browser - just get the 500 error - most of the scripts
> will execute through bash ok though.
>
> I know this is a long shot but I desperatley need an offline cgi
development
> environment. and am absolutley stuck as to why things are not working esp
in
> Linux even though they run on the remote servers. I have check all the
usual
> basepaths, permissions etc and everything is ok
>
> If you have any ideas on this then feel free to throw them at me I will be
> eternaly grateful !
>
> cheers
>
>




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

Date: Sat, 17 Jun 2000 09:43:57 GMT
From: drdubosc@my-deja.com
Subject: where libHTML documentation?
Message-Id: <8ifh8s$59s$1@nnrp1.deja.com>



Probably naive...or cofused?

Where do I find documentation or help for HTML:: functions? AsSubs, for
example? Although I've installed libHTML, (Active Perl, win32, PPM),
and can 'use HTML::AsSubs;' without complaint, I can't find it in the
online documentation, or via perldoc.



Thanks ..


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 17 Jun 2000 11:13:59 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Yet Another Abigail Admirer (WAS Re: Crazy enough that it might just work...) :)
Message-Id: <slrn8kmngd.44i.tjla@thislove.dyndns.org>

I was shocked! How could Abigail <abigail@delanet.com>
say such a terrible thing:
>Abigail
>-- 
>perl -Mstrict -we '$_ = "goto E.print chop;\n=rekcaH lreP rehtona tsuJ";E1:eval'

I have looked at this and looked at this and I just cannot see how it
works. Could someone please provide an explanation?

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
"Falling in love makes smoking pot all day look like the ultimate in restraint."
-- Dave Sim, author of Cerebrus.


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 3400
**************************************


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