[18010] in Perl-Users-Digest
Perl-Users Digest, Issue: 170 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 29 18:11:24 2001
Date: Mon, 29 Jan 2001 15:10:19 -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: <980809819-v10-i170@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 29 Jan 2001 Volume: 10 Number: 170
Today's topics:
How to export functions from a module? (newbie-ish ques <visstmbl@reading.ac.uk>
Inserting CLOB using Oracle::DBD hmug@my-deja.com
Re: is there a limitation nobull@mail.com
javadoc and pod <bcaligari@my-deja.com>
Re: localtime, days of a month <chrisw@dynamite.com.au>
Re: More efficient than split? whubley@my-deja.com
Need: PERL program to capture internet interactions of <MichaelAnthony@MailAndNews.com>
Re: New Perl Book. <comdog@panix.com>
Re: Newbie Question: Can I compile a Perl Script? <comdog@panix.com>
newbie, problem in installing module (Pradeep Sethi)
Re: Passing object reference, while parsing XML <thomastk@my-deja.com>
Re: Perl is bad at (very) simple math! <nospam.newton@gmx.li>
Re: Perl is bad at (very) simple math! <chrisw@dynamite.com.au>
Re: simple, simple question nobull@mail.com
Re: simple, simple question <wo_ah_ho@yahoo.com>
Re: Sorting an array by particular items in a list (Martin Vorlaender)
substituting "@" with regexp <todda@xmission.com>
Re: substituting "@" with regexp <elijah@workspot.net>
Re: substituting "@" with regexp (Abigail)
Re: substituting "@" with regexp <todda@xmission.com>
Re: substituting "@" with regexp <todda@xmission.com>
Re: substituting "@" with regexp <chrisw@dynamite.com.au>
Using global var in subroutine <steve@teamITS.com>
Win32ChangeNotify problems w/WinNT while Win98 is OK <dprovac1@twcny.rr.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 29 Jan 2001 20:09:41 +0000
From: John Stumbles <visstmbl@reading.ac.uk>
Subject: How to export functions from a module? (newbie-ish question)
Message-Id: <Pine.WNT.4.30.0101292005530.241-100000@supc16.rdg.ac.uk>
I'm trying to give up using old-style 'require module.pl' and
change to 'use Module'.
I've got this test prog:
#!/usr/bin/perl -w
use strict;
use Utils;
print $INC{'Utils.pm'} ; # check where we're finding the module
print "\n" ;
#print NOW() ; # gives "Undefined subroutine &main::NOW " error
print Utils::NOW() ; # works OK
print "\n";
In Utils.pm (in the same directory as my test script, as shown by the
print statement above) I have:
package Utils ;
use strict ;
require Exporter ;
my @ISA = qw(Exporter);
my @EXPORT = qw(
NOW MINUTE HOUR DAY WEEK YEAR MONTH QUARTER
) ;
return 1;
##############################################################################
sub NOW { return time() ; }
sub MINUTE ... etc ...
... the blue camel tells me "now go on and declare your variables and
functions without any qualifications" so why can't I get to use NOW or
NOW() in my test prog?
regards,
--
John Stumbles j.d.stumbles@reading.ac.uk
I.T. Services Centre, University of Reading http://www.rdg.ac.uk/~visstmbl
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
never generalise
------------------------------
Date: Mon, 29 Jan 2001 20:46:37 GMT
From: hmug@my-deja.com
Subject: Inserting CLOB using Oracle::DBD
Message-Id: <954kra$f4b$1@nnrp1.deja.com>
Hi
I have a problem inserting a clob into an Oracle DB table.
The table is as follows:
create table foobar (
doc_id number(38) primary key,
doc_title varchar2(100),
doc_content clob);
my $dbh = &Database::gethandle();
my $sql = "insert into foobar values
( doc_seq.nextval, \'Foo Ba Test\', ?)";
my $sth = $dbh->prepare($sql);
$sth->bind_param (1, $text, {ora_type => 112, ORA_FIELD =>
doc_content } );
$sth->execute();
$sth->finish();
I get the error message indicating that the value I am trying to insert
is too large for the column.
Is this a general bug with the DBD::Oracle module, an error with my
installation or is there something I am missing?
BTW: I am able to view table content by means of select queries with
Perl/DBI.
Your help is highly appreciated.
Henry
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 29 Jan 2001 19:04:44 +0000
From: nobull@mail.com
Subject: Re: is there a limitation
Message-Id: <u9u26iuqlv.fsf@wcl-l.bham.ac.uk>
"D.W." <dpalmeNOSPAM@unitedtraffic.com> writes:
> Is there a limitation on the amount of data that I can pass to a perl cgi in
> a query string?
Yes, probably. This has nothing to do with Perl. The limitation is
exactly the same regardless of the language in which the CGI script is
written. If there is a limit then it is imposed by HTTP client/server
software.
> I have a form which is passing a lot of fields and it seems that my last
> field isn't being passed at all...
Consider using POST rather than GET.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 29 Jan 2001 19:03:19 GMT
From: Brendon Caligari <bcaligari@my-deja.com>
Subject: javadoc and pod
Message-Id: <954epf$8sr$1@nnrp1.deja.com>
I was wondering which came first.
Did perl borrow some ideas here and there from java, was
it the other way around, pure coincidences, or have both
borrowed certain ideas from the same source?
B
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 30 Jan 2001 09:22:01 +1100
From: "Chris W" <chrisw@dynamite.com.au>
Subject: Re: localtime, days of a month
Message-Id: <Q3md6.6$rP4.1547@news0.optus.net.au>
"Nigel" <Nigel_member@newsguy.com> wrote in message
news:954k4602s48@drn.newsguy.com...
> I need to find out how many days there are in a given month. I tried doing
this:
> $epoch_seconds_1 = (0,0,0,0,$month1,$year);
> $epoch_seconds_2 = (0,0,0,0,$month2,$year);
> $days = ($epoch_seconds_2 - $epoch_seconds_1) / (24 * 60 * 60);
> But this returns something like this:
> 28 -12345
I fleshed out your example a little:
#!perl -w
$month1 = 1;
$month2 = 2;
$year = 2001;
$epoch_seconds_1 = (0,0,0,0,$month1,$year);
$epoch_seconds_2 = (0,0,0,0,$month2,$year);
# the two lines above are almost certainly NOT what you intended
print $epoch_seconds_1, "\n";
print $epoch_seconds_2, "\n";
$days = ($epoch_seconds_2 - $epoch_seconds_1) / (24 * 60 * 60);
print $days, "\n";
__END__
and then ran it:
C:\TEMP>perl tt.pl
Useless use of a variable in void context at tt.pl line 6.
Useless use of a variable in void context at tt.pl line 7.
2000
2000
0
Use the -w flag, it's very useful in picking up blunders of various sorts.
I suspect the sort of thing you really wanted was:
#!perl -w
use Time::Local;
$month1 = 1; # that's Feb
$month2 = 2; # that's Mar
$year = 100; # that's 2000, see gmtime.
$epoch_seconds_1 = timelocal(0,0,0,1,$month1,$year); # 1 Feb 2000
$epoch_seconds_2 = timelocal(0,0,0,1,$month2,$year); # 1 Mar 2000
print $epoch_seconds_1, "\n";
print $epoch_seconds_2, "\n";
$days = ($epoch_seconds_2 - $epoch_seconds_1) / (24 * 60 * 60);
print $days, "\n";
__END__
Which prints:
C:\TEMP>perl tt.pl
949323600
951829200
29
Hope this helps.
------------------------------
Date: Mon, 29 Jan 2001 20:35:23 GMT
From: whubley@my-deja.com
Subject: Re: More efficient than split?
Message-Id: <954k6b$e8m$1@nnrp1.deja.com>
In article <94u62j$qh3$1@ichaos.ichaos-int>,
Juha Laiho <Juha.Laiho@iki.fi> wrote:
> whubley@my-deja.com said:
> >From what I read, split is not very efficient. Is there a more
> >efficient substitution for split when parsing values from pipe-
> >delimited string of text?
>
> [Sorry, at least for the moment I'm not going to propose an
alternative
> to split; just trying to get the problem into a proper scope]
>
> What is the usage profile of your program -- where does the time go?
> Remember to include the Perl script load/compile time, if the script
> is a short-running one (f.ex. less than 10 seconds).
>
> After this, make an estimate how much time the split()'s in your code
> are taking per one execution, and try to figure out what kind of
> difference it would do to the big picture to get rid of the splits
> altogether. If you see something you'll consider a notable difference,
> then see if you should be using something else than split. I'd count
> 10% of the total execution time as a notable; in long-running (hours)
> scripts a lower percentage might be considered notable, too.
>
> Another thing to consider is that are all your split()'s needed; I've
> seen code to be slow due to processing the same input text needlessly
> over and over again (my fix was to read in the particular input once,
> process it into a coherent data structure upon reading the data in,
> and upon reading other data, just refer to this previously-built in-
> memory structure instead of going back to disk for those pieces of
data).
>
> Recently I ended up giving up Perl and going to C due to the Perl
> load/compile time. The code is small, time of single execution being
> about 1/10s, and will get executed frequently along a time-critical
> path of a larger system. So, the 1/10s is acceptable delay, and as the
> code does mostly text-munging, Perl would've been my favourite tool.
> Due to things out of my control it wasn't possible to make this
program
> a long-running one, so the load/compile time couldn't be discarded
> so I decided to implement the program in C.
> --
> Wolf a.k.a. Juha Laiho Espoo, Finland
> (GC 3.0) GIT d- s+: a C++ UH++++$ UL++++ P++@ L+++ E(-) W+$@ N++ !K
w !O
> !M V PS(+) PE Y+ PGP(+) t- 5 !X R tv--- b+ !DI D G e+ h---
r+++ y+++
> "...cancel my subscription to the resurrection!" (Jim Morrison)
>
This is a perl module, using mod_perl. It is loaded and compiled with
each httpd. It's really fast, but I'm just picking some things within
the code that I may be able to speed up.
Good thought. Please see my post to the other part of this thread.
Thanks for your time.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 29 Jan 2001 14:50:12 -0500
From: Michael Anthony <MichaelAnthony@MailAndNews.com>
Subject: Need: PERL program to capture internet interactions of a given WINDOWS program
Message-Id: <3A780D18@MailAndNews.com>
Help.
I want to create/find a PERL program that captures the Internet interactions
of a given WINDOWS program.
I currently run a spidering program that runs on Windows and interacts with
various form-based engines on other sites by sending submissions to them.
They know stuff that I don't know, like : what the constantly changing
interface is to these nasty engines.
I get updates from them periodically, but frankly their interface sucks. I
can't run it in batch mode. It doesn't do EVERYTHING I need to do, so it
has
to be used with other things, so everything becomes hard to make work
together.
I want to just run around what they are doing, and do it myself.
I have a way to put a LINUX box in between the Windows box and the net as a
firewall, if that's necessary.
I want to run a PERL program that captures the interactions of the given
program.
I want to know exactly where they are sending their submissions and what the
form that they have found looks like, and what the headers they are sending
look like, etc.
If you know where such a PERL tool is, at whatever level of functionality,
could you let me know ?
Michael
Need: PERL program to capture Internet interactions of a given WINDOWS
program
------------------------------------------------------------
Get your FREE web-based e-mail and newsgroup access at:
http://MailAndNews.com
Create a new mailbox, or access your existing IMAP4 or
POP3 mailbox from anywhere with just a web browser.
------------------------------------------------------------
------------------------------
Date: Mon, 29 Jan 2001 16:02:26 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: New Perl Book.
Message-Id: <comdog-C8C4E4.16022629012001@news.panix.com>
In article <7efd6.6060$Uo2.19732@newsfeed.slurp.net>, "bowman"
<bowman@montana.com> wrote:
> Abraham S. Lin <md5.bbs@bbs.ntu.edu.tw> wrote in message
> news:a0ca7tceoc6git4rrko747634kmfaklrii@4ax.com...
> > Has anyone read the new Programming Perl Version 3?
> > How is it different from Version 2?
> It covers the newer features of the language. It is not the complete rewrite
> that 1 -> 2 was.
are you sure it's not a complete rewrite? ;)
--
brian d foy <comdog@panix.com>
------------------------------
Date: Mon, 29 Jan 2001 16:01:42 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: Newbie Question: Can I compile a Perl Script?
Message-Id: <comdog-30FDA3.16014229012001@news.panix.com>
In article <9547sg$27t$1@nnrp1.deja.com>, Daniel Berger
<djberg96@my-deja.com> wrote:
> However, before I totally choke on crow, see the caveat about perldoc
> in "Effective Perl Programming", p.175. Some programmers might not
> have access to perldoc.
that is no excuse. you can use search.cpan.org, www.perldoc.com,
www.perl.com, or many other sites to look at Perl documentation.
--
brian d foy <comdog@panix.com>
------------------------------
Date: Mon, 29 Jan 2001 22:38:45 GMT
From: ps@siteindia.com (Pradeep Sethi)
Subject: newbie, problem in installing module
Message-Id: <3a75f1fc.2844573870@news1.sfba.home.net>
Hi,
It is a very basic question.
I downloaded XML::XPath and am trying to install it and getting this
error
[root@lurch]# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for XML::XPath
Unable to open MakeMaker.tmp: Permission denied at
/usr/lib/perl5/5.6.0/ExtUtils/MakeMaker.pm line 747.
pls help
Thanks in Advance
Prad
here is output of Perl -V
Summary of my perl5 (revision 5.0 version 6 subversion 0)
configuration:
Platform:
osname=linux, osvers=2.2.14, archname=i686-linux
uname='linux lurch.iescrow.com 2.2.14 #2 smp mon jul 31 10:06:57
mdt 2000 i686 unknown '
config_args='-Dprefix=/usr -de'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=define
use64bitint=undef use64bitall=undef uselongdouble=undef
usesocks=undef
Compiler:
cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990314/Linux
(egcs-1.1.2 release)
cppflags='-fno-strict-aliasing'
ccflags ='-fno-strict-aliasing -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64'
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define,
longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
libc=/lib/libc-2.1.2.so, so=so, useshrplib=false,
libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef,
ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: USE_LARGE_FILES
Built under linux
Compiled at Aug 28 2000 17:14:55
@INC:
/usr/lib/perl5/5.6.0/i686-linux
/usr/lib/perl5/5.6.0
/usr/lib/perl5/site_perl/5.6.0/i686-linux
/usr/lib/perl5/site_perl/5.6.0
/usr/lib/perl5/site_perl
------------------------------
Date: Mon, 29 Jan 2001 20:00:25 GMT
From: thoma <thomastk@my-deja.com>
Subject: Re: Passing object reference, while parsing XML
Message-Id: <954i4i$cad$1@nnrp1.deja.com>
> > my $xx = @_;
> > my $nodexx = $xx->getFirstChild; ######ERROR HAPPENS HERE
>
> this doesn't work like zou expect.
> in $x you have the number of elements in @_ now.
> use
> my ($xx) = @_;
> instead.
>
> hth,
> tina
That fixed it!!! Thanks a lot Tina.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 29 Jan 2001 23:41:50 +0100
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.li>
Subject: Re: Perl is bad at (very) simple math!
Message-Id: <s4rb7tstp19p7k7lq4ocsisik9dumg3m7s@4ax.com>
On Mon, 29 Jan 2001 11:35:20 +1100, "Chris W" <chrisw@dynamite.com.au> wrote:
> printf "%3.2f", $c;
^^^
That's cheating. If you're going to use "%3.2f", then 5.1 - 5.0 will give you
the "correct" answer, too.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Tue, 30 Jan 2001 09:54:06 +1100
From: "Chris W" <chrisw@dynamite.com.au>
Subject: Re: Perl is bad at (very) simple math!
Message-Id: <Vxmd6.10$rP4.1241@news0.optus.net.au>
"Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.li> wrote in
message news:s4rb7tstp19p7k7lq4ocsisik9dumg3m7s@4ax.com...
> On Mon, 29 Jan 2001 11:35:20 +1100, "Chris W" <chrisw@dynamite.com.au>
wrote:
>
> > printf "%3.2f", $c;
> ^^^
>
> That's cheating. If you're going to use "%3.2f", then 5.1 - 5.0 will give
you
> the "correct" answer, too.
Good point, but in this case:
print $c;
gives you the 'correct' answer but in an unusual format:
+1E-1
------------------------------
Date: 29 Jan 2001 19:01:11 +0000
From: nobull@mail.com
Subject: Re: simple, simple question
Message-Id: <u9wvbeuqrs.fsf@wcl-l.bham.ac.uk>
"Jason Wong" <wo_ah_ho@yahoo.com> writes:
> Subject: simple, simple question
We read this as "I am selfish and lazy - please flame me".
Be aware that some people are not too arrogant/selfish/lazy to look at
the newsgroup to see if the question they are about to ask has already
been asked. They do this using a Usnet search engine and are
presented with a list of condidate threads. The threads are
represented by their subject lines. If previous people to ask the
question have used sensible subject lines then they stand a chance of
finding the answer. If previous people to ask the same question have
been too arrogant/selfish/lazy to think about their subject line then
they fail.
> How to load a website in cgi script
Do you perhps mean "fetch a document from a website in a Perl script"?
LWP
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 29 Jan 2001 15:00:55 -0500
From: "Jason Wong" <wo_ah_ho@yahoo.com>
Subject: Re: simple, simple question
Message-Id: <954i4c$mlq$1@bcrkh13.ca.nortel.com>
ok...
my script edited a webpage
i just wanna find a Perl function like
load(url)
so as to bring up that updated page directly, instead of making another
hyperlink
<nobull@mail.com> wrote in message news:u9wvbeuqrs.fsf@wcl-l.bham.ac.uk...
> "Jason Wong" <wo_ah_ho@yahoo.com> writes:
>
> > Subject: simple, simple question
>
> We read this as "I am selfish and lazy - please flame me".
>
> Be aware that some people are not too arrogant/selfish/lazy to look at
> the newsgroup to see if the question they are about to ask has already
> been asked. They do this using a Usnet search engine and are
> presented with a list of condidate threads. The threads are
> represented by their subject lines. If previous people to ask the
> question have used sensible subject lines then they stand a chance of
> finding the answer. If previous people to ask the same question have
> been too arrogant/selfish/lazy to think about their subject line then
> they fail.
>
> > How to load a website in cgi script
>
> Do you perhps mean "fetch a document from a website in a Perl script"?
>
> LWP
>
> --
> \\ ( )
> . _\\__[oo
> .__/ \\ /\@
> . l___\\
> # ll l\\
> ###LL LL\\
------------------------------
Date: Mon, 29 Jan 2001 21:37:08 +0100
From: martin@radiogaga.harz.de (Martin Vorlaender)
Subject: Re: Sorting an array by particular items in a list
Message-Id: <3a75d474.524144494f47414741@radiogaga.harz.de>
Leo (leapius@hotmail.com) wrote:
> Does anyone know how I can sort an array by particular elements in each
> list item. To clarify: E.g. I have a data file which contains this data
>
> a|c|d
> d|b|e
> a|b|f
>
> I read it into an array and split it thus:
>
> foreach $item (@array) { ($item1, $item2, $item3) = split(/\|/,$item); }
>
> How can I sort my array by particular a element (or elements)?
This is a case for the Schwartzian transformation:
$element = 1; # or 2, 3, ...
@sorted_array = map { $_->[0] }
sort { $a->[$element] cmp $b->[element] }
map { [ $_, split /\|/ ] }
@array;
as mentionend in `perldoc -q sort'. This also answers the question in
parenthesis.
cu,
Martin
P.S.: My newsserver doesn't carry alt.perl - snipped. comp.lang.perl is
dead and buried - snipped. This doesn't have anything to do with
modules - comp.lang.perl.modules removed from f'up. F'ups directed
to comp.lang.perl.misc.
--
One OS to rule them all | Martin Vorlaender | VMS & WNT programmer
One OS to find them | work: mv@pdv-systeme.de
One OS to bring them all | http://www.pdv-systeme.de/users/martinv/
And in the Darkness bind them.| home: martin@radiogaga.harz.de
------------------------------
Date: Mon, 29 Jan 2001 14:01:19 -0700
From: Todd Ahlstrom <todda@xmission.com>
Subject: substituting "@" with regexp
Message-Id: <3A75DA1F.11DCE47B@xmission.com>
I am trying to get a perl script to email someone using an email address
taken from a form. Of course when I print out the email address it will
look like this:
name%40domain.com
I thought I could use the following line of code to fix that, but it
hasn't worked.
$form{email}=~s/@/\@/;
Surely this is something simple that I am overlooking, but I can't find
it in my book.
Any help for this newbie to regexp is greatly appreciated.
Todd
------------------------------
Date: 29 Jan 2001 21:21:29 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: substituting "@" with regexp
Message-Id: <eli$0101291617@qz.little-neck.ny.us>
In comp.lang.perl.misc, Todd Ahlstrom <todda@xmission.com> wrote:
> I am trying to get a perl script to email someone using an email address
> taken from a form. Of course when I print out the email address it will
> look like this:
>
> name%40domain.com
Use one of the CGI libraries to decode your form values. 'use CGI;'
is almost certainly installed on your system already. There are other
CGI libraries at www.cpan.org that do less and are faster (or seem
faster to me) if all you want is the form parsing stuff.
Elijah
------
hoping you know enough to use taint checking
------------------------------
Date: 29 Jan 2001 21:58:32 GMT
From: abigail@foad.org (Abigail)
Subject: Re: substituting "@" with regexp
Message-Id: <slrn97bps7.bf7.abigail@tsathoggua.rlyeh.net>
Todd Ahlstrom (todda@xmission.com) wrote on MMDCCVIII September MCMXCIII
in <URL:news:3A75DA1F.11DCE47B@xmission.com>:
`` I am trying to get a perl script to email someone using an email address
`` taken from a form. Of course when I print out the email address it will
`` look like this:
``
`` name%40domain.com
What do you mean "of course"? Don't you use CGI.pm?
`` I thought I could use the following line of code to fix that, but it
`` hasn't worked.
``
`` $form{email}=~s/@/\@/;
Fix what? By replacing a non-existing character?
`` Surely this is something simple that I am overlooking, but I can't find
`` it in my book.
`` Any help for this newbie to regexp is greatly appreciated.
Regexes don't have anything to do with it.
man CGI
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
------------------------------
Date: Mon, 29 Jan 2001 15:13:47 -0700
From: Todd Ahlstrom <todda@xmission.com>
Subject: Re: substituting "@" with regexp
Message-Id: <3A75EB1B.3D0565FF@xmission.com>
I think I didn't explain my problem correctly. I have the form input parsed and
saved into %form. The parsing routine that I used does convert hex characters.
So the data that resides in $form{email} is actually myname@mydomain.com
but when I use a command like print "$form{email}"; it sends that output with
the non-escaped "@" to standard output causing perl to catch the "@" and cause
my problem. I was hoping that I could find a way to change the content of
$form{mail} from myname@mydomain.com to myname\@mydomain.com so that when I use
print "$form{email}"; it will work properly. I apologize for my ineptitude
with perl. Perhaps you both understood what I meant, and I just don't know
enough to understand your answers. : ) I am checking out cgi.pm now.
Thanks,
Todd
------------------------------
Date: Mon, 29 Jan 2001 15:33:26 -0700
From: Todd Ahlstrom <todda@xmission.com>
Subject: Re: substituting "@" with regexp
Message-Id: <3A75EFB6.FB767FCC@xmission.com>
I take it back, I thought all the hex was being converted, but I threw this line in
to see what would happen:
$form{email}=~s/%40/\@/;
and it fixed the problem.
Todd Ahlstrom wrote:
> I think I didn't explain my problem correctly. I have the form input parsed and
> saved into %form. The parsing routine that I used does convert hex characters.
> So the data that resides in $form{email} is actually myname@mydomain.com
> but when I use a command like print "$form{email}"; it sends that output with
> the non-escaped "@" to standard output causing perl to catch the "@" and cause
> my problem. I was hoping that I could find a way to change the content of
> $form{mail} from myname@mydomain.com to myname\@mydomain.com so that when I use
> print "$form{email}"; it will work properly. I apologize for my ineptitude
> with perl. Perhaps you both understood what I meant, and I just don't know
> enough to understand your answers. : ) I am checking out cgi.pm now.
>
> Thanks,
> Todd
------------------------------
Date: Tue, 30 Jan 2001 09:31:18 +1100
From: "Chris W" <chrisw@dynamite.com.au>
Subject: Re: substituting "@" with regexp
Message-Id: <xcmd6.7$rP4.1553@news0.optus.net.au>
"Todd Ahlstrom" <todda@xmission.com> wrote in message
news:3A75EB1B.3D0565FF@xmission.com...
> I think I didn't explain my problem correctly. I have the form input
parsed and
> saved into %form. The parsing routine that I used does convert hex
characters.
> So the data that resides in $form{email} is actually myname@mydomain.com
> but when I use a command like print "$form{email}"; it sends that output
with
> the non-escaped "@" to standard output causing perl to catch the "@" and
cause
> my problem.
Now I'm more confused than before.
#!perl -w
use strict;
my %form = ( email => 'mymail@mydomain.com' );
print $form{email}, "\n";
__END__
when run prints:
C:\TEMP>perl tt.pl
mymail@mydomain.com
as you would expect.
If you _really_ want \@ rather than @:
#!perl -w
use strict;
my %form = ( email => 'mymail@mydomain.com' );
$form{email} =~ s/@/\\@/g; # notice the double backslash!
print $form{email}, "\n";
__END__
Hope this helps.
------------------------------
Date: Mon, 29 Jan 2001 16:40:38 -0600
From: "Steve Yates" <steve@teamITS.com>
Subject: Using global var in subroutine
Message-Id: <t7bsai40pbbm04@corp.supernews.com>
I have a scoping issue that I'm trying to figure out, and it just seems
like there's an easy answer. I'm looking at an 80k program (written by
someone else, who unfortunately has died), and after moving it from IIS and
an unknown Perl version to Apache 1.3.14 (Win32) and ActivePerl 5.6, the
global vars are not being recognized in subroutines. This code had been
working previously.
Subroutine excerpt (first few lines):
sub ReadGlobalSpecialty {
undef %Specialty; undef %CodeSpecialty; undef %SpecialtyDescr;
local ($x, $y, @x);
open( SPECCODE, "$TEMPLATES$userCode/file.txt" ) || # (...)
# (...)
}
The "open" call falls through to the die (not shown) since the file
"c:/folder//file.txt" isn't found, which tells me that $userCode isn't being
recognized (assume $TEMPLATES == "c:/folder/"). $userCode is set at the
beginning of the program, and IS recognized after that point but before this
subroutine. If I set $userCode = "xxx" in the subroutine it of course
works. It looks like local() will redeclare the var, which I don't want.
Help?
Thanks,
Steve
------------------------------
Date: Mon, 29 Jan 2001 22:27:17 GMT
From: "Dave" <dprovac1@twcny.rr.com>
Subject: Win32ChangeNotify problems w/WinNT while Win98 is OK
Message-Id: <97md6.95326$ju6.10359003@typhoon.nyroc.rr.com>
Hi,
I have a simple program using Win32::ChangeNotify that
works on my Win98 machine but does not work on the
same
machine when booted as a Win NT Server.
The code dies on the Win32::ChangeNotify->new line.
(No error message is displayed, is just says
"monitorDir.pl die on line 14". So I guess $! must be blank?)
If I change the $path to "C:" under Win NT, it runs,
but acts "funny". By "funny" I mean that it does not
stop the monitoring when I place a file in "C:".
Meanwhile, once again, on a Win98 machine, everything
works. Help!!! What the heck is wrong?
use strict;
use Win32::ChangeNotify;
# Look for any changes in the watched Dir.
# Changes include renames, deletions and creations.
my $filter = "FILE_NAME";
my ($notify);
my $path = "C:\\\\Timothymarsch\\SHARE";
my $subTree = 1;
my $retValue; # return value
$notify = Win32::ChangeNotify->new($path, $subTree,
$filter) || die $!;
$retValue = $notify -> wait or die "Something failed:
$!\n";
if ($retValue == 1) {
print "hip, hip horaay!\n";
} else {
print STDERR "$notify\n";
}
TIA,
Dave
------------------------------
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 V10 Issue 170
**************************************