[21817] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4021 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 24 09:06:24 2002

Date: Thu, 24 Oct 2002 06:05:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 24 Oct 2002     Volume: 10 Number: 4021

Today's topics:
        Adding a word to a list if it is not already in there <krikrok.horse@hotmail.com>
    Re: Adding a word to a list if it is not already in the <rev_1318@hotmail.com>
    Re: Adding a word to a list if it is not already in the <nobull@mail.com>
    Re: Advice Please news@roaima.freeserve.co.uk
        calling an external script within a script? <aragorn@freemail.gr.gr>
    Re: calling an external script within a script? <Graham.T.Wood@oracle.com>
    Re: calling an external script within a script? <nobull@mail.com>
    Re: calling an external script within a script? (Helgi Briem)
    Re: calling an external script within a script? <flavell@mail.cern.ch>
    Re: calling an external script within a script? <pilsl_use@goldfisch.at>
        cgi/pipes not working properly <stephenc@ics.mq.edu.au>
    Re: CGI::Minimal does not work with enctype="multipart/ (Alex)
    Re: defined() upon aggregates (hashes and arrays) is no <thepoet@nexgo.de>
    Re: deleting a file... kill ???   Thanks... (Helgi Briem)
    Re: deleting a file... kill ???   Thanks... (Helgi Briem)
    Re: deleting a file... kill ???   Thanks... (tî'pô)
    Re: deleting a file... kill ??? <bart.lateur@pandora.be>
    Re: HTML <img ...> <flavell@mail.cern.ch>
        Image Arcadia? <dominique.javet@bni.ch.NOSPAM>
    Re: Newbie Perl script help <nobull@mail.com>
    Re: Order form script <cingram@pjocsNOSPAMORHAM.demon.co.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 24 Oct 2002 10:34:29 +0200
From: Yils Kraabe <krikrok.horse@hotmail.com>
Subject: Adding a word to a list if it is not already in there
Message-Id: <3DB7B095.6A14F987@hotmail.com>


Hello,

I want to add a (list of) words to a list, if this word in not already
in there. I did something very C-like, with a flag:

for $newword (@newwords) {
  $flag = 1;
  for $word (@words) {
    $flag = 0 if $newword eq $word
  }
  $words[@words] = $newword if $flag;
}

However it looks pretty ugly to me. Maybe is there a "shell"-like
solution using sort and something similar to uniq, or something else,
that could improve this laborious code.

Thanks again.


--
Remove the mammal in my e-mail address to mail me.


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

Date: Thu, 24 Oct 2002 12:01:59 +0200
From: Paul <rev_1318@hotmail.com>
Subject: Re: Adding a word to a list if it is not already in there
Message-Id: <ap8geh$t76$1@odysseus.uci.kun.nl>

The easiest way to do this is using a Hash, e.g.:
my %list;
@list(@newwords) = (1) x @newwords;

or:

$list{$_}++ foreach (@newwords); (gets you the frequencie of the words)

HTH,

Paul


On Thu, 24 Oct 2002 10:34:29 +0200, Yils Kraabe wrote:


> Hello,
> 
> I want to add a (list of) words to a list, if this word in not already
> in there. I did something very C-like, with a flag:
> 
> for $newword (@newwords) {
>   $flag = 1;
>   for $word (@words) {
>     $flag = 0 if $newword eq $word
>   }
>   $words[@words] = $newword if $flag;
> }
> }
> However it looks pretty ugly to me. Maybe is there a "shell"-like
> solution using sort and something similar to uniq, or something else,
> that could improve this laborious code.
> 
> Thanks again.
> 
> 
> --
> Remove the mammal in my e-mail address to mail me.


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

Date: 24 Oct 2002 12:06:13 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Adding a word to a list if it is not already in there
Message-Id: <u9iszs6qqi.fsf@wcl-l.bham.ac.uk>

Yils Kraabe <krikrok.horse@hotmail.com> writes:

> I want to add a (list of) words to a list, if this word in not already
> in there.

I shall assume you really mean "I want to add a (list of) words to a
set".  (Sets are unordered).
 
> for $newword (@newwords) {
>   $flag = 1;
>   for $word (@words) {
>     $flag = 0 if $newword eq $word
>   }
>   $words[@words] = $newword if $flag;
> }
> 
> However it looks pretty ugly to me.

No it's very ugly - at several different levels.

for my $newword (@newwords) {
  push @words => $newword unless grep { $_ eq $newword } @words;
}

Looks much less ugly... but that's only skin deep.  The above is
simply writing the same algorithm in Perl (rather than transliterating
it from C).

But in Perl arrays are not the correct datatype to hold sets.

The correct datatype to hold a set is a hash in which you use only the
keys and leave all the values undefined.

Rather than holding your wordlist in @words hold in keys(%words).

You can then add to the set with a slice assignment:

 @words{@newwords} = ();

Note: if you really did want a list and not a set then the easieast
way is to maintain both.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 24 Oct 2002 13:57:30 +0100
From: news@roaima.freeserve.co.uk
Subject: Re: Advice Please
Message-Id: <qnq8pa.voh.ln@moldev.cmagroup.co.uk>

merlin <merlin@itwizards.sic> wrote:
>     I know nothing about Perl.

You also don't seem to know about cross-posting. If you're going to send
the same post to two (or more) newsgroups then please post it ONCE to
both of them at the same time. That way you don't get multiple threads to
follow, and we don't get to waste our time repeating stuff independently
in the two newsgroups.

Chris
-- 
@s=split(//,"Je,\nhn ersloak rcet thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}


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

Date: Thu, 24 Oct 2002 13:20:42 +0300
From: "aragorn" <aragorn@freemail.gr.gr>
Subject: calling an external script within a script?
Message-Id: <ap8hhr$mm9$1@nic.grnet.gr>

I am calling the "system" function within a cgi script to call
an external script. The function works fine, executes the external
script
and returns back to the calling script.
The problem i have is that i cann't return a value from the external
script
to the parent.
Is there a way to do this with "system" or should i use some other
command.



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

Date: Thu, 24 Oct 2002 11:54:58 +0100
From: Graham Wood <Graham.T.Wood@oracle.com>
Subject: Re: calling an external script within a script?
Message-Id: <3DB7D182.12DFA29E@oracle.com>

aragorn wrote:

> I am calling the "system" function within a cgi script to call
> an external script. The function works fine, executes the external
> script
> and returns back to the calling script.
> The problem i have is that i cann't return a value from the external
> script
> to the parent.
> Is there a way to do this with "system" or should i use some other
> command.

Use either `backticks` or open to run the external script.  System will
return only true or false depending on whether the command specified
worked or didn't.  backticks, or open will get you all the standard
output and standard error from the external script.

perldoc -q external will give you details of these 3 methods of running
external programs.

@output=`command to run other program`;

or

open(OUTPUT,"command to run other program|") || die "Can't run other
program $!\n";
while(<OUTPUT>){
    print;
    # or do whatever else you want with output lines from the other
program
}

Graham Wood



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

Date: 24 Oct 2002 12:07:03 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: calling an external script within a script?
Message-Id: <u9d6q06qp4.fsf@wcl-l.bham.ac.uk>

"aragorn" <aragorn@freemail.gr.gr> writes:

> The problem i have is that i cann't return a value from the external
> script to the parent.

> Is there a way to do this with "system" or should i use some other
> command.

You _can_ do it with system but there are easier ways.
The manual entry for system() will point you in the right direction.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 24 Oct 2002 11:12:47 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: calling an external script within a script?
Message-Id: <3db7d439.719696619@news.cis.dfn.de>

On Thu, 24 Oct 2002 13:20:42 +0300, "aragorn"
<aragorn@freemail.gr.gr> wrote:

>I am calling the "system" function within a cgi script to call
>an external script. The function works fine, executes the external
>script and returns back to the calling script.

>The problem i have is that i cann't return a value from the external
>script to the parent.

>Is there a way to do this with "system" 

No. Not directly, although you can pipe to a file, then read

that.

>or should i use some other command.

Yes.

Your Question is Frequently Asked and as such, has an entry
in the Perl documentation that comes with every installation

of Perl.  Reading perldoc -q system, especially the section:
"Why can't I get the output of a command with system()?" 
would have given you the answer. 

To return the output of external programs you should use
backticks:

my $output = `$external_cmd` or die "$!"; 

or the qx (quote-execute) operator:

my $output = qx/$external_cmd/ or die "$!";

-- 
Regards, Helgi Briem
helgi AT decode DOT is

                           A: Top posting
                           Q: What is the most irritating thing on Usenet?
                                           - "Gordon" on apihna


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

Date: Thu, 24 Oct 2002 13:22:58 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: calling an external script within a script?
Message-Id: <Pine.LNX.4.40.0210241317240.30678-100000@lxplus074.cern.ch>

On Oct 24, aragorn inscribed on the eternal scroll:

> I am calling the "system" function within a cgi script to call
> an external script.

So you would have consulted the documentation on the "system"
function, e.g with perldoc -f system

> The problem i have is that i cann't return a value from the external
> script

What about this part of the documentation for "system" ? :

               This is not what you
               want to use to capture the output from a command,
               for that you should use merely backticks or
               `qx//', as described in the section on [...]

There's an FAQ about it, too, as I recall.

Since you're talking about a CGI script, don't forget the potential
security issues (hint: tainted data) and unexpected settings of
environment variables (different from what you'd get in your own
shell).



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

Date: Thu, 24 Oct 2002 14:58:10 +0200
From: peter pilsl <pilsl_use@goldfisch.at>
Subject: Re: calling an external script within a script?
Message-Id: <3db7ee84$1@e-post.inode.at>

Helgi Briem wrote:

> 
> No. Not directly, although you can pipe to a file, then read
> 

thats wrong.
of course you can directly read the output of any tool without need to 
write to a file first !! (This is the meaning of piping)

open(FH,"mytool |") or die;
while (<FH>) {print $_};

For more simple approaches you can use/query returnvalues (look at $?)  and 
for more efficient approaches you can use interprocesscommunications via 
sockets or such things.

peter



> that.
> 
>>or should i use some other command.
> 
> Yes.
> 
> Your Question is Frequently Asked and as such, has an entry
> in the Perl documentation that comes with every installation
> 
> of Perl.  Reading perldoc -q system, especially the section:
> "Why can't I get the output of a command with system()?"
> would have given you the answer.
> 
> To return the output of external programs you should use
> backticks:
> 
> my $output = `$external_cmd` or die "$!";
> 
> or the qx (quote-execute) operator:
> 
> my $output = qx/$external_cmd/ or die "$!";
> 

-- 
peter pilsl
pilsl_@goldfisch.at
http://www.goldfisch.at



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

Date: Thu, 24 Oct 2002 18:24:19 +1000
From: Stephen Choularton <stephenc@ics.mq.edu.au>
Subject: cgi/pipes not working properly
Message-Id: <3DB7AE33.5070206@ics.mq.edu.au>

Hi

I am trying to fire up a process which then talks to a game interpreter.

I can run it at the command line and it passes the info but when I try 
and run it from a browser it doesn't get the text output at all.

The code is:

fire_game.pl:

#!/usr/local/bin/perl -w

use strict;
use CGI qw(:standard);
# for the fork and pipe
use IPC::Open2;

# for the pipes
use IO::Socket;

$| = 1; # don't buffer

my $port = 7097;

#make a cgi   object
append_log("Creating CGI");
my $q = CGI->new();


### START THE GAME UP ##############

# get the game's name
my $game = $q->param('game');

# add .z5 onto it so you can pass the full arguament to the game interpreter
$game  = $game . '.z5';

#create local handles
local(*Reader, *Writer);
my $prog  = 'game_server_child.pl';

# fire up the child
my $childpid = open2(\*Reader, \*Writer,  $prog) or die "can't open pipe 
to $prog: $!";

# a variable for the answers
my $reply;

append_log("getting writer");
print Writer "$game\n";

# catch the reply from the game
$reply = &getReply();

#reformat it and send it to the browser
&sendReply();

### OK now I can move onto accepting a response
### first I have to open my sockets

## OK now I want messages from message.pl and I have to listen on this port

my $sock = new IO::Socket::INET (
                                    LocalHost => 'localhost',
                                    LocalPort => $port ,
                                    Proto => 'tcp',
                                    Listen => 1,
                                    Reuse => 1,
                                   );
die "Could not create socket: $!\n" unless $sock;
print "socket created at $port\n";

while (1) {

     my $new_sock = $sock->accept();

     while(defined(my $line = <$new_sock>)) {
     print "this is the instruction from message $line, printed from 
inside fire_game\n";
     print Writer "$line\n";
     $reply = &getReply();
     &sendReply();
     }



}

close($sock);


kill 1, $childpid;
kill 9, $childpid;

#
#
### END OF MAIN ##########################################

### GET REPLY ############################################
#
#

sub getReply {


     my $finish = 0;
     my $reply = '';
     while ($finish == 0){

     my $his_output  = <Reader>;

     if ($his_output =~ m/here\./ ){
         $reply = $reply . $his_output;
         $finish = 1;
     }
     else {
         $reply = $reply . $his_output;
     }
     }

     return $reply;

}

#
#
##########################################################

### SEND REPLY ###########################################
#
#  this is a general purpose function to send
#  a VoiceXML document with one chunk of text



sub sendReply { # uses $reply from above

### clean the reply - get rid of the odd problem
$reply =~ s/\d\/\d//;

print $q->header( "text/plain" );
#print "\n";


print qq*<?xml version="1.0" encoding="Cp1252"?>
<!DOCTYPE vxml PUBLIC '-//Nuance/DTD VoiceXML 1.0//EN' 
'http://voicexml.nuance.com/dtd/nuancevoicexml-1-2.dtd'>
<vxml version="1.0">
<meta name="Generator" content="V-Builder 1.2.30" />

     <form id="form1">
          <field name="answer">
         <prompt>
             $reply
         </prompt>
         <grammar type="text/gsl">
             <![CDATA[([
             east { return(east) }
             north { return(north) }
             south { return(south) }
                        west { return(west) }
                    ])]]>
                        </grammar>
         <filled mode="any">
               <submit 
next="http://www.ics.mq.edu.au/~stephenc/cgi-bin/message.pl" namelist = 
"answer" method="get" enctype="application/x-www-form-urlencoded"/>
                  </filled>
         </field>
      </form>
</vxml>
*;


}

sub append_log()
{
     my ($msg) = shift @_;
     open(F, ">> log.txt") || die "Cannot wirto to log.txt: $!\n";
     print F scalar(localtime()) . "\t $msg\n";
     close(F);
}


game_server_child.pl:

#!/usr/local/bin/perl -w

# this is the child
# all it does is exec the interpreter and call the right game

$| = 1;


chomp($input = <STDIN>);

exec("game_interpreter" , $input);

and message.pl:

#!/usr/local/bin/perl  -w

use strict;
use CGI qw(:standard);

# for the pipes
use IO::Socket;

$| = 1; # don't buffer

my $port = 7097;

#make a cgi object

my $q = CGI->new();

# get the message passed
my $answer = $q->param('answer');
chomp($answer);


use IO::Socket;
my $sock = new IO::Socket::INET(PeerAddr => 'localhost',
                  PeerPort => $port,
                  Proto => 'tcp',
                  )
or die "Couldn't connect : $!\n";

# send a message
print $sock "$answer";

close ($sock);


The idea is that you fire up the fire-game.pl with 'perl 
fire_game.pl>game=amanda' (thats the name of an IF game) and 
fire_game.pl starts, forks and passes the name of the game to its child. 
Its child then exec's the game interpreter which send its opening 
message to fire_game.pl (I have hijacked standard I/O into pipes betwen 
these processes).

Then fire_game.pl goes into listening mode having opened a socket.

message.pl is fired up with message.pl?answer=east (or whatever) and 
passes this down the socket to fire_game which passes it down the pipe 
to the game interpreter, etc

Now this works when you do it this way but when you make (essentially) 
the same entries in the uri of a browser or using wget it doesn't work. 
It is like there is some second form of buffering taking palce (and 
maybe there is by apache) but anyway I cannot figure it out can anyone 
cast any light on it.

Plus second question - the game is written in C and I don't know how to 
describe the character I am trying to catch to know that its out put has 
finished each time I talk to it.

I want something like

if ($input =~ m/EOF/ ) { #stop }

but that doesn't work.  Anyone got any dieas?

Incidentally, this is all for a good cause.  It will allow blind people 
to play these games using a standard VoiceXML Gateway si if you can help 
thanks.

Stephen



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

Date: 24 Oct 2002 05:37:14 -0700
From: samara_biz@hotmail.com (Alex)
Subject: Re: CGI::Minimal does not work with enctype="multipart/form-data"?
Message-Id: <c7d9d63c.0210240437.11d352fe@posting.google.com>

> Why? Because it works one but not on the other? That's not a firm argument. 
> Perhaps it is in your code! CGI::Minimal has proved to me to be a fine 
> piece of code. I recommend you don't vent your opinion in this way to the 
> CGI::Minimal author.

Well, I did do that. Not that I got any response, but I was getting
increasingly frustrated, so I thought I'd ask.

> That could be an even stronger hint that it is in *your* code instead of 
> being a CGI::Minimal bug.

Yes, in the end it was in my code. The problem was that before you can
use CGI::Minimal for file uploads, you're supposed to say set STDIN to
binary mode:

binmode STDIN;
my $cgi = CGI::Minimal->new;

If you don't do that, it doesn't run - at least on Windows systems.
Someone told me it ran fine without it on their Unix system.

That's all there's to it.

Alex


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

Date: Thu, 24 Oct 2002 09:20:01 +0200
From: "Christian Winter" <thepoet@nexgo.de>
Subject: Re: defined() upon aggregates (hashes and arrays) is not guaranteed to produce intuitive results
Message-Id: <ap86n8$a48$1@newsread1.arcor-online.net>

"Christian Winter" <thepoet@nexgo.de> wrote:
> I'd guess the best solution would be to test for the existance
> of the hash key first. Like
> 
> if( exists $a{1}{2}{3} && defined $a{1}{2}{3} ) { ... }

Sorry. Just skip this entire posting, I think I should
have had some coffee before posting nonsense.
exists() also creates higher level keys, so I was wrong here.
I'm surprised I didn't step into this pit before...

-Christian



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

Date: Thu, 24 Oct 2002 10:22:15 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: deleting a file... kill ???   Thanks...
Message-Id: <3db7c8fb.716818450@news.cis.dfn.de>

On Wed, 23 Oct 2002 17:25:29 GMT, Jason Baugher
<jason@baugher.pike.il.us> wrote:

>Well, let's clarify this.  Windows XP, NT, whatever have "shortcuts", 
>which are more or less equivalent to "symbolic links" in unix-like 
>O/S'es.  Symbolic links, unlike regular links (hard) are pointers to file 
>locations based on the logical path location of the target file, versus 
>the link (hard) pointer to the actual physical location on disk.
>
>So, Windows Xp, NT, whatever have symbolic links, but not hard links.

Shortcuts are NOT equivalent to symbolic links.  Shortcuts
are more like shell scripts that point to the target file.
WinNT etc have both symbolic links and shortcuts, but not as

you say, hard links.
-- 
Regards, Helgi Briem
helgi AT decode DOT is

                           A: Top posting
                           Q: What is the most irritating thing on Usenet?
                                           - "Gordon" on apihna


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

Date: Thu, 24 Oct 2002 10:31:47 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: deleting a file... kill ???   Thanks...
Message-Id: <3db7ca29.717120514@news.cis.dfn.de>

On Thu, 24 Oct 2002 05:47:07 GMT, "Jürgen Exner"
<jurgenex@hotmail.com> wrote:

>> I still don't really understand why someone decided to call
>> it unlink and not rm or delete or remove or something.
>
>Because that is what the function does. "Unlink" does not delete files. It
>only removes the link pointing from the directory to the file. Seems to be
>quite reasonable to call this function unlink.
>And only if this link happens to be the last link pointing to this file,
>then the file will be removed by the OS automatically. This is the way how
>file systems work.

Yeah, yeah, I know that.  

My point is this.  When programming, you name variables
according to their function, not according to their
underlying hardware/language implementation. 

Naming a variable StackPointer or MemoryAddress789xx0
which it undoubtedly is, is not nearly as useful to the 
hapless programmer trying to debug your code as naming it 
Student_Name.  Do you get me?  Naming the 'file delete' 
function unlink because that is the underlying mechanism is 
similar to naming it 'flip' because it involves flipping 
bits.  

It reminds me of an old joke:
"If Unix gurus were forced to "simplify" the Unix 
interface they would do it by reducing it to just *one*
command but with *lots* of options."

All I am asking for is a FAQ entry: "How do I delete a 
file?" and a sentence in the delete entry of the docs 
pointing you to unlink if what you want to delete is a file.
-- 
Regards, Helgi Briem
helgi AT decode DOT is

                           A: Top posting
                           Q: What is the most irritating thing on Usenet?
                                           - "Gordon" on apihna


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

Date: Thu, 24 Oct 2002 13:28:19 +0200
From: "Teh (tî'pô)" <teh@mindless.com>
Subject: Re: deleting a file... kill ???   Thanks...
Message-Id: <utlfru8j1gu325b36v2nrvkrfnjmspnjji@4ax.com>

Jürgen Exner bravely attempted to attach 19 electrodes of knowledge to
the nipples of comp.lang.perl.misc by saying:
>Bart Lateur wrote:
>> Because on Unix, it is not garanteed to delete a file. You can have
>> more than one hard connections (links) between the name of the file
>> in the filesystem, and the contents. and unlink deletes *one* such
>> entry. Only if *all* these name entries are deleted, the file
>> contents itself gets wiped.
>
>To complicate things yet a bit more: any open file handle to this file
>counts as a link, too.
Which was why I thought I was very clever, in my second year of
university ,when I put unlink(argv[0]); in the beginning of my
homework assignments...

I then compiled the executables, submitted them and removed that line
of code. I'm not sure if my lecturers found it to be as amusing though
;o)

> Very frequently used to create hidden temporary files.
We discovered that this can be a bit risky because some NFS systems
don't support this behavior fully, if a process opens a file and
before it has time to read from it the file is deleted from another
computer the file may disappear making read fail with ESTALE (in C
anyway).


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

Date: Thu, 24 Oct 2002 10:48:49 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: deleting a file... kill ???
Message-Id: <cujfruc2k0qmehegiti3d6hmkiasvcg2gg@4ax.com>

Jürgen Exner wrote:

>Well, it might be useful to test if the unlink was successfull
>
>    die "Can't unlink $obidfil because $!\n" unless unlink $obidfil;

Only if the reason was not because the file didn't exist.

	unlink $obidfil or -e $obidfil && die
	  "Can't unlink '$obidfil': $!";

-- 
	Bart.


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

Date: Thu, 24 Oct 2002 12:29:21 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: HTML <img ...>
Message-Id: <Pine.LNX.4.40.0210241222290.30678-100000@lxplus074.cern.ch>

On Oct 24, Tassilo v. Parseval inscribed on the eternal scroll:

>     use CGI qw/:standard/;
>     ...
>     open IMG, "image.png" or die ...;
>     binmode IMG; # only needed for Windows-boxes
>     print header("image/png");
>     print do { local $/; <IMG> };

If the result was going to be a static image that's accessible in the
file tree, then I'd consider using one or other of the two forms of
Location: response (which one would depend on circumstances).

But as the context seems to call for a dynamically created image,
and as you've mentioned binmode for the input - what about the output?

Incidentally, binmode isn't needed _only_ for Windows: there are some
other OSes which need it when it's appropriate.  And when it's the
right thing to do, it does no harm for OSes where it isn't needed.
(I admit to ignorance of Perl programming on EBCDIC-based platforms,
however).

all the best



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

Date: Thu, 24 Oct 2002 14:10:04 +0200
From: "Dominique Javet" <dominique.javet@bni.ch.NOSPAM>
Subject: Image Arcadia?
Message-Id: <ap8nns$8jj$2@newsreader.mailgate.org>

Hello,

I've Image Arcadia Lite 3.02

I found a site where I can download the Image Arcadia v2.8.1
Is that the 2.8.1 a lite version or the full verison?
I ask this, because my Lite version had a little bug with the category
listing...

Or in otherwise, do you know a perl or php script like Image Arcadia?
I'm setting a big portfolio (more than 600 pix) with Image Arcadia...

Regards, Dominique




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

Date: 24 Oct 2002 12:12:10 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Newbie Perl script help
Message-Id: <u98z0o6qgl.fsf@wcl-l.bham.ac.uk>

Paul Murphy <pnmurphyNO_SPAM_TODAY_THANK_YOU@cogeco.ca> writes:

> Subject: Newbie Perl script help

Please put the subject of your post in the Subject of your post.  If
in doubt try this simple test.  Imagine you could have been bothered
to have done a search before you posted.  Next imagine you found a
thread with your subject line.  Would you have been able to recognise
it as the same subject?

>  I am trying to convert all my shell scripts into perl scripts, but
>  with the attached I am having a problem. I keep getting the
>  following errors no matter what I do ( obviously I'm not doing the
>  right thing ):

Those are not errors those are warnings.
 
> [earth] /home/paul: bin/outside-temp.pl
> Use of uninitialized value at bin/outside-temp.pl line 22.
> Use of uninitialized value at bin/outside-temp.pl line 23.
> Use of uninitialized value at bin/outside-temp.pl line 24.
> Use of uninitialized value at bin/outside-temp.pl line 16.

The above message is misleading.  The world 'uninitialized' should
really read 'undefined'.

What part of the explaination of that warning given in the reference
manuals did you find hard to understand?

> p.s. Did I mention I was a newbie.

Did I mention I'm not a psychic?

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 24 Oct 2002 11:14:29 +0100
From: "Clyde Ingram" <cingram@pjocsNOSPAMORHAM.demon.co.uk>
Subject: Re: Order form script
Message-Id: <ap8h45$634$1$8300dec7@news.demon.co.uk>

Francois,

"Francois Pichette" <fpichette@NOSPAMvideotron.ca> wrote in message
news:KrKt9.28369$Td.554656@wagner.videotron.net...
> Hi, I am setting up a website and I need to create an order form to allow
> users to pay for goods via Credit Card.

<snip>

Have you searched Google News?
I can't help directly, but if you are feeling adventurous, you might try
doing something with Lincoln Stein's elegant example of multi-page CGI
dialogue at http://www.wiley.com/legacy/compbooks/stein/source.html
Look for the entry entitled

loan.pl: Multi-page questionnaire (listing 2.3, page 70).
    Run the script
    See its source code

The book explains the details.  I have not checked to see if it says
anything about SSL, which you should probably use for secure collection of
credit card details.  You may have to get this from somewhere else..

Good luck,
Clyde





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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.announce, send your article to
clpa@perl.com.

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

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


------------------------------
End of Perl-Users Digest V10 Issue 4021
***************************************


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