[17456] in Perl-Users-Digest
Perl-Users Digest, Issue: 4876 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 13 06:05:52 2000
Date: Mon, 13 Nov 2000 03:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <974113510-v9-i4876@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 13 Nov 2000 Volume: 9 Number: 4876
Today's topics:
Re: "Programming Perl" <cingram-at-pjocs-dot-demon-dot-co-dot-uk>
[Newbie] use Oraperl compilation error ! <sferrandez@wineandco.com>
Re: A surprise with vec() (Gwyn Judd)
Re: A surprise with vec() <bart.lateur@skynet.be>
Re: activeperl: reading registry (Gwyn Judd)
Re: activeperl: reading registry <carvdawg@patriot.net>
CGI/Perl datastream passthru (newbie?) (dionysus)
display shell alias in perl? <tsailipu@home.com>
Re: display shell alias in perl? <quantum_mechanic@my-deja.com>
Re: display shell alias in perl? (Rafael Garcia-Suarez)
Free Online Sample Certification Questions cd_root@my-deja.com
Re: Help with HTML::Parser module (Niklas Frykholm)
Help with regexp <a58289@yahoo.com>
Re: Help with regexp <josef.moellers@fujitsu-siemens.com>
Re: Help with regexp (Gwyn Judd)
Re: Help with regexp <quantum_mechanic@my-deja.com>
Re: Help with regexp <a58289@yahoo.com>
Re: HELP!! MIME attached file (Colin Watson)
Re: How to force MSDOS window to stay open after perl? <ubl@schaffhausen.de>
Link - the action after "?" <calvin_newsgroup@hotmail.com>
need a little help <briansv@bellsouth.net>
Re: need a little help (Philip Lees)
Re: need a little help <quantum_mechanic@my-deja.com>
Re: New to perl - Problems with Labels ! Please Help. <quantum_mechanic@my-deja.com>
Re: Pushing a hash on to a stack... <bart.lateur@skynet.be>
Re: Returning an array from C to Perl <vidulats@yahoo.co.uk>
Re: Returning an array from C to Perl (Anno Siegel)
Re: Returning an array from C to Perl <bart.lateur@skynet.be>
Re: running telnet automatically <not.my.real.email@bellglobal.com>
Re: running telnet automatically <mikecook@cigarpool.com>
Sysread and 0x0A rpanman@my-deja.com
Re: use-ing .pm file from different dir <ubl@schaffhausen.de>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 13 Nov 2000 10:10:10 -0000
From: "Clyde Ingram" <cingram-at-pjocs-dot-demon-dot-co-dot-uk>
Subject: Re: "Programming Perl"
Message-Id: <974109800.27588.0.nnrp-13.9e98e5bc@news.demon.co.uk>
> Brand New Condition, Asking $25
I bought my mint condition, brand new copy from a bookshop in Avon, CT, last
August for $4.
(OK, the shop was closing down, and this book was in the 90% discount crate
. . .)
Clyde
------------------------------
Date: Mon, 13 Nov 2000 10:35:45 +0100
From: =?iso-8859-1?Q?S=E9bastien?= Ferrandez <sferrandez@wineandco.com>
Subject: [Newbie] use Oraperl compilation error !
Message-Id: <3A0FB5F0.3AB5313E@wineandco.com>
I get a message error when trying to launch a script directly from the
command prompt.
I thought it was a matter of env variables that the user didn't know,
fixed it and it's always the same.
Now it's giving me the "use Oraperl;use Mail::Mailer;" line as
uncorrect....argh ! What am I to do ?
/usr/local/bin/pense_bete.pl
Compilation failed in require at /usr/local/bin/pense_bete.pl line
6.
BEGIN failed--compilation aborted at /usr/local/bin/pense_bete.pl
line 6.
1 #!/usr/local/bin/perl
2
3 # Script envoyant les reminders en fonction de la date du jour
4 # Ecrit par Sebastien Ferrandez le 24/25 Octobre 2000
5
6 use Oraperl;use Mail::Mailer;
7
8 # variables d environnement
9
10 BEGIN {
11 $ENV{ORACLE_HOME} = '/path/to/oracle/product/8.0.6'
unless $ENV{ORACLE_HOME};
12 $ENV{ORACLE_SID} = 'my_sid' unless $ENV{ORACLE_SID};
13 $ENV{LC_TIME} = 'fr';
14 };
--
-----------------------------------------------------------
Errare humanum est, perseverare diabolicum.
------------------------------
Date: Mon, 13 Nov 2000 05:28:23 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: A surprise with vec()
Message-Id: <slrn90uuvl.rv1.tjla@thislove.dyndns.org>
I was shocked! How could Martien Verbruggen <mgjv@tradingpost.com.au>
say such a terrible thing:
>unpack and vec work on the string part of a scalar. A perl scalar has
>an integer part, and a string part, and Perl will convert on the fly.
Dear god. I don't know if I should feel enlightened or appalled :) The
documents should spell that out a bit more explicitly I think. Oh well I
think I can say I sort of understand vec, pack and unpack now.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Life is a sexually transmitted disease with 100% mortality.
------------------------------
Date: Mon, 13 Nov 2000 10:51:52 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: A surprise with vec()
Message-Id: <2shv0tkk94dvtt708g76h2vola6tvp9fur@4ax.com>
Gwyn Judd wrote:
>$x = 0;
>print unpack 'b*', $x;
>
>This prints:
>
>00001100
>
>Help me out here.
$x = "0";
print ord $x;
--
Bart.
------------------------------
Date: Mon, 13 Nov 2000 05:31:31 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: activeperl: reading registry
Message-Id: <slrn90uv5g.rv1.tjla@thislove.dyndns.org>
I was shocked! How could gb <gbnews@arcticmail.com>
say such a terrible thing:
>You Linux snobs cannot see past your own bias.
How is this related to Perl again exactly?
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
The world is divided into people who do things and people who get
the credit.
-Dwight Whitney Morrow
------------------------------
Date: Mon, 13 Nov 2000 05:46:49 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: activeperl: reading registry
Message-Id: <3A0FC699.45BF2FD7@patriot.net>
> In ten years it might become as lean and mean as win95
> on a pc.
> You Linux snobs cannot see past your own bias.
> ;->
Whoa! Chill, dude...it's just a _joke_.
------------------------------
Date: Mon, 13 Nov 2000 07:16:01 GMT
From: dionysus39@hotmail.com (dionysus)
Subject: CGI/Perl datastream passthru (newbie?)
Message-Id: <3a0f9392.42747359@nntp.unsw.edu.au>
I am currently getting into writing state-based Perl/CGI scripts.
Having just completed one that searches an existing file containing a
list of files (some on my machine, some on other machines on my LAN),
and returns all matches as HTML links that are valid for all machines
on my LAN, I was now hoping to allow machines outside of my LAN access
to the same resources. I was hoping to do this (for the machines that
are not mine) by using a similar seach engine as I used for my
previous project, but instead of displying a page of valid HTML links
as results, displaying a form that, when a single file is chosen,
would trigger the script to request that file from across the LAN and
pass it (as a download) to the requesting machine. I was hoping to be
able to do this without storing that file on my own disk space, just
in memory. Is it possible to do this kind of a passthrough in a perl
script, and if so, what functions/modules would I need to use?
All advice much appreciated,
-d
------------------------------------------------------------
"One World, one Web, one Program" - Microsoft promotional ad
"Ein Volk, ein Reich, ein Fuhrer" - Adolf Hitler .
------------------------------
Date: Mon, 13 Nov 2000 08:35:36 GMT
From: "Philip Tsai" <tsailipu@home.com>
Subject: display shell alias in perl?
Message-Id: <sJNP5.416326$i5.7130668@news1.frmt1.sfba.home.com>
Hi all,
This looks to be a simple operation yet I spent hours reading documentation
and searching using different combinations of keywords on www.perl.com,
google and other search engines to no avail: how can one assign the value
of a shell "alias [some alias name]" inside a Perl program?
use Shell;
$output=alias("an_alias"); # assuming an_alias is an existing alias;
or
$output=`alias an_alias`
simply doesn't work....
I also tried many combinations of system() and exec() calls but still
no luck so far.... If anyone knows the solution to this operation, I will
greatly
appreciate if you can help shed some lights.
Thanks much!
Philip
------------------------------
Date: Mon, 13 Nov 2000 09:23:30 GMT
From: Quantum Mechanic <quantum_mechanic@my-deja.com>
Subject: Re: display shell alias in perl?
Message-Id: <8uobuf$e7m$1@nnrp1.deja.com>
In article <sJNP5.416326$i5.7130668@news1.frmt1.sfba.home.com>,
"Philip Tsai" <tsailipu@home.com> wrote:
> Hi all,
>
> This looks to be a simple operation yet I spent hours reading
documentation
> and searching using different combinations of keywords on
www.perl.com,
> google and other search engines to no avail: how can one assign the
value
> of a shell "alias [some alias name]" inside a Perl program?
>
> use Shell;
> $output=alias("an_alias"); # assuming an_alias is an existing alias;
>
> or
>
> $output=`alias an_alias`
>
> simply doesn't work....
>
> I also tried many combinations of system() and exec() calls but still
> no luck so far.... If anyone knows the solution to this operation, I
will
> greatly
> appreciate if you can help shed some lights.
>
> Thanks much!
> Philip
>
>
[insomniac loose...]
The shell you run the script in is not necessarily the same shell you
get with backticks or system or exec. Would that make a difference?
I would try some ideas out, but I don't have my *nix box handy.
If `alias my_alias` does not work, you might try `which my_alias` to see
what it gives you. You might also try `%ENV{SH} -c alias my_alias` (I
can't remember the syntax for that, and it's probably different for each
shell).
You might call your script with an alias:
alias foobar 'alias >/tmp/.foobar_alias;my_foobar;rm
/tmp/.foobar_alias'
where my_foobar is your Perl script. It can then read the file in and
search for the alias.
-QM
--
Quantum Mechanics: The dreams stuff is made of.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 13 Nov 2000 11:00:33 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: display shell alias in perl?
Message-Id: <slrn90vig2.8qn.rgarciasuarez@rafael.kazibao.net>
Philip Tsai wrote in comp.lang.perl.misc:
>Hi all,
>
>This looks to be a simple operation yet I spent hours reading documentation
>and searching using different combinations of keywords on www.perl.com,
>google and other search engines to no avail: how can one assign the value
>of a shell "alias [some alias name]" inside a Perl program?
>
>use Shell;
>$output=alias("an_alias"); # assuming an_alias is an existing alias;
The Shell.pm module will execute commands, i.e. executables that live on
your filesystem (typically in /bin and /usr/bin). alias is not a
command, it's a shell builtin.
>or
>
>$output=`alias an_alias`
>
>simply doesn't work....
>
>I also tried many combinations of system() and exec() calls but still
>no luck so far.... If anyone knows the solution to this operation, I will
>greatly
>appreciate if you can help shed some lights.
Backticks spawn a '/bin/sh -c' on most unixes. This just doesn't happen
to source the files where your aliases are defined. See your sh(1)
manpage for details.
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Mon, 13 Nov 2000 06:55:37 GMT
From: cd_root@my-deja.com
Subject: Free Online Sample Certification Questions
Message-Id: <8uo399$7fa$1@nnrp1.deja.com>
We've just added more questions to our free online database of sample
certification questions.
MCSE questions are located at
http://www.networkessentials.com/certified/mcse
OCP questions are located at:
http://www.networkessentials.com/certified/ocp
CSA questions are located at:
http://www.networkessentials.com/certified/sca
OpenVMS questions are located at:
http://www.networkessentials.com/certified/vms
Perl questions are located at:
http://www.networkessentials.com/certified/perl
jc
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 13 Nov 2000 09:02:04 GMT
From: r2d2@shaka.acc.umu.se (Niklas Frykholm)
Subject: Re: Help with HTML::Parser module
Message-Id: <slrn90vbgb.lsu.r2d2@shaka.acc.umu.se>
In article <3A094BCF.2020E154@cocoon.ulpgc.es>, Juan Eliseo Carrasco Díaz wrote:
>I trying to delete all the <font face="Arial"> and <font face="Times new
>roman"> marks and its respective </font> marks of my HTML pages, but I
>can't find an easy way.
This is one of the things that are easy to do with my HTML::Transform package.
The following script takes care of the problem, and also correctly handles
font-tags with more than one attribute, i e
<font face=arial color=red>
is converted to
<font color=red>
---
use HTML::Transform;
package FontDelete;
@FontDelete::ISA = qw(Transform);
sub font {
my ($self, $text, $attr) = @_;
if ($attr->{face} =~ /arial/i ||
$attr->{face} =~ /times\s*new\s*roman/i) {
delete $attr->{face};
}
if (%$attr)
{$self->make_tag("FONT", $attr).$text."</FONT>"}
else
{$text}
}
print FontDelete->parse("test.html");
---
I haven't released HTML::Transform on CPAN yet (want to make some last tweaks,
if you have any feedback I'll be happy), you can download it at
http://www.acc.umu.se/~r2d2/files/Perl/html_transform/index.html
// Niklas
------------------------------
Date: Mon, 13 Nov 2000 08:17:39 GMT
From: Aitor Garcia <a58289@yahoo.com>
Subject: Help with regexp
Message-Id: <8uo831$aq1$1@nnrp1.deja.com>
Hi everybody !
I am new in the fascinating world of
regexps and need some help.
I would like to read a file line by
line and would like to match the word
"Warning" and then, print this line and
the subsequent lines until I find a ")".
The ")" can be in the same line where the
"Warning" word is.
Here is part of the code
#!/usr/bin/perl
$file= "ncverilog.log";
open(F_HW,"<$file");
while($de_hw = <F_HW>){
I do not know what to write here.
}
I only know that in order to match
a "Warning" I have to write;
$match = $de_hw =~ /Warning/;
and to match a ")"
$match = $de_hw =~ /\)/;
I would like to know how can I combine both
regexps above to get what I want.
Any help will be greatly appreciated.
Best regards,
Aitor
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 13 Nov 2000 09:36:46 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Help with regexp
Message-Id: <3A0FA81E.3A8546B8@fujitsu-siemens.com>
Aitor Garcia wrote:
> =
> Hi everybody !
> =
> I am new in the fascinating world of
> regexps and need some help.
> =
> I would like to read a file line by
> line and would like to match the word
> "Warning" and then, print this line and
> the subsequent lines until I find a ")".
> The ")" can be in the same line where the
> "Warning" word is.
Sounds pretty much like a homework assignment to me ...
I'd use a state variable: $printing.
> Here is part of the code
> =
#!/usr/bin/perl
$file=3D "ncverilog.log";
open(F_HW,"<$file");
$printing =3D 0;
while(<F_HW>){
if (/Warning/) {
$printing =3D 1;
}
if (/\)/) {
$printing =3D 0;
}
print if ($prining);
}
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
------------------------------
Date: Mon, 13 Nov 2000 09:10:41 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Help with regexp
Message-Id: <slrn90vc7p.1bf.tjla@thislove.dyndns.org>
I was shocked! How could Aitor Garcia <a58289@yahoo.com>
say such a terrible thing:
>line and would like to match the word
>"Warning" and then, print this line and
>the subsequent lines until I find a ")".
Sounds like a job for the flip-flop '..' operator:
print if (/Warning/ .. /\)/);
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Bipolar, adj.:
Refers to someone who has homes in Nome, Alaska, and Buffalo, New York.
------------------------------
Date: Mon, 13 Nov 2000 09:13:39 GMT
From: Quantum Mechanic <quantum_mechanic@my-deja.com>
Subject: Re: Help with regexp
Message-Id: <8uobc2$dr1$1@nnrp1.deja.com>
In article <3A0FA81E.3A8546B8@fujitsu-siemens.com>,
Josef Moellers <josef.moellers@fujitsu-siemens.com> wrote:
> Aitor Garcia wrote:
> > =
>
> > Hi everybody !
> > =
>
> > I am new in the fascinating world of
> > regexps and need some help.
> > =
>
> > I would like to read a file line by
> > line and would like to match the word
> > "Warning" and then, print this line and
> > the subsequent lines until I find a ")".
> > The ")" can be in the same line where the
> > "Warning" word is.
>
> Sounds pretty much like a homework assignment to me ...
>
> I'd use a state variable: $printing.
>
> > Here is part of the code
> > =
>
> #!/usr/bin/perl
> $file=3D "ncverilog.log";
>
> open(F_HW,"<$file");
> $printing =3D 0;
> while(<F_HW>){
> if (/Warning/) {
> $printing =3D 1;
> }
print if $printing; # ')' might be on this line
> if (/\)/) {
> $printing =3D 0;
> }
# watch the typos ;)
# print if ($prining);
> }
-QM
--
Quantum Mechanics: The dreams stuff is made of.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 13 Nov 2000 10:46:58 GMT
From: Aitor Garcia <a58289@yahoo.com>
Subject: Re: Help with regexp
Message-Id: <8uogr2$hk4$1@nnrp1.deja.com>
I would like to apologize for my wrong english.
Best regards,
Aitor
In article <slrn90vc7p.1bf.tjla@thislove.dyndns.org>,
tjla@guvfybir.qlaqaf.bet (Gwyn Judd) wrote:
> I was shocked! How could Aitor Garcia <a58289@yahoo.com>
> say such a terrible thing:
>
> >line and would like to match the word
> >"Warning" and then, print this line and
> >the subsequent lines until I find a ")".
>
> Sounds like a job for the flip-flop '..' operator:
>
> print if (/Warning/ .. /\)/);
>
> --
> Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
> Bipolar, adj.:
> Refers to someone who has homes in Nome, Alaska, and Buffalo, New
York.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 13 Nov 2000 08:43:34 GMT
From: cjw44@flatline.org.uk (Colin Watson)
Subject: Re: HELP!! MIME attached file
Message-Id: <8uo9jm$j48$1@riva.ucam.org>
leslie <leslies@santaland.com> wrote:
>I have figured out how to send a file using sendmail and MIME format. But
>for some reason whenever you receive the mail that it sends out.. the file
>is just empty.. nothing there.. basically the only thing that goes through
>is that there is an attached file and the name of the attached file but the
>contents of the file dont seem to go through.. Here is a copy of the code i
>am using .. someone please help.
>
>$SENDMAIL = '/usr/lib/sendmail/';
I don't think you meant to use the final / there.
> open(MAIL,"|$SENDMAIL -t") || die "Can't open mail!\n";
> print MAIL "To: g0d_online\@yahoo.com, leslies\@santaland.com,
>bastage\@aol.com\n";
As well as the MIME::Lite already mentioned, you should use here
documents. I've indented this code fragment for this mail, but note that
the terminating 'EOF' *must* come at the beginning of a line.
print MAIL <<EOF;
To: g0d_online\@yahoo.com, leslies\@santaland.com, bastage\@aol.com
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="next_part_of_message"
This is a multipart message in MIME format
...
EOF
--
Colin Watson [cjw44@flatline.org.uk]
"Alles Vergaengliche / Ist nur ein Gleichnis;
Das Unzulaengliche / Hier wird's Ereignis;" - _Faust_, Goethe
------------------------------
Date: Mon, 13 Nov 2000 11:27:36 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: How to force MSDOS window to stay open after perl?
Message-Id: <3A0FC218.F28ECCE9@schaffhausen.de>
Stephen schrieb:
>
> I am runnig ActiveState Perl on Win98. When I click on a perl file
> (*.plx), it would execute the script in a popup msdos window. But as
> soon as it finishes, the msdos window would close, making it too fast
> for me to read the output. How do you tell msdos window to stay open
> after executing the Perl script?
>
> Thanks.
At end of program:
my $bla = <STDIN>;
malte
------------------------------
Date: Mon, 13 Nov 2000 17:42:27 +0800
From: "Calvin" <calvin_newsgroup@hotmail.com>
Subject: Link - the action after "?"
Message-Id: <8uoce7$18a$1@eng-ser1.erg.cuhk.edu.hk>
If visit http://www.myserver.com/cgi-bin/main.pl?action=new then print "New"
if visit http://www.myserver.com/cgi-bin/main.pl?action=old then print "Old"
I don't know why the following program can't work, please help. Thanks.
[Sorry! My English is not enough]
#!/usr/bin/perl
print "Content-type: text/html\n\n";
if ($in{'action'} ne "new") {
print "New";
exit;
}
elsif ($in{'action'} ne "old") {
print "Old";
exit;
}
else {
print "Not New and Old";
exit;
}
------------------------------
Date: Sun, 12 Nov 2000 23:54:41 -0800
From: "Brian Vogel" <briansv@bellsouth.net>
Subject: need a little help
Message-Id: <TgLP5.2636$Ec3.10274@news3.atl>
I have set up a guest book on my website and I used perl. I have it so when
John Doe hits the SUBMIT button it will write to the server HDD. My problem
is there are no spaces between the fields of the submit form.
IE If I fill it out the form with A then B then C and so on for every field
and I look at the HTML file it prints it to it looks like ABC. No spaces.
PLEASE someone tell me how to place a space or better yet a " | " between
each field.
Thanx!
------------------------------
Date: Mon, 13 Nov 2000 08:27:04 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Re: need a little help
Message-Id: <3a0fa506.4693639@news.grnet.gr>
On Sun, 12 Nov 2000 23:54:41 -0800, "Brian Vogel"
<briansv@bellsouth.net> wrote:
>I have set up a guest book on my website and I used perl. I have it so when
>John Doe hits the SUBMIT button it will write to the server HDD. My problem
>is there are no spaces between the fields of the submit form.
>IE If I fill it out the form with A then B then C and so on for every field
>and I look at the HTML file it prints it to it looks like ABC. No spaces.
>PLEASE someone tell me how to place a space or better yet a " | " between
>each field.
We need a little help, too. Try posting the code you have so the
experts here can see it. You might also try using a subject line that
indicates the nature of your problem.
My guess is that you are using CGI.pm and getting all the parameters
together from the param() array, then writing the whole thing to disk.
If so, Perl is doing exactly what you're telling it to do.
But then, that's just a guess.
Phil
--
Philip Lees
ICS-FORTH, Heraklion, Crete, Greece
Ignore coming events if you wish to send me e-mail
'The aim of high technology should be to simplify, not complicate' - Hans Christian von Baeyer
------------------------------
Date: Mon, 13 Nov 2000 09:36:59 GMT
From: Quantum Mechanic <quantum_mechanic@my-deja.com>
Subject: Re: need a little help
Message-Id: <8uocnr$ene$1@nnrp1.deja.com>
In article <3a0fa506.4693639@news.grnet.gr>,
pjlees@ics.forthcomingevents.gr (Philip Lees) wrote:
> On Sun, 12 Nov 2000 23:54:41 -0800, "Brian Vogel"
> <briansv@bellsouth.net> wrote:
>
> >I have set up a guest book on my website and I used perl. I have it
so when
> >John Doe hits the SUBMIT button it will write to the server HDD. My
problem
> >is there are no spaces between the fields of the submit form.
> >IE If I fill it out the form with A then B then C and so on for
every field
> >and I look at the HTML file it prints it to it looks like ABC. No
spaces.
> >PLEASE someone tell me how to place a space or better yet a " | "
between
> >each field.
>
> We need a little help, too. Try posting the code you have so the
> experts here can see it. You might also try using a subject line that
> indicates the nature of your problem.
>
> My guess is that you are using CGI.pm and getting all the parameters
> together from the param() array, then writing the whole thing to disk.
> If so, Perl is doing exactly what you're telling it to do.
>
> But then, that's just a guess.
>
> Phil
> --
> Philip Lees
> ICS-FORTH, Heraklion, Crete, Greece
> Ignore coming events if you wish to send me e-mail
> 'The aim of high technology should be to simplify, not complicate' -
Hans Christian von Baeyer
>
The most common issue is printing inside or outside of quotes.
If you have this:
@array = ('A','B','C');
print @array,"\n";
you get this:
ABC
but...
print "$array\n";
gives:
A B C
because in double-quote context, the array separator is space (" ") by
default, and you can change this with $" (aka $LIST_SEPARATOR in the
English module).
See also perldoc perlvar.
However, your problem may not match this solution...
-QM
--
Quantum Mechanics: The dreams stuff is made of.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 13 Nov 2000 09:53:03 GMT
From: Quantum Mechanic <quantum_mechanic@my-deja.com>
Subject: Re: New to perl - Problems with Labels ! Please Help.
Message-Id: <8uodlu$ff6$1@nnrp1.deja.com>
In article <8un4j9$gj1$1@nnrp1.deja.com>,
msalerno@my-deja.com wrote:
> Sorry about posting the entire script, but I didn't know where the
best
> place to cut would be. Please all keep in mind that I am still very
> new at this. The issue is that I need the script to validate Ip
> addresses. I cannot get the script to recognize labels with "next".
If
> I change the "next" to a "goto" it will work. But I don't want a
> goto ! Also if I enter the ip address of "10.10.10.10." it accepts
it,
> the trailing decimal should be read as an error. Please let me know
> where I have gone wrong.
>
> Thanks,
> Matt
>
> #!/usr/bin/perl -w
> use strict;
> use vars qw($comp1 $comp2);
> sub ip_check {
> my @ipa = split /\./, $_[0];
> return "1" unless $_[0] =~ /^[\d.]+$/ and @ipa == 4;
> foreach my $i ( 0..3 ) {
> return "1" unless $ipa[$i] >= 0 and $ipa[$i] < 256;}
> $_[0]=~s/(^|\.)0+(\d)/$1$2/g;
> return $_[0]; }
> # END ip_check
> # Get the First IP Address
> FIRST: for (1..3)
> {print "Enter the First Ip Address: ";
> chomp(my $ip1 = <STDIN>);
> ($comp1) = ip_check($ip1);
> last unless $comp1 eq 1;
> print "\nInvalid Ip Address\n";
> next; }
> # Get the Second IP Address
> SECOND: for (1..3)
> {print "Enter the Second Ip Address: ";
> chomp(my $ip2 = <STDIN>);
> ($comp2) = ip_check($ip2);
> print "\n$comp1\n$comp2";
> last unless $comp2 eq 1;
> print "\nInvalid Ip Address\n";
> print "First IP Address: $comp1\n";
> #THIS IS THE LINE THAT I AM HAVING PROBLEMS WITH !
> next "FIRST"; }
> for (1..3)
> {last unless $comp1 =~ $comp2;
> print "\nThe First and Second Addresses need to be different\n";
> next FIRST;}
> END:
> print "\nEND";
"next" to a label only works on an enclosing block. Your code is trying
to "next" to a label on an unrelated block. That is why "goto" worked
and "next" didn't.
It looks like you might want a loop enclosing both the FIRST and SECOND
blocks, and just fall out of the SECOND block gracefully to get back to
FIRST (perhaps using "last" or "last SECOND").
-QM
--
Quantum Mechanics: The dreams stuff is made of.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 13 Nov 2000 09:34:22 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Pushing a hash on to a stack...
Message-Id: <stcv0t8kirbsglch76r4ajhe9fq7v518ta@4ax.com>
Christopher Burke wrote:
>but
>still leave $array[0]{x} = unchanged. That is not use '->', Which is what I
>meant by not use references.
FYI:In Perl,
$array[0]->{x}
and
$array[0]{x}
are two different syntaxes for exactly the same thing.
--
Bart.
------------------------------
Date: Mon, 13 Nov 2000 05:30:04 -0000
From: <vidulats@yahoo.co.uk>
Subject: Re: Returning an array from C to Perl
Message-Id: <t0uv2sd4bjl313@corp.supernews.com>
Hello,
I read this issue. (issue=6)
I have a idea of Perl C API, Perl's data structure, working of stack.
I'm involved in one project, which demands from C to return a array to
Perl. I can easily pass the array elements one by one and get my job done,
but I don't want this. I want to pass the complete array at a time to Perl.
I'm not getting how to do that. After reading most of the documents I'm
stuck.
I need any some guide line on the same.
Thanks in advance,
Regards,
Vidula
Joe Schaefer wrote:
>
> <vidulats@yahoo.co.uk> writes:
>
> > I gone through all of these (perlxs, perlxstut, perlguts, perlapi)
> > documents.
> > Even I read all the FAQ's related to this topic.
> >
> > But, couldn't make out from that.
>
> Here's a beautifully written series of articles by
> Steven McDougall on XS
>
> http://www.perlmonth.com/columns/modules/modules.html?issue=6
>
> HTH.
> --
> Joe Schaefer
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: 13 Nov 2000 08:30:18 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Returning an array from C to Perl
Message-Id: <8uo8qr$a7f$1@lublin.zrz.tu-berlin.de>
<vidulats@yahoo.co.uk> wrote in comp.lang.perl.misc:
>Hello,
>
>I read this issue. (issue=6)
>
>I have a idea of Perl C API, Perl's data structure, working of stack.
>
>I'm involved in one project, which demands from C to return a array to
>Perl. I can easily pass the array elements one by one and get my job done,
>but I don't want this. I want to pass the complete array at a time to Perl.
>
>I'm not getting how to do that. After reading most of the documents I'm
>stuck.
>
>I need any some guide line on the same.
Again: perlguts, see the chapter titled "Subroutines".
Anno
------------------------------
Date: Mon, 13 Nov 2000 09:58:24 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Returning an array from C to Perl
Message-Id: <moev0tsit90vsioc2j43bqgmip231jun61@4ax.com>
<vidulats@yahoo.co.uk> wrote:
>I'm involved in one project, which demands from C to return a array to
>Perl. I can easily pass the array elements one by one and get my job done,
>but I don't want this. I want to pass the complete array at a time to Perl.
>
>I'm not getting how to do that. After reading most of the documents I'm
>stuck.
In C, an array is a contiguous block of memory. Can't you return it to
Perl as a string, and use unpack() in Perl to extract the array items?
--
Bart.
------------------------------
Date: Mon, 13 Nov 2000 06:02:47 GMT
From: "MNJP" <not.my.real.email@bellglobal.com>
Subject: Re: running telnet automatically
Message-Id: <buLP5.78033$x6.1544072@news20.bellglobal.com>
rsh ?
<erdavila@my-deja.com> wrote in message news:8unfme$p2v$1@nnrp1.deja.com...
> I'm trying to develop a Perl script that connects on a remote host
> using telnet, logs in, runs some commands and logs out. The commands'
> outputs will be processed by the script and then printed. This script
> must run in a web server (Apache).
> Does it worth to use sockets in the Perl script? Or is there any
> solution to automatize the running of commands through telnet (maybe
> using telnet scripts...)?
>
> Thanks.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Mon, 13 Nov 2000 00:02:44 -0700
From: "Michael Cook" <mikecook@cigarpool.com>
Subject: Re: running telnet automatically
Message-Id: <PmMP5.4068$sg3.681808@news.uswest.net>
Try the Net::Telnet package on CPAN...it's already written & does exactly
what you are asking for...
Michael
--
== CigarPool ==
http://www.cigarpool.com
<erdavila@my-deja.com> wrote in message news:8unfme$p2v$1@nnrp1.deja.com...
> I'm trying to develop a Perl script that connects on a remote host
> using telnet, logs in, runs some commands and logs out. The commands'
> outputs will be processed by the script and then printed. This script
> must run in a web server (Apache).
> Does it worth to use sockets in the Perl script? Or is there any
> solution to automatize the running of commands through telnet (maybe
> using telnet scripts...)?
>
> Thanks.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Mon, 13 Nov 2000 10:33:58 GMT
From: rpanman@my-deja.com
Subject: Sysread and 0x0A
Message-Id: <8uog2n$h3f$1@nnrp1.deja.com>
Hi
I'm having problems using sysread to read data from a file. The problem
is that when sysread() encounters 0x0A it doesn't put it in the scalar.
The data on either side of 0x0A are present so I don't know where it's
going.
Any help would be greatly appreciated because I'm starting to tear my
hair out.
Cheers
Richard
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 13 Nov 2000 11:30:28 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: use-ing .pm file from different dir
Message-Id: <3A0FC2C3.22A018FC@schaffhausen.de>
dVoon schrieb:
>
> Hi all,
>
> If I have a user-defined 'myfunc.pm' file in ~/cgi-bin/sharefunc/ , how
> do I 'use' it from other different directories?
>
> I have tried putting the full path like:
>
> use /home/httpd/cgi-bin/sharefunc/myfunc;
> or
> use "/home/httpd/cgi-bin/sharefunc/myfunc";
>
> all have failed to even compile :(
>
> I appreciate any help. Thanks.
>
> Daniel
BEGIN {
push @INC, "path/to/files"
}
use FILE;
Should do it.
malte
------------------------------
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 4876
**************************************