[16395] in Perl-Users-Digest
Perl-Users Digest, Issue: 3807 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 26 09:05:26 2000
Date: Wed, 26 Jul 2000 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)
Message-Id: <964616714-v9-i3807@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 26 Jul 2000 Volume: 9 Number: 3807
Today's topics:
Re: <newbie> Html Tag generation (Colin Keith)
Re: <newbie> Html Tag generation <sumus@aut.dk>
Re: attach a file to an email using perl. HOW? (Colin Keith)
Re: autoresponder with customised message (Colin Keith)
Re: backtick with spaces on win32 <elephant@squirrelgroup.com>
Re: backtick with spaces on win32 undergronk@yahoo.com
Re: backtick with spaces on win32 undergronk@yahoo.com
Bowling Again [was: How to print the thousands comma .. <elephant@squirrelgroup.com>
Capturing info accross multiple pages in one form <andybarlow70NOanSPAM@hotmail.com.invalid>
Re: CGI and CSS, How in Apache ??? (Colin Keith)
CGI passing parameters <glodalec@yahoo.com>
Re: compiling perl on NT into an exec. <carvdawg@patriot.net>
Re: DBI/DBD version mismatch (Colin Keith)
Re: Directing screen output to a file! (Colin Keith)
File path, Select value, Redirect Basic ?’s mandbinc@rocketmail.com
Free CGI Perl script generator <abbey@REphotoMOneuVE.com>
Re: Gtk-Perl on Win32? <carvdawg@patriot.net>
Re: how do you ? question (Tim Hammerquist)
Re: How do you find the full name of the user in NT? <carvdawg@patriot.net>
Re: How to print the thousands comma for financial numb <brendon@shipreg.com>
Re: Install (Colin Keith)
Re: NetBIOS/nbname ??? <carvdawg@patriot.net>
Re: NetBIOS/nbname ??? <carvdawg@patriot.net>
Re: NetBIOS/nbname ??? <carvdawg@patriot.net>
Perhaps a dumb question... <beanNObeSPAM@agentkhaki.com.invalid>
Perl Scripts served by NT IIS4 / ActivePerl 5.6 cause N <john@wwit.freeserve.co.uk>
Re: pos() bug? <jarjar@starwars.com>
Re: text output file <elephant@squirrelgroup.com>
Re: This is driving me crazy!! (Tim Hammerquist)
Re: Why won't "use strict;" work? <Petri_member@newsguy.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 26 Jul 2000 10:25:58 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: <newbie> Html Tag generation
Message-Id: <W0zf5.18$DT4.1526940@nnrp2.clara.net>
In article <397E1A78.9B03AB4D@emich.edu>, Jeremiah.Megie@emich.edu wrote:
>Remember, I am kinda a newbie...I can edit perl files and such, but this is
>really the first program I have sat down and written, so it is probably more
>bulky than it needs to be. There are no databases, the script just writes to
>the html directory:
Its not bad. Not perfect, but then I'm positive people could pick holes in
my programs, so this is meant to be *constructive* critisism. Please take it
as suggestions on how to improve it, not to say its bad.
>#!/usr/bin/perl
Use the -w switch to this and the 'strict' module. You will find that it
will highlight a lot of common problems that can cause your code to go
astray:
#!/usr/bin/perl -w
use strict;
># Define some common variables
strict will force you to define the scope of all variables. Generally this
will be by defining them as lexical variables, so: my($path) = ...
>$path = "/home/httpd/html/resnet/announce.shtml";
you don't need double quotes as it forces the string to expand
variables within it, you have none so don't make extra work, single
quotation marks ( ' ) I.e '/home/colin' and "$home/colin"
>($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime
>(time);
>$year = 1900 + $year;
>$monthd ay = $mday + 0;
But you only use a couple of these, so rather than this, you can use commas
to separate the indexes of an array, thus:
my($year, $month, $day) = (localtime(time()))[5,4,3];
>@Days = ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
>"Saturday");
>@month = ("January", "February", "March", "April", "May", "June", "July",
>"August", "September", "October", "November", "December");
>$DayOfWeek = $Days[$wday];
>$Month = $month[$mon];
Again, these aren't needed, just get your value (localtime() should never
going to return a value that is out of the range 0-6, 0-11 so you're okay)
And better still you can reassign to the variables above:
$day = (qw(Sun Mon Tues Wednes Thurs Fri Satur))[$day] .'day';
#... etc ..
note the qw() function that quotes the words in the list making it look
slightly tidier (and yeah I pulled out the 'day' so it fitted on one
line:)
>read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
No checking that the contentlength env var exists/has a value, that the
request method is POST (GET won't set this), $buffer isn't defined, and you
don't check the return value of read(), or that the buffer contains the
number of characters you requested to be read. (In fact since its a CGI
script, that means content length is settable by the user so you should
check it isn't too long)
>@pairs = split(/&/, $buffer);
>foreach $pair (@pairs) {
> ($name, $value) = split(/=/, $pair);
> $value =~ tr/+/ /;
> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> $value =~ s/<([^>]|\n)*>//g;
> $value =~ s/<//g;
> $value =~ s/>//g;
> $FORM{$name} = $value;
>}
>print "Content-type: text/html\n\n";
Try using CGI.pm, it'll do all of this lot for you, but there is debate
about the need to load all the extra code for a few bits of it. (Personally
I don't use it)
># Print error page if a field is empty
>}
except that this doesn't stop here, so if neither name or announce are
filled in, you'll get an HTML page with two sets of header sections which is
bad HTML.
># Link the name and email
Maybe some checks for valid mail addressess. (Most) Mail addressess fit the
format username@domain.name. You can fiddle with Net::DNS to check the
validity of a domain name, but obviously can't check that the user exists.
It will deter junk addresses, but drop boxes are common on free services
Still.
$FROM{email} =~ /^([^@]+@([a-zA-Z0-9.-]+)+\.([a-zA-Z]{2,4})$/;
I think.. username@domain . tld where tld has to have more than 2 letters
(geographical TLD's are two letters: .uk, .fr, .us, etc.)
># Write the announcement to the announcement page
>open(FILE,"$path");
>@lines = <FILE>;
>close(FILE);
No check that the open() succeeds (you could write back nothing)
you load all of the file into memory and no file locking (you read, another
copy of the program writes to the file, you write your copy ... changes made
by the other copy is lost)
>open(FILE,">$path");
No checking if this fails/using locking/checkinf that it is the file you
think it is, not a symlink, etc. etc.
>foreach $line(@lines) {
> if (substr($line,0,10) eq "<!--add-->") {
I would suggest just if($line =~ /<!-- add -->/)
Note that HTML specs say comments must have spaces after <!-- and
before -->
> print FILE "<br>\n";
[snip]
Try passing an array to print. I.e.
print FILE "line1\n",
"line2\n",
"line3\n";
> else { print FILE "$line"; }
No need for the "'s, just:
print FILE $line;
will do fine
And to answer your other message in follow up to this comment:
| Jakob Schmidt <sumus@aut.dk>
| $text =~ s#$#<BR>#gm;
| $text =~ s#(<BR>\n){2,}#\n\n<P>#g;
| $text =~ s#(http://\S*[\w/])#<A href="$1">$1</A>#g;
He's refering to your $FORM{announce} code - the actual text that came
through in the text box. You could use:
$FORM{announce} =~ s#$#<BR>#gm;
"perldoc -q lock" will explain the locking code. If you don't use it your
page could disappear every so often.
hope it helps a little.
Col.
---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC
------------------------------
Date: 26 Jul 2000 13:09:54 +0200
From: Jakob Schmidt <sumus@aut.dk>
Subject: Re: <newbie> Html Tag generation
Message-Id: <r98h6tbx.fsf@macforce.sumus.dk>
Jeremiah Megie <Jeremiah.Megie@emich.edu> writes:
> I'm not sure how to incorporate the example you gave.
I suppose Colin answered that?
The substitutions will change input like
---
tuba mirum majestatis
typba gnudf http://dubag.com. Tybnafret.
Huba http://gnu.com aligevel.
gfnjr affe
afefeafefawef
awfwefwa
--- which someone might have written in your textarea thing
--- to output like
tuba mirum majestatis<BR>
typba gnudf <A href="http://dubag.com">http://dubag.com</A>. Tybnafret.<BR>
Huba <A href="http://gnu.com">http://gnu.com</A> aligevel.
<P>gfnjr affe<BR>
afefeafefawef
<P>awfwefwa<BR>
<BR>
--- which should be reasonable as html output.
--
Jakob
------------------------------
Date: Wed, 26 Jul 2000 10:35:58 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: attach a file to an email using perl. HOW?
Message-Id: <iazf5.19$DT4.1527182@nnrp2.clara.net>
In article <397DAA0F.1740476B@juno.com>, zephyrus9 <zephyrus9@juno.com> wrote:
>I already have a form mailer, but I would also like to attach a file to
>the mail that gets sent out. How might one do that with Perl? Is it
>even possible. Please help. Thanks.
>
>~Andy
That depends on what you're sending. If its the same file, ASCII encode it
and just read the file in and write to your mail process/SMTP
socket/sendmail object/whatever. UUEncoding is useful for that. MIME
attachments are the 'proper' way to send messages though.
Useful modules on CPAN:
Convert::UU and MIME::* and Mail::Sendmail
---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC
------------------------------
Date: Wed, 26 Jul 2000 10:48:30 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: autoresponder with customised message
Message-Id: <2mzf5.20$DT4.1527283@nnrp2.clara.net>
warn "!perl" if(strict 'refs')
:)
In article <8llo5b$q4m$1@nnrp1.deja.com>, drdementor@my-deja.com wrote:
>I know I will need a domain name. What kind of server support do i need?
>What is the code for this? will it just go into a bin and the perl code
>reads it like a file almost?
You don't need a domain name, they're not everything. You don't need server
support. What is the code for this is a bit of an open question.
>I need somewhere to start.
Decide how you want the system to run. Do you get an SMTP, POP3, or IMAP
mail transfer currently? If so you can use your address and run perl from
your computer to connect to your mailbox (or receive your SMTP mail if its
SMTP) and retrieve just the messages addressed to that address (if you can
collect multiple addresses) or with certain subject lines/whatever. There
are modules on CPAN <http://www.cpan.org/modules/> you can use that have all
of the protocol handling done for you, you just call the functions and deal
with the mail.
>If someone sends an email to the autoresponding address i would like to
>do something like,,, take the info from the email sent then manipulate
>it and send it back to them..
Again, look at CPAN it has modules for Email header retrevial that shouldn't
be too painful to use. (look in by-category/)
>I am not familiar with mail proticals i know that there are 2 main ones
>and a total of maybe 4.
POP3/SMTP are (I would suspect) the "2 main ones" that you're refering to.
There are others. IMAP4 is growing in popularity, but others are less used
on the Internet (Whereas on many Intranets the favourites I
believe are X400/Ccmail - Exchange/Lotus Notes .. ?) But you don't really
need to know about these, the modules on perl will allow you to retreive the
mail from your POP3 account and send it off again via SMTP.
>I need suggestions of a webserver to use, what do i need?
What's a webserver got to do with mail?
>I know i need perl cgi capabilitiess but im talking mainly email wise...
*web* <--------------> *mail*
My email never goes near a web server and perl has far greater uses than
just as a CGI script language.
I would suggest you look through the modules on CPAN, decide *exactly* what
you want to do, look through some of the examples in those modules and see
what they can let you do and how. You will no doubt find that you can pull a
few modules together to do what you want quite easily. .. Of course, if you
want to run a mailing list, I would suggest going for a package - MajorDomo
or some such.
---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC
------------------------------
Date: Wed, 26 Jul 2000 10:12:15 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: backtick with spaces on win32
Message-Id: <MPG.13e956d46f60dc0c98968e@news>
mikelot@my-deja.com writes ..
>How do you use the backtick operator in Win32 if there are embedded
>spaces in the path to the program? I tried a couple of ways, neither of
>which worked, shown below...
>
>----------
>$TST='c:\Program Files\Adobe\Reader\Acrord32.exe';
>$TST1='c:\\Program\ Files\\Adobe\\Reader\\Acrord32.exe';
>@l=`$TST`;
>@l=`$TST1`;
>
>----------
>06:20pm-~/scripts>perl tst_backtick.pl
>'c:\Program' is not recognized as an internal or external command,
>operable program or batch file.
>'c:\Program\' is not recognized as an internal or external command,
>operable program or batch file.
>06:20pm-~/scripts>
those errors should give you a clue .. but it's understandable that you
don't realise what's happening
all that the backticks do is pass whatever's inside them to the shell ..
so - you can think of it as whatever is inside the backticks (or
system() or exec() for that matter) gets typed at the command prompt out
in the system
what would happen if you typed
c:\Program Files\Adobe\Reader\Acrord32.exe
at the command prompt ?
what would you need to type instead ?
oops .. sorry - this is no longer a Perl question .. work out what you'd
type and stick that in the backticks
QED
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 26 Jul 2000 10:18:31 GMT
From: undergronk@yahoo.com
Subject: Re: backtick with spaces on win32
Message-Id: <8lmdtl$9iu$1@nnrp1.deja.com>
> mikelot@my-deja.com wrote:
>
> > How do you use the backtick operator in Win32 if there are embedded
> > spaces in the path to the program
In article <m34s5dwqk2.fsf@netaxs.com>,
Walt Mankowski <waltman@netaxs.com> wrote:
> For backwards compatibility with old DOS programs, NT gives every file
> with more than 8 characters another filename that does have 8 chars.
> There's an option on dir (sorry, I forget which one) that will show
> them to you.
Use the /X option on dir to give the short DOS names.
>
> "Program Files" is probably "PROGRA~1". so you could try to run
>
> $TST='c:\PROGRA~1\Adobe\Reader\Acrord32.exe';
>
The reason this doesn't work is that NT command line doesn't like
spaces in command names. If you type
c:\> c:\program files\adobe\reader\acrord32.exe
you will get an error.
But there are ways to do this if you don't mind contortions to get
round NT's limitations.
The DOS cd command will accept spaces in directory names, and most
programs will accept a path to a file as a command line option. This
can have spaces in it too, if it is double-quoted.
Here is an example using NT 'more'
#!/where/is/perl -w
use strict;
my $ProgDir = "c:\\winnt";
my $FileDir = "c:\\program files\\";
my $TestFile = "errs2.txt";
my $TestProg = "more < ";
my $FilePath = $FileDir.$TestFile;
chdir $ProgDir;
my $i = qx{$TestProg "$FilePath"};
print $i;
(if the command string has quotes in it - like with the 'find' command
- Perl or I get confused ;-)
HTH
Scott Kirk
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 26 Jul 2000 10:49:38 GMT
From: undergronk@yahoo.com
Subject: Re: backtick with spaces on win32
Message-Id: <8lmfo1$anb$1@nnrp1.deja.com>
> In article <m34s5dwqk2.fsf@netaxs.com>,
> Walt Mankowski <waltman@netaxs.com> wrote:
> > For backwards compatibility with old DOS programs, NT gives every
file
> > with more than 8 characters another filename that does have 8 chars.
> > $TST='c:\PROGRA~1\Adobe\Reader\Acrord32.exe';
In article <8lmdtl$9iu$1@nnrp1.deja.com>, undergronk@yahoo.com wrote:
> The reason this doesn't work is that
^^^^^^^^^^^^^^^^^^^^^^^^^
I've read this back, and it sounds like I am disagreeing with Walt.
I'm not. His solution does work.
I was trying to explain why mikelot's original command didn't work.
Sorry if that wasn't clear.
Scott Kirk
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 26 Jul 2000 12:10:57 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Bowling Again [was: How to print the thousands comma ... ]
Message-Id: <MPG.13e972a924e41d02989691@news>
Brendon Caligari writes ..
>"Louis Banens" <louis.banens@xs4all.nl> wrote in message
>news:8lm8oo$9b3$1@porthos.nl.uu.net...
-
>> I cannot find out how to print the thousands comma for financial numbers
>> $12,8292.75).
>>
>> Any ideas ?
-
>if you divide by a thousand and use the int() function
>you will get the 'thousands'. You can write a function
>that returns a prettified string representing the money.
are we bowling again ?
(ignoring the OP's example that shows a "ten-thousands" comma) how about
the following bowl
my $input = 128282.75;
my($dollars,$cents) = split /\./ => $input;
my @orig = split //, reverse $dollars;
my @result = @orig[0..2];
for( my $i = 3; $i <= $#orig; $i+=3)
{
push @result => ',', @orig[$i..$i+2];
}
my $output = '$'. join( '', reverse @result). '.'. $cents;
>I have never done anything of the sort myself, because
>I never came across amounts that exceed at most a few
>hundred dollars
keep coding without glancing at the documentation and you never will ..
boom boom !!
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 26 Jul 2000 03:57:31 -0700
From: Andy Barlow <andybarlow70NOanSPAM@hotmail.com.invalid>
Subject: Capturing info accross multiple pages in one form
Message-Id: <00411366.71900778@usw-ex0104-025.remarq.com>
I have 3 pages that follow each other that capture information.
I want all the info to be captured on one form. Any ideas how
to do this?
The pages are http://www.justinsurancejobs.co.uk/cvsubmit1.htm
thru cvsubmit3.htm
Cheers
-----------------------------------------------------------
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
------------------------------
Date: Wed, 26 Jul 2000 11:14:32 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: CGI and CSS, How in Apache ???
Message-Id: <sKzf5.21$DT4.1527926@nnrp2.clara.net>
warn "!perl";
In article <8lkc3d$oj8$1@nnrp1.deja.com>, John van V <john@thinman.com>
wrote:
>But apache appears to be looking for the CSS file in the cgi directory,
>where of course it cant be seen by the UA(netscape).
Apache will look where your browser requests it from. Obviously you can
change the location through rewrites/redirects/Files/FilesMatch, etc. etc,
but all of this has nowt to do with Perl.
>I tried to put it in the html directory but it didn't get it there either.
Look in the error log for the file its requesting. Your browser will
generate the request based on whatever code is in your HTML. Again, this is
a configuration/HTML coding problem. (Perhaps you've just requested
style.css when you've requested /cgi-bin/blah if so, try it with a fully
qualified filename, I.e. /style.css) Still, this is a question for the
HTML/CGI authoring groups as it contains nothing about Perl.
---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC
------------------------------
Date: Wed, 26 Jul 2000 14:18:07 +0200
From: Mouse <glodalec@yahoo.com>
Subject: CGI passing parameters
Message-Id: <397ED6FF.4BF@yahoo.com>
Hi !
I have main CGI script called MAIN. It receive two parameters,
file and num (/cgi-bin/MAIN?file=myfile&num=100)
#!/usr/local/bin/perl
use CGI qw/:standard/;
$file=param('file');
$num=param('num');
...
@ARRAY=`/cgi-bin/GETFILE';
foreach $X (@ARRAY)
{
print $X;
}
...
As you have noticed, I call another perl program called GETFILE.
How can I pass parameters from MAIN to GETFILE ?
I don't like
'/cgi-bin/GETFILE ' . $file . ' ' . $num
and then asking for ARGV[]
If its possible, I would like to use the same param('<name>') in
GETFILE.
Any hints ?
Alex
------------------------------
Date: Wed, 26 Jul 2000 07:05:58 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: compiling perl on NT into an exec.
Message-Id: <397EC615.6CCB1838@patriot.net>
www.perl2exe.com
victor@daemos.com wrote:
> Hi,
> I know this is possible, but I can't seem to find any reference to
> this on the internet. I want to compile a perl script that i currently
> have workin on perl for NT into an executable so I don't need the
> interpreter. Does anybody know where I get the files to do this?
>
> thanks..
>
> -victor
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Wed, 26 Jul 2000 11:44:43 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: DBI/DBD version mismatch
Message-Id: <LaAf5.22$DT4.1528676@nnrp2.clara.net>
In article <vlcrnsskdi2kd5dvo3njgb1q2jr1ulqike@4ax.com>, Eli Napchan <eli@napchan.com> wrote:
>When I run a script that used and which uses an mSQL database I get
>the following two errors:
>1. DBI/DBD internal version mismatch (DBI is v94/s108, DBD mSQL.xsi
>expected v93/s108) you probably need to rebuild the DBD driver (or
>possibly the DBI).
>2. install_driver(mSQL) failed: [Tue Jul 25 16:30:02 2000] dbu.pl:
>DBI/DBD internal version mismatch (DBI is v94/s108, DBD mSQL.xsi
>expected v93/s108) you probably need to rebuild the DBD driver (or
>possibly the DBI). at /usr/local/etc/httpd/cgi-bin/dbu.pl line 50
>
>The problem is that I do not know which modules need to be updated,
The ones it is telling you, DBI and DBD. DBI is an interface to the various
modules for specific databases, the DBD is the database driver, so if its
msql you'll need the msql/Mysql DBD module:
http://www.cpan.org/modules/by-module/DBD/DBI-1.14.tar.gz
http://www.cpan.org/modules/by-module/DBD/Msql-Mysql-modules-1.2214.tar.gz
To reinstall them you'll probably need to be root since they're installed
into the standard perl directories (by default). Get your admin to install
them if you don't have access.
---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC
------------------------------
Date: Wed, 26 Jul 2000 11:47:27 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: Directing screen output to a file!
Message-Id: <jdAf5.23$DT4.1528545@nnrp2.clara.net>
In article <397DD1D9.9C10BC52@texas.net>, Tom Briles <sariq@texas.net> wrote:
>Horse Nuts wrote:
>> How do I go about directing screen output to a file????
Another dedicated perl developer who takes time to give detailed accurate
information.
>open() it.
and select() it ... then you don't even need to print to the filehandle ..
unless of course you're talking about duplicating a file descriptor, in
which case see man perlfunc.
---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC
------------------------------
Date: Wed, 26 Jul 2000 12:44:11 GMT
From: mandbinc@rocketmail.com
Subject: File path, Select value, Redirect Basic ?’s
Message-Id: <8lmmeq$f8i$1@nnrp1.deja.com>
1. I have an HTML file with a form. When the user presses a submit
button a Perl script is executed. In my Perl script I need to know the
name and path of the HTML file that calls the Perl script (the HTML
file will vary). I my Perl file I will be opening the HTML file and
replacing some data (parsing and re-writing). How can I find out the
file to open (in my Perl file I set this equal to $file_dir). I need
to know this at the start of my Perl script so I can open the file and
read its contents into @filedata.
2. IN the HTML form file, I have a select command (NAME=”select”). I
want to set a variable ($select_value) in my Perl file equal to the
option value selected by the user in the HTML file. I though I could
use: $select_value=param(‘select’) at the start of my Perl file, but
it does not work. How can I do this?
3. After my Perl script executes, I want to return to the original HTML
file the user started from (although it will be updated with the new
data). Again this file will vary, but I will know the name within the
Perl file (if someone helps me with number one above). How can I end
my Perl file with a command that returns to this HTML file – the name
of this file is $file_dir in my Perl script.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 26 Jul 2000 15:44:41 +0300
From: "Paul" <abbey@REphotoMOneuVE.com>
Subject: Free CGI Perl script generator
Message-Id: <01bff6f5$4df84580$021ea8c0@brrrrrrrrrrrrr>
http://zzee.com/cgi-bin/cgiProj.cgi
ZZEE CGI Project is the software that helps building CGI Perl scripts and
ancillary html files via visual easy-to-follow interface with many
customizable options. It can generate CGI Perl scripts from web URL, html
disk file or from scratch.
No perl programming skills are necessary to use included wizard, which
creates fully functional script that sends contents of the form by email.
From professional point of view, the main purpose of the program is mapping
CGI input parameters into Perl namespace and automation of some routine
operations.
------------------------------
Date: Wed, 26 Jul 2000 07:02:45 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: Gtk-Perl on Win32?
Message-Id: <397EC555.B66CF556@patriot.net>
Matt,
Personally, I use ActiveState's Perl w/ the Tk module. I'm not sure if
that's
what you're looking for...I've been stuck in the Win32 world for quite a
while...
Matthew Emmett wrote:
> Hi all,
>
> I know one can get Gtk running on Windows. And I also know that one
> can get perl running on Windows. So, can one get Gtk-Perl running on
> Windows? If it can't be done right now, where might I start hacking?
>
> The Makefile.PL of Gtk-Perl smells like unix, so I wonder how
> difficult it would be to get it going on Windows.
>
> Thanks for any suggestions or comments,
> Matt
------------------------------
Date: Wed, 26 Jul 2000 11:51:00 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: how do you ? question
Message-Id: <slrn8ntkm5.5ls.tim@degree.ath.cx>
On 26 Jul 2000 09:10:34 GMT, The WebDragon <nospam@nospam.com> wrote:
>In article <8g2snscjl8veppgaguo6iumdiksnpgla9m@4ax.com>, Chris
><exit72@excite.com> wrote:
>
> | Thanks to all those who responded with something useful.
> |
> | The answer to your question , I've been watching this group for a long
> | long time and I'm disgusted with the garbage replies from people that
> | have no intention of helping. Instead of someone posting a plain
> | answer to a question or an example they would rather go off and
> | explain in detail why they know the answer but aren't willing to share
> | it , but oh here is a link to the manual that will explain. Morons
> | like that miss the point , we've already been through the doc pages
> | with no luck if you see a post here.
>People here WILL help you to make corrections and/or improvements to
>your code, provided you can be clear and concise about what the problem
>is. Evidence to the contrary (i.e. when it's obvious you need to find a
>clue first) get you pointed to the right place. perldoc.
If people ask nicely (with code and error msgs), we will probably help them out
of the kindness of our (cold, dark, forbidding) hearts. As for myself,
Bill Gates himself could post broken code and I'd fix it so I wouldn't have
to look at it. =)
> all the necessary explaining HAS ALREADY BEEN DONE IN THE DOCS
(... Just in case this didn't get through the first time.)
>I'm here to LEARN and if that means that I need to do some studying ON
>MY OWN in some cases, so be it.
<Rant>
Many on this list are self-taught, myself included. I've worked hard and
bought enough dead-tree manuals...
<Snipped type="rant" style="indignant" class="I still have some?!" />
</Rant>
</Beat_a_dead_horse>
--
-Tim Hammerquist <timmy@cpan.org>
Emacs is a nice OS - but it lacks a good text editor.
That's why I am using Vim. --Anonymous
------------------------------
Date: Wed, 26 Jul 2000 07:16:36 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: How do you find the full name of the user in NT?
Message-Id: <397EC894.756D4B81@patriot.net>
Win32::Lanman
See: http://patriot.net/~carvdawg/perl.html
The "null.pl" script has example code...
s24673 wrote:
> Thanks for all the answers. I was trying to use this in Perl. However, the
> function Win32::Usergetattributes does not return the full name. Is there an
> alternative I can use?
>
> Clay Calvert <ccalvert@WanGuru.com> wrote in message
> news:o91insot8kc2qu4khrlfcbsvnefr90p6t9@4ax.com...
> > On Fri, 21 Jul 2000 07:41:04 GMT, f.wegener.nospam@bornundpartner.com
> > (Frank Wegener) wrote:
> >
> > >On Fri, 21 Jul 2000 07:24:41 GMT, wschulz@nospam_matrix42.de (Walter
> > >Schulz) wrote:
> > >
> > >>>You can find out the "full name" of the user in UNIX using NIS. Is
> there an
> > >>>equivalent in Win NT?
> > >>
> > >>Server only Included in the Windows NT Server, but not
> > >>Workstation, Resource Kit.
> > >
> > >Sorry, but if I type "net user <username>" on a command-prompt, I get
> > >to see all of this, too. Admittedly, I type it on a BDC, but the "net"
> > >command should be identical for a WS.
> > >
> > >Frank
> >
> > "net user <username> /domain" works, but only for the domain that you
> > are logged into. I guess that is what you call a feature. : )
> >
> > Clay Calvert
> > Replace the "W" in my e-mail address with an "L" to reply.
------------------------------
Date: Wed, 26 Jul 2000 13:59:41 +0200
From: "Brendon Caligari" <brendon@shipreg.com>
Subject: Re: How to print the thousands comma for financial numbers ( $ 12,8292.75)
Message-Id: <8lmge1$sd3$1@news.news-service.com>
"Louis Banens" <louis.banens@xs4all.nl> wrote in message
news:8lm8oo$9b3$1@porthos.nl.uu.net...
> Hi,
>
> I cannot find out how to print the thousands comma for financial numbers
$
> 12,8292.75).
>
> Any ideas ?
>
> Regards,
>
> Louis Banens
>
>
if you divide by a thousand and use the int() function
you will get the 'thousands'. You can write a function
that returns a prettified string representing the money.
I have never done anything of the sort myself, because
I never came across amounts that exceed at most a few
hundred dollars
The Brendon
------------------------------
Date: Wed, 26 Jul 2000 11:53:26 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: Install
Message-Id: <WiAf5.24$DT4.1528843@nnrp2.clara.net>
In article <37uf5.685$fV5.18310@newscontent-01.sprint.ca>, "Glen Heide" <jheide@sprint.ca> wrote:
>How do you install a module using telnet?
*blank look*
You don't. FTP it from a CPAN mirror or use the provided programs like
oonix% perl -MCPAN -e shell
I think windows has a program called ppm ?
---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC
------------------------------
Date: Wed, 26 Jul 2000 07:11:22 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: NetBIOS/nbname ???
Message-Id: <397EC75A.785C22BA@patriot.net>
You can do most of this stuff in Perl using the Win32::Lanman module. An excellent
example of this can be found at:
http://patriot.net/~carvdawg/perl.html
Look for the script called "Null.pl"...it performs null session enumeration.
> : print "file:///%43|%2f";
[snip]
>
> very interesting.
> now, how do u do it in perl ?
------------------------------
Date: Wed, 26 Jul 2000 07:12:56 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: NetBIOS/nbname ???
Message-Id: <397EC7B8.D4566753@patriot.net>
> Actually, if he's getting the name of my computer then it isn't a
> "Windows" thing called NetBIOS, it's a DNS thing called a PTR record.
> Just like I said.
Actually, it depends how he's doing it...if he's using Perl or some scripting
language
to launch nbtstat or nmblookup, then it's a NetBIOS thing. If he's using
gethostby*()
then it's a DNS thing.
------------------------------
Date: Wed, 26 Jul 2000 07:13:57 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: NetBIOS/nbname ???
Message-Id: <397EC7F5.2A6B11E3@patriot.net>
What do you mean, "there is no Windows thing to ask for it"?
John Stanley wrote:
> In article <MPG.13e781398895beb7989688@news>,
> jason <elephant@squirrelgroup.com> wrote:
> >(and just quietly .. IF he got YOUR system name then it would also a
> >Windows thing over NetBIOS because that's the ONLY way he (Steve Gibson)
> >tries to get system names on the web site mentioned by the originator ..
>
> Well, apparently not, since he got the system name and there is no
> Windows "thing" to ask for it.
------------------------------
Date: Tue, 25 Jul 2000 20:36:42 -0700
From: bean <beanNObeSPAM@agentkhaki.com.invalid>
Subject: Perhaps a dumb question...
Message-Id: <1431013e.0f08517b@usw-ex0105-034.remarq.com>
Okay, here goes.
Basically, I'm using Perl to generate a series of HTML files
based on input information provided by the user in a text file.
I've got it all down except for one thing in the following line
of code:
open (LISTINGS_FILE, '> listings.html');
This works for the file 'listings.html' but what if I want to
open other files... the names of which are provided by the user?
I tried this:
$use_file = 'listings.html';
open (LISTINGS_FILE, '> $use_file');
and several variations thereof, but nothing seems to work. What
I'm looking to do, in case it isn't fairly obvious, is to create
files of the name that the user specifies... My question is, is
there any way of doing this? I might be missing something fairly
obvious, but I read through the information I had and could find
no information/examples of this being done.
Thanks for any and all help.
-----------------------------------------------------------
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
------------------------------
Date: Wed, 26 Jul 2000 11:36:32 +0100
From: "john wooding" <john@wwit.freeserve.co.uk>
Subject: Perl Scripts served by NT IIS4 / ActivePerl 5.6 cause Netscape to display "File - Save As" Dialog rather than viewing Perl output
Message-Id: <8lmf5j$iok$1@newsg3.svr.pol.co.uk>
This is a problem of interaction between NT IIS 4 and Netscape 4.5 or 4.7
:
When the following form header is included and the form submitted Netscape
inquires how
mlogin2.pl should be saved. This does not happen when IIS4 is serving to IE4
or 5 and does not
happen when other servers are serving to Netscape 4.5/4.7 (these are the
only two versions we currently have
tried).
<form name="g" action="/cgi-bin/mlogin2.pl" method="GET"
ENCTYPE="application/x-www-form-urlencoded">
This problem occurs with all script references. When NT is setup to
recognise .cgi is to be processed by Perl
then this also happens with .cgi references.
Any suggestions?
------------------------------
Date: Wed, 26 Jul 2000 08:51:12 -0400
From: "The Binskter" <jarjar@starwars.com>
Subject: Re: pos() bug?
Message-Id: <8lmmt8$99d$1@slb6.atl.mindspring.net>
> Of course, $x is a new copy of $foo, so its pos() is empty.
>
> I think you are hoping that with m// you can initialize your subroutine
> in a sneaky way. This is making your logic a bit convoluted and fragile.
Not the first time I have been told this. ;->
> Why not do this?
>
> my @positions = allpos("fie fie foe fum", qr/f/);
>
> sub allpos {
> my ($x, $regex) = @_;
> my @p;
> while ($x =~ m/$regex/g) {
> push @p, pos($x);
> }
> return @p;
> }
>
Worked like a charm, except for one thing. The part of the comment that
separates this from a usual HTML comment is the pipe character |. So I am
actually searching for <!--|. So my search substring is actually this now:
"<!--\\\|" The only way I found to get it to work. Maybe I should change
it to the [ character....
Anyway, thanks for your help. That solved my problem.
Bink
------------------------------
Date: Wed, 26 Jul 2000 10:20:16 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: text output file
Message-Id: <MPG.13e958b61efeafcb98968f@news>
Sarah writes ..
>I need to be able to save the top ten scores in a game. I have already
>created the code in FLASH that will read from a text file and insert the
>proper info if a new top ten score is made. The information is sorted in
>Flash and is ready for output to a TEXT.TXT file.
>
>What I need help with is with a CGI program and info so that I can output
>the following example text to a plain text file OVERIDING the previous text
>if its there.
>
>score1=10000&name1=Steve Jones&email1=steve@server.com
>&score2=9000&name2=Sarah&email2=sarah@server.com
>&score3=8000&name3=Mike Jones&email3=mike@server.com
>&score4=7000&name4=Sue Smith&email4=sue@server.com
>&score5=6000&name5=Harry James&email5=harry@server.com
>&score6=5000&name6=Sarah Chism&email6=sarah@server.com
>&score7=4000&name7=Mike Jones&email7=mike@server.com
>&score8=3000&name8=Sue Smith&email8=sue@server.com
>&score9=2000&name9=Harry James&email9=harry@server.com
>&score10=1000&name10=Harry James&email10=harry@server.com
>
>Please help if you know of a CGI / PERL program that is suited for this and
>quik sample code for the output. Any other help is appreciated.
#!/usr/bin/perl -w
use strict;
require 5.005;
use CGI;
open OUT, ">TEXT.TXT" or die "Bad open: $!";
print OUT<<'__EOI';
score1=10000&name1=Steve Jones&email1=steve@server.com
&score2=9000&name2=Sarah&email2=sarah@server.com
&score3=8000&name3=Mike Jones&email3=mike@server.com
&score4=7000&name4=Sue Smith&email4=sue@server.com
&score5=6000&name5=Harry James&email5=harry@server.com
&score6=5000&name6=Sarah Chism&email6=sarah@server.com
&score7=4000&name7=Mike Jones&email7=mike@server.com
&score8=3000&name8=Sue Smith&email8=sue@server.com
&score9=2000&name9=Harry James&email9=harry@server.com
&score10=1000&name10=Harry James&email10=harry@server.com
__EOI
close OUT or die "Bad close: $!";
print CGI::header(), CGI::start_html(), "Done", CGI::end_html();
__END__
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 26 Jul 2000 11:01:32 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: This is driving me crazy!!
Message-Id: <slrn8nthpe.5ls.tim@degree.ath.cx>
>ivolla@my-deja.com wrote:
>> I am using windows 98, Perl 5
Here is your first problem... ;) To be honest tho, I have Win98
installed on my PC. That drive is divided into three parts:
1) data that can be accessed with any app. (mostly just MP3s nowadays)
2) apps that can run under wine (and usually aren't run anyway)
3) apps that can't run under wine (and haven't been run for months)
On Wed, 26 Jul 2000 10:07:01 +0200, Marco Natoni <foo@bar.va> wrote:
>and then use it like a
>deprecated-old-text-based-non-ActiveX-too-Unix-like-where-is-my-animated-
>pointer?-TTY-shell...
There's another kind? ;)
> Try, for example, to type in the line
> C:\PERL\BIN> perl hello.pl
>
>and it will work, remaining the IT-greeting on the screen as long as you
>want.
Also, if you go through the trouble to create a "shortcut" for a
specific script, there should be a checkbox in the properties dialog box
labeled "Close on Exit". Uncheck it and it will leave the results on the
screen.
--
-Tim Hammerquist <timmy@cpan.org>
Emacs is a nice OS - but it lacks a good text editor.
That's why I am using Vim. --Anonymous
------------------------------
Date: 26 Jul 2000 01:29:50 -0700
From: Petri Oksanen <Petri_member@newsguy.com>
Subject: Re: Why won't "use strict;" work?
Message-Id: <8lm7hu$69j@edrn.newsguy.com>
In article <Pine.GHP.4.21.0007252112130.19901-100000@hpplus03.cern.ch>, "Alan
says...
>> Knowledge comes from learning, not from DNA, so everyone must
>> have been a beginner at some point. Even you.
> Oh, shucks, do we have to go through this every time? Nobody's
> born a brain-surgeon, but if you want to do brain-surgery, then
> there are certain pre-requisites before you are let loose.
All I'm saying is; Be nice.
This group has its fair share of lazy morons dropping in asking stupid questions
and then running off again, but that doesn't mean you can treat every newcomer
with obvious newbie questions like a moron.
Just lay off with the sarcastic remarks towards people who may be struggling to
get a grip on Perl.
If you can't muster a non-demeaning reply, just don't bother.
Leave it to someone else who's having a better day than you, otherwise you are
setting a tone in the group that isn't pleasant.
Petri Oksanen
------------------------------
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 3807
**************************************