[10614] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4206 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 12 15:08:00 1998

Date: Thu, 12 Nov 98 12:00:21 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 12 Nov 1998     Volume: 8 Number: 4206

Today's topics:
        Breathtakingly concise Perl code (Sean McAfee)
    Re: DIE or Similar (Charles DeRykus)
    Re: environment variables (brian d foy)
    Re: Exit UNIX from within a perl program <benh@xs4all.nl>
    Re: expect with perl jbharvey@corp.home.net
        flock <rorym@cogapp.com>
    Re: HELP , I just can figure this out <d-edwards@nospam.uchicago.edu>
    Re: HELP!  Concat'ing multiple variables into one <dlincoln@ultrainteractive.com>
    Re: how to define global variables across files with th (Charles DeRykus)
    Re: Is there a compiler for Perl? <wallenborn@phys.chem.ethz.ch>
        Lazy Perl Bastards (Patrick Timmins)
    Re: mod_perl question <tsmeyer_remove_this_part@fnal.gov>
    Re: Net::FTP in CGI Solved <mvdbijl@inedita.comx>
    Re: Obtaining CD identification <clinton.bodine@mci.com>
    Re: Obtaining CD identification jbharvey@corp.home.net
    Re: PERL -> SQL -> Procedure ->PERL -> HTML sborne@quicknet.net
    Re: Perl ODBC control <perlguy@technologist.com>
        perl/win95 <dropzone@mail.utexas.edu>
    Re: Q: are symbolic refs really needed (was Re: Modific <uri@fastengines.com>
    Re: retrieving and archiving mail jbharvey@corp.home.net
        Return Data to Form - How? <u2537@shurflo.com>
    Re: Return Data to Form - How? jbharvey@corp.home.net
    Re: Return Data to Form - How? <cgormley@netcomuk.co.uk>
    Re: Return Data to Form - How? jbharvey@corp.home.net
    Re: Searching and Parsing text from HTML file <coop1x33@nortel.com>
    Re: Searching and Parsing text from HTML file (brian d foy)
    Re: Selena Sol's form_processor <gellyfish@btinternet.com>
        Suidperl? <matt@pcr7.pcr.com>
    Re: The Perl Institute? <merlyn@stonehenge.com>
    Re: The Perl Institute? (Dave Cross)
        This is flocking tricky <cgormley@netcomuk.co.uk>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Thu, 12 Nov 1998 18:18:28 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Breathtakingly concise Perl code
Message-Id: <UDF22.6361$fS.20909691@news.itd.umich.edu>

I've recently gotten into an X Windows game called "Spellcast" (see
http://www.edoc.com/zarf/spellcast.html).  The game pits two or more
players against each other as wizards, who cast spells by making hand
gestures with each hand.  Each spell consists of a set sequence of
gestures; when any spell's sequence is completed by either hand, the spell
goes off.

Spells may overlap; that is, if the last gesture(s) for one spell are the
same as the first gesture(s) of another, you can proceed directly from the
end of the first spell into the middle of the second.

After a few games, I wanted to analyze the spells to find the most
efficient combinations.  The C source code to the program defines the spell
gestures in an array of structs like the following, which I put into the
__DATA__ section of my script:

    {3, {D,  P,  P},        1, 0, "Amnesia"},
    {3, {S,  P,  F},        0, 0, "Anti-Spell"},
    {5, {D,  W,  F,  F,  D2},    1, 0, "Blindness"},

(D = pointing digit, P = palm outward, F = fingers spread, etc.)

The first thing to do was to get this information into an appropriate Perl
data structure.  A hash of arrays seemed the most appropriate:

%spells = (
    "Amnesia"    => [qw/ D P P /],
    "Anti-Spell" => [qw/ S P F /];
    "Blindness"  => [qw/ D W F F D2 /],
    ...
);

After a few code iterations, I was eventually able to populate my data
structure with a single line:

@spell{ /"(.+?)"/ } = [ /[A-Z]\d?(?=[,}])/g ] while <DATA>;

Oooooooo!  *Fantastic!*  I was patting myself on the back for days.

Anyone else care to share any wonderfully concise Perl code?

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: Thu, 12 Nov 1998 18:24:03 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: DIE or Similar
Message-Id: <F2Bn43.MEA@news.boeing.com>

In article <910786404.1084.0.nnrp-11.c2de97e4@news.demon.co.uk>,
Adam Carden <adam@2kmedia.co.uk> wrote:
>I have created a set of subroutines which are strore in the file security.pl
>and then called when needed.
>
>One of the subroutines needs to kill the entire process with no futher
>messages (it outputs an error page first) I have tried die but this still
>lets the child process continue.
>
>I need to shut the security script and the calling script with no further
>messages. Is their an easy way to do this?
>

If manually forking, you could simply save the child pid
and then kill the child before the C<die>. (perldoc -f fork) 

or, see the doc for killing entire process groups if
Sys V-ish. (perldoc -f kill)

hth,
--
Charles DeRykus


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

Date: Thu, 12 Nov 1998 13:25:42 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: environment variables
Message-Id: <comdog-ya02408000R1211981325420001@news.panix.com>

In article <364AF1FF.4B5FC2EF@mail.vt.edu>, Bill <zab@mail.vt.edu> posted:

> Does anyone have a little snippet of code that returns the address of
> the referring page?
> ie www.domain.com/directory/folder/default.html
> to return
> www.domain.com/directory/folder/
> 
> ??
> I realize that one could use the HTTP_REFERER, but I have no idea how to
> disect the string returned....

how about File::Basename?  it comes with a dirname() function:

#!/usr/bin/perl

use URI::URL;
use File::Basename qw(dirname basename);

&File::Basename::fileparse_set_fstype('UNIX'); #ughhh

$url = new URI::URL 'http://computerdog.com/brian/169th/cortina/index.html';
$dir =  dirname( $url->path );

print "@{[$url->host]}$dir";

__END__

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Thu, 12 Nov 1998 20:15:22 +0100
From: "Ben Hattem" <benh@xs4all.nl>
Subject: Re: Exit UNIX from within a perl program
Message-Id: <72fdu3$j1p$1@news2.xs4all.nl>

Zhengdong Zhang wrote in message ...
>Suppose I want to exit the Unix system after executing my
perl program.
>Can I include this step in my program? (system "exit"
doesn't work.)


Well, exec replaces the current shell while a normal
execution forks a child.

Use 'exec ./scriptname' instead of './scriptname'.

Ben




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

Date: Thu, 12 Nov 1998 19:11:45 GMT
From: jbharvey@corp.home.net
Subject: Re: expect with perl
Message-Id: <RpG22.27$_g.143166@news.rdc1.sfba.home.com>

Use the modules on CPAN like Net::FTP and Net::Telnet.  You'll thank me.
If you're still intent on using an expect-like interface, and those
above aren't enough, you can further punish yourself by using Comm.pl
:)

j

Michael Renshaw <michaelr@lndn.tensor.pgs.com> wrote:
> does anyone know the pitfalls of doing a telnet followd by an ftp
> in perls expect module. I can do them both interactively but 
> my script times out after submitting the ftp and never gets
> the "Name (host:myname): " prompt. I wondered if it was something
> to do with the output not going back to my screen like we
> normally solve in UNIX with setenv DISPLAY type syntax.

> anybody got any ideas ??

> Mike


--
Justin B. Harvey					@Home Network
@Work Software Engineer					425 Broadway
jbharvey@corp.home.net					Redwood City, CA 94063
Voice: (650) 569-5692					http://www.home.net


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

Date: Thu, 12 Nov 1998 19:09:15 +0000
From: Rory Matthews <rorym@cogapp.com>
Subject: flock
Message-Id: <364B325B.D3EC7DAE@cogapp.com>

I have taken over some perl databasing routines that seem to be causing
a problem which I think has to do with database contention. I suspect
that this might have something to do with the flock routine not doing
its stuff and indeed the perl documentation says that some systems may
not implement flock.

Can someone give me the low down on how good flock is at locking out a
file or point me in the direction of successfully locking out files.

I thank you.



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

Date: Thu, 12 Nov 1998 18:18:31 GMT
From: Darrin Edwards <d-edwards@nospam.uchicago.edu>
Subject: Re: HELP , I just can figure this out
Message-Id: <tgbtmcydu0.fsf@noise.bsd.uchicago.edu>

rjk@coos.dartmouth.edu (Ronald J Kimball) writes:

> ~> perl -w
> my %Marge;
> my $Homer = "Mmm";      # $Homer is initialized; value is "Mmm"
> $Homer = $Marge{lisa};  # $Homer is unitialized again; value is undef
> print $Homer, "\n";     # printing unitialized value gives a warning
> 
> Use of uninitialized value at - line 4.

D'oh.  I was apparently thinking of something like

 noise:~>perl -w               
 my $Homer = 3;
 my %Marge;
 if ($Homer > $Marge{lisa}) {
    print "Bigger...\n";
 } else {
    print "Not bigger...\n";
 }

 Use of uninitialized value at - line 3.
 Bigger...

which was where I usually see those kinds of errors, and which was
what I (think I) meant by "using" the key in the hash...
But the orginal poster's question did involve _assignment_, so I was
off on that. :(

Darrin


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

Date: Thu, 12 Nov 1998 14:21:35 -0500
From: "D. Davis" <dlincoln@ultrainteractive.com>
To: brian d foy <comdog@computerdog.com>
Subject: Re: HELP!  Concat'ing multiple variables into one
Message-Id: <364B3537.863834D4@ultrainteractive.com>

brian d foy wrote:

> how about skipping the array?
> 
>    $search_terms = "$input{'level'}$input{'topic'}$input{'subject'}";
> 
> if you need something between them, just put it between them:
> 
>    $search_terms = "$input{'level'} $input{'topic'} $input{'subject'}";
> 
> or
> 
>    $search_terms = "$input{'level'},$input{'topic'},$input{'subject'}";

Yup. Been there done that.  No dice.

The problem seems to be related to setting a single dimension variable with
multiple cells... however using quotes SHOULD turn the variables into strings,
no?  PERL handles big strings fine in every other context I've used.

I still wonder if this is related to some brainless syntactical error on my part.

-d-


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

Date: Thu, 12 Nov 1998 19:12:41 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: how to define global variables across files with the "use strict" on?
Message-Id: <F2BpD5.39C@news.boeing.com>

In article <3648D091.B74704F4@cs.engr.uky.edu>,
Huar En Ng  <heng00@pop.uky.edu> wrote:
>I am working on a multiple files perl program.  I would like to have a
>file to store all the global variables and be able to be "included" in
>other files.  However, I would also like to turn on the "use strict"
>flag.
>
>	Seems like the "use strict" would now let me use a variable declared in
>another file.  So I tried to created a package "global.pm" and "use
>Global" as a work around.  To my surprise, none of the exported
>variables are visible in files that "use global".
>
>	I know in C, we can use things like extern int x, but in Perl ???
>
>Here is how my global.pm look like:
>
>*****************************************
>package Global;
>
>use strict;
>
>BEGIN {
>  use Exporter   ();
>  use vars       qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
>  @ISA         = qw(Exporter);
>  @EXPORT      = qw($DEBUG 
>                    $MENU_CGI
>                    %MENU_ITEMS
>                   );
>  
>  @EXPORT_OK   = qw();                    
>  %EXPORT_TAGS = ( );
>}
>
>$MENU_CGI = "./cgi-bin/menu.pl";
>%MENU_ITEMS = ("c" => "Continue",
>               "q" => "Quit");
>

You'll need to package qualify the variables in the
two lines above since running C<use strict>.

But, the bigger problem is that Perl supports method 
inheritance only. Since you have no constructor and
object container, there's no way to sneak in some
variables. 

You could roll your own import though from the module
user side,  e.g,

use Global;
BEGIN { *MENU_CGI   = \$Global::MENU_CGI;
        *MENU_ITEMS = \%Global::MENU_ITEMS 
      }

or, maybe, even create a method in Global that'd accept 
a package argument and then manually export items into
that package.



hth,
--
Charles DeRykus


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

Date: 12 Nov 1998 19:33:51 +0100
From: Ernst-Udo Wallenborn <wallenborn@phys.chem.ethz.ch>
Subject: Re: Is there a compiler for Perl?
Message-Id: <uiemr8kbg0.fsf@bacon.ethz.ch>




> On Thu, 12 Nov 1998 12:19:53 +0100, Jan Bessels
> <j.bessels@wolverine.demon.nl> wrote:
> 
> >When writing commercial programs distributing executables instead of the
> >original Perl source code is very attractive. The main advantage here
> >isn't speed but unreadability...


there's two groups of people you might not want to read your
code. 1) Hackers on the net who might scan your CGI script
for weaknesses, and 2) legit customers, who might figure
they don't need to pay a wizard but rather retroengineer 
your programs and do it themselves.

In any decent OS you can set permissions to prevent 1) (if that's
not true for your favourite OS, get a new OS). As to 2), well,
if your job depends on hiding your lack of genius, get a new job.



cpierce1@mail.ford.com (Clinton Pierce) writes:
 
> Some people would consider the ability to just distribute a single
> executable and a library or two the biggest win in a perl compiler.
> (And utilities along the lines of "perl2exe".)
> 
> Personally, I do this all the time.  It's MUCH easier to install 1 EXE
> file and 2 DLL files (even if they are 3MB) than to unroll the entire
> GSAR perl distribution onto a system.  Especially if your customer
> couldn't give a whit about development.  I usually include the source
> code in the distribution but for installation and distribution purposes,
> nothing beats compiling/perl2exe'ing...


That's not compiling. That's linking. And that's a good question:
Is there a perl linker for unix? If not, any chance there will be one?


-- 
Ernst-Udo Wallenborn
Laboratorium fuer Physikalische Chemie
ETH Zuerich


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

Date: Thu, 12 Nov 1998 18:32:27 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Lazy Perl Bastards
Message-Id: <72f9jr$ai9$1@nnrp1.dejanews.com>

I'm sorry, but this is funny. And since many Perl types
*are* lazy, I thought it appropriate for c.l.p.m.

see www.despair.com

particularly the Steve Jobs and Microsoft Partnership items
under the "New Spin" section.

Patrick Timmins
$monger{Omaha}[0]

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 12 Nov 1998 12:45:42 -0600
From: Tom Meyer <tsmeyer_remove_this_part@fnal.gov>
Subject: Re: mod_perl question
Message-Id: <364B2CD6.9328B283@fnal.gov>

Craig Sprout wrote:

>
> #!/usr/bin/perl
> my $r = Apache->request;
> $r->content_type("text/html");
> $r->send_http_header();
> ...
>
> Any thoughts or ideas?  Thanks in advance for the help.  Feel free to
> email me if you need more information.

Try removing the

#!/usr/bin/perl

line altogether.  This does not appear to be needed, or wanted in
mod_perl.  At least it has worked for us.




Craig Sprout wrote:

> I hope that this isn't a newbie question, but I am new to perl, and am
> having some problems with mod_perl and Apache.
>
> I am using perl 5.004_04, Apache 1.3.3, and these versions of the
> following modules:
> Apache-SSI 1.98
> CGI.pm 2.43
> Data-Dumper 2.09
> HTML-Parser 2.20
> HTML-SimpleParse 0.05
> MIME-Base64 2.08
> Msql-Mysql-modules 1.2005
> libnet 1.0605
> libwww-perl 5.36
> mod_perl 1.16
>
> I compiled all the perl modules with no problem, using the following
> steps:
> # perl Makefile.PL
> # make
> # make test
> (if everything worked out OK...)
> # make install
>
> I compiled httpd from the mod_perl source tree, and the messages
> indicate that mod_perl is in there and working fine.
>
> (from logs/error_log)
>
> [Sun Nov  8 08:49:39 1998] [notice] Apache/1.3.3 (Unix) mod_perl/1.16
> configured -- resuming normal operations
>
> The problem occurs when I try to access one of the perl scripts in the
> cgi-bin directory.  I get this:
>
> "Can't locate object method "request" via package "Apache" at
> /cgi-bin/myscript.pl line 2."
>
> In httpd.conf, I have:
>
> PerlModule      Apache::Registry
> <Location /home/httpd/cgi-bin/>
>         SetHandler      perl-script
>         PerlHandler     Apache::Registry::handler
>         PerlSendHeader  On
>         Options         ExecCGI
> </Location>
>
> In srm.conf, I have:
>
> <Location /home/httpd/cgi-bin/>
> Options +ExecCGI +All +Includes
> </Location>
>
> Which are redundant.
>
> I've tried the "PerlHandler" directive as "Apache::Registry" and what
> you see above.
>
> The first part of the script follows:
>
> #!/usr/bin/perl
> my $r = Apache->request;
> $r->content_type("text/html");
> $r->send_http_header();
> ...
>
> Any thoughts or ideas?  Thanks in advance for the help.  Feel free to
> email me if you need more information.
>
> -Craig

--
Tom Meyer
Fermi National Accelerator Laboratory
tsmeyer_remove_this_part@fnal.gov




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

Date: Thu, 12 Nov 1998 18:13:32 +0100
From: Meindert van der Bijl <mvdbijl@inedita.comx>
Subject: Re: Net::FTP in CGI Solved
Message-Id: <364B173C.6F38@inedita.comx>

Problem solved. 
For a virtual host the root directory is changed,
because of this getprotobyname can't find the
/etc/protocols file. Creating this file in the
etc directory that the virtual host is looking 
for, solved the problem.


I wrote:
> 
> I have written a CGI perl script that uses Net::FTP to
> connect to a remote ftp server. When invoked from the
> shell the script works fine. But from a browser the
> line:
> 
> my $ftp = Net::FTP->new("some.host.name") or die print "error: $@";
> 
> gives an error: Cannot determine protocol
> 
> As far as I can see the function getprotobyname('tcp') returns
> undef when the script is invoked from the browser (it returns
> '6' when invoked from the shell).
> 
> Why? What can I do about it?
> 
> I use Linux, Perl 5.004_04 (i686-linux), Apache (virtual host)
> 
> Meindert
> mvdbijl@inedita.com


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

Date: Thu, 12 Nov 1998 12:27:30 -0700
From: "CBodine" <clinton.bodine@mci.com>
Subject: Re: Obtaining CD identification
Message-Id: <FBG22.690$d81.914@pm01nn>

Sam's right that this isn't a Perl question, but I'll assume you'll write
Perl code to do this....

Check out
 http://www.cddb.com/ftp/cddb-docs/cddb_howto.txt
and look at Appendix A.


>On Thu, 12 Nov 1998 06:49:49 +0000, Brad Cavanagh <cavanagh@uvic.ca> wrote:
>>How would I go about determining the CD id code for a CD that's in the
>>drive?






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

Date: Thu, 12 Nov 1998 19:39:30 GMT
From: jbharvey@corp.home.net
Subject: Re: Obtaining CD identification
Message-Id: <SPG22.31$_g.165373@news.rdc1.sfba.home.com>

There is also a CDDB module in CPAN.

j
CBodine <clinton.bodine@mci.com> wrote:
> Sam's right that this isn't a Perl question, but I'll assume you'll write
> Perl code to do this....

> Check out
>  http://www.cddb.com/ftp/cddb-docs/cddb_howto.txt
> and look at Appendix A.


>>On Thu, 12 Nov 1998 06:49:49 +0000, Brad Cavanagh <cavanagh@uvic.ca> wrote:
>>>How would I go about determining the CD id code for a CD that's in the
>>>drive?






--
Justin B. Harvey					@Home Network
@Work Software Engineer					425 Broadway
jbharvey@corp.home.net					Redwood City, CA 94063
Voice: (650) 569-5692					http://www.home.net


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

Date: Thu, 12 Nov 1998 19:15:53 GMT
From: sborne@quicknet.net
Subject: Re: PERL -> SQL -> Procedure ->PERL -> HTML
Message-Id: <72fc58$crg$1@nnrp1.dejanews.com>

Have you tried the ODBC module (www.roth.net/odbc) I have had no problems and
am running the same server/database set-up(different Perl version)




In article <58k02.24$_i2.44842@198.235.216.4>,
  jhardy@cins.com (John Hardy) wrote:
>
> Forgot to mention I am running on IIS 4.0 and WINNT Server 4
>
> ActiveState 5.005_02  build 504
>
> In article <32k02.22$_i2.44842@198.235.216.4>, jhardy@cins.com says...
> >
> >
> >Can anyone point me in the right direction to find Documents, FAQ's, or GOOD
> >EASY examples dealing with WIN32::OLE to communicate with MsSql.
> >
> >I have searched everywhere I can think of, I have read all the PERL FAQ's I
> >could find, including the ODBC FAQ's and whatever OLE FAQ's that are out
> there.
> >
> >I do not want to use DBI - DBD
> >
> >I have found many examples using OLE with Excel, Acces and Word but not one
> >good example for MsSQL. I just started using SQL so I need something that
any
> >idiot could understand. I have been to several Computer book stores and
cannot
> >find anything directly related to the subject. Of course there is nothing
> >related to PERL in the MsSQL online books.
> >
> >What I am trying to do is really quite simple but I have been trying to
figure
> >it out for so long I think I have developed some kind of Mental block !!!
> >
> >any help would be extremely appreciated.
> >
> >
> >Tom , you seem to know where all documentation sit's, you must know where I
> can
> >find some on this subject. :-)
> >
> >
> >Thanks
> >
>
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 12 Nov 1998 18:53:15 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: Perl ODBC control
Message-Id: <364B2E9B.5DFC538B@technologist.com>

Geoff Caylor wrote:
> 
> Hello-
> 
> I'm looking for a way to write to a database (either modifying an existing
> record, or creating a new one), and haven't found any documentation or
> leads...
> 
> Any help is greatly appreciated!
> 
> Geoff Caylor

Where are you looking?

I suggest http://www.perl.com and then click on the "Database" item in
the left column.

www.perl.com is THE best place to begin, don't forget about it!

HTH,
Brent
-- 
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$            Brent Michalski             $
$         -- Perl Evangelist --          $
$    E-Mail: perlguy@technologist.com    $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


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

Date: Thu, 12 Nov 1998 13:39:48 -0600
From: forrest reynolds <dropzone@mail.utexas.edu>
Subject: perl/win95
Message-Id: <364B3982.19EA7BFD@mail.utexas.edu>

Anyone know how to run a script on a Win 95  machine? In other words,
_where_   do
I type "perl hello.pl"?

                                 Thanks, Forrest



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

Date: 12 Nov 1998 14:22:19 -0500
From: Uri Guttman <uri@fastengines.com>
Subject: Re: Q: are symbolic refs really needed (was Re: Modification of a read-only??)
Message-Id: <saru30490no.fsf@camel.fastserv.com>

>>>>> "RS" == Randal Schwartz <merlyn@stonehenge.com> writes:

>>>>> "Uri" == Uri Guttman <uri@sysarch.com> writes:
  Uri> this may be one of the few areas, hacking the symbol table. but most
  Uri> users will never need such tricks. so making use strict 'refs' a default
  Uri> may be a good idea. you can easily turn it off when doing black magic.

  RS> Can't.  Breaks perl4 proggies that did this:

  RS> 	$function = "beat_it";
  RS> 	&$function("some args", "go here");

  RS> In fact, the whole soft-ref thing is nothing more than an extension
  RS> of this one special case in Perl4 of an "indirect function call".

i don't recall this in perl4 (which does not mean it didn't exist :-). 

how about then just disabling by default variable soft refs? the reason
i bring it up because of the number of newbies using soft refs instead
of hashes.

this would be for topaz and you could enable them with a no pragma for
porting to perl6. but their use would be deprecated.

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: Thu, 12 Nov 1998 19:32:03 GMT
From: jbharvey@corp.home.net
Subject: Re: retrieving and archiving mail
Message-Id: <TIG22.29$_g.143166@news.rdc1.sfba.home.com>


On CPAN: Mail::POP3Client

j
Bob Donovan <bob.donovan@sdrc.com> wrote:
> Hi,

> I need to write a perl tool that checks for mail messages on a POP
> server, retrieves, and archives them for later viewing.

> Does anyone know how to do this?

> Thank you,
> Bob


--
Justin B. Harvey					@Home Network
@Work Software Engineer					425 Broadway
jbharvey@corp.home.net					Redwood City, CA 94063
Voice: (650) 569-5692					http://www.home.net


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

Date: Thu, 12 Nov 1998 18:05:57 GMT
From: Thomas Beardshear <u2537@shurflo.com>
Subject: Return Data to Form - How?
Message-Id: <364B22B5.F053A23@shurflo.com>

I'm trying to write a cgi script which create a file containing data
from a text area when the user submits it. But I want to do some error
checking and tell the user whether the attempt was successful or not. If
not successful, then I want to refill the textarea with the data that
the user entered and allow him to retry.

The user runs "addtopic.pl"
the Submit button runs "processtopic.pl" which checks the data and
forwards back to addtopic.pl

I've put $query->dump in both scripts. processtopic.pl displays the data
from textarea field in addtopic.pl, but I can't get addtopic.pl to see
the data from processtopic.pl.





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

Date: Thu, 12 Nov 1998 19:06:54 GMT
From: jbharvey@corp.home.net
Subject: Re: Return Data to Form - How?
Message-Id: <ilG22.26$_g.143166@news.rdc1.sfba.home.com>

OK, if the user just goes to addtopic.pl, you'll have to write it in
such the way that the CGI will know when: a) the user has hit it for
the first time and b) the user is coming back after doing a process-
topic.pl.  

This is very similar to using a CGI script to call itself, since in
the case of (a) there will be no params passed to the script, so you can
do this;

if ($query->param()) {
    $textareadefault = "";
} else {
    $textareadefault = $query->param('textarea');
}


So then later in your script you can do the:


print $query->textfield(-name=>'textarea',
                            -default=>$textareadefault,
                            -size=>50,
                            -maxlength=>80);

And voila.  If you're a returning user of the script, it'll fill in the 
$textareadefault, if you're not it sets it to nothing.

But you're coming from processtopic.pl, so this CGI will have to create
a hidden field and send it over to addtopic.pl (hidden fields are a good
way to pass data from subsequent CGI's to the next):

$textarea = $query->param('textarea)'
print $query->hidden(-name=>'textarea',
                        -default=>$texarea);

Also, use CGI for your filename extensions.

j

Thomas Beardshear <u2537@shurflo.com> wrote:
> I'm trying to write a cgi script which create a file containing data
> from a text area when the user submits it. But I want to do some error
> checking and tell the user whether the attempt was successful or not. If
> not successful, then I want to refill the textarea with the data that
> the user entered and allow him to retry.

> The user runs "addtopic.pl"
> the Submit button runs "processtopic.pl" which checks the data and
> forwards back to addtopic.pl

> I've put $query->dump in both scripts. processtopic.pl displays the data
> from textarea field in addtopic.pl, but I can't get addtopic.pl to see
> the data from processtopic.pl.

--
Justin B. Harvey					@Home Network
@Work Software Engineer					425 Broadway
jbharvey@corp.home.net					Redwood City, CA 94063
Voice: (650) 569-5692					http://www.home.net


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

Date: Thu, 12 Nov 1998 19:32:07 -0000
From: "Clinton Gormley" <cgormley@netcomuk.co.uk>
Subject: Re: Return Data to Form - How?
Message-Id: <72fd32$qln$1@taliesin.netcom.net.uk>

Just on the tail end of your reply, you say
">Also, use CGI for your filename extensions."

I'm using .pl for all of my cgi scripts (running on Apache).  Is this a
problem?

Do I need to reconfigure anything on Apache (UNIX based) to make it
recognise .cgi scripts as .pl scripts?

Thanks

Clint




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

Date: Thu, 12 Nov 1998 19:39:04 GMT
From: jbharvey@corp.home.net
Subject: Re: Return Data to Form - How?
Message-Id: <sPG22.30$_g.165373@news.rdc1.sfba.home.com>

It's a personal preference, but if it's CGI IMHO you should call it CGI. :)

If you want .cgi to be recgonized as cgi...

srm.conf:
AddHandler cgi-script .cgi


j
Clinton Gormley <cgormley@netcomuk.co.uk> wrote:
> Just on the tail end of your reply, you say
> ">Also, use CGI for your filename extensions."

> I'm using .pl for all of my cgi scripts (running on Apache).  Is this a
> problem?

> Do I need to reconfigure anything on Apache (UNIX based) to make it
> recognise .cgi scripts as .pl scripts?

> Thanks

> Clint




--
Justin B. Harvey					@Home Network
@Work Software Engineer					425 Broadway
jbharvey@corp.home.net					Redwood City, CA 94063
Voice: (650) 569-5692					http://www.home.net


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

Date: Thu, 12 Nov 1998 13:06:49 -0500
From: "Vassiliou, Vasos" <coop1x33@nortel.com>
Subject: Re: Searching and Parsing text from HTML file
Message-Id: <364B23B8.D2DA4EB6@nortel.com>

Following up on a suggestion I added the following to the code:

if ($string =~ /<META NAME\=\"DESCRIPTION\" CONTENT\=\"(.*)\">
/i) {
         $desc{$FILE} = "$1";
      }
      else {
         $desc{$FILE}=" No Description Provided "
      }

And I show it onthe screen with:

if ($include{$key} eq 'yes') {
         print "<li><a href=\"$baseurl$key\">$titles{$key}</a>
$desc{$key} \n";

      }


My problem now is that the $desc does not stop at the   ">   at
the end of the META tag, but continues and includes the whole
page
with the result of showing  the title of the page and continues
and shows the page.
Can anyone help me overcome this?

Thank you



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

Date: Thu, 12 Nov 1998 14:13:58 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Searching and Parsing text from HTML file
Message-Id: <comdog-ya02408000R1211981413580001@news.panix.com>

In article <364B23B8.D2DA4EB6@nortel.com>, "Vassiliou, Vasos" <coop1x33@nortel.com> posted:

> My problem now is that the $desc does not stop at the   ">   at
> the end of the META tag, but continues and includes the whole
> page

that's because you are using greedy (default) matching.

> Can anyone help me overcome this?

use HTML::HeadParser;

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 12 Nov 1998 19:30:59 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Selena Sol's form_processor
Message-Id: <72fd1j$e9$1@gellyfish.btinternet.com>

On Wed, 11 Nov 1998 10:11:16 +0100 Claus Larsen <cl@herningfolkeblad.dk> wrote:
> Hallo
> 
> I'm looking for Selena Sol's form processor 4.0 or something like it. 

<snip>

I have only one thing to say:

<CODE>

# First tell Perl to bypass the buffer. ...

 ..

$! = 1;

</CODE>

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>


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

Date: Thu, 12 Nov 1998 14:29:14 -0500
From: "Matt Heusser" <matt@pcr7.pcr.com>
Subject: Suidperl?
Message-Id: <LEG22.255$KL3.1759@news14.ispnews.com>


Folks --

If anyone could point me in the direction of
some documentation on suidperl, it'd be
appreciated.  I've checked the FAQ's,
"Learning Perl", "Programming Perl" and
"Programming Perl with CGI" to no avail.

thanks,

Matt H.
Matt@pcr7.pcr.com




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

Date: Thu, 12 Nov 1998 17:53:39 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: The Perl Institute?
Message-Id: <8ciugku7ag.fsf@gadget.cscaper.com>

>>>>> "dave" == dave  <dave@mag-sol.com> writes:

dave> Has anyone been able to connect to the TPI web page
dave> <http://www.perl.org> recently? I've not been able to for a
dave> couple of days and I've also recieved nothing from the daily TPI
dave> News Mailing List since Tuesday.

dave> Is something wrong?

The ChipMeister told me that there was some sort of Denial-of-service
attack against the perl.org host.  I'm getting intermittent
connections to it right now.

Sorry for that, but that's possible with any host on the net these
days.  Someone's getting their jollies from doing this.

print "Just another Perl Institute founder,"

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Thu, 12 Nov 1998 19:12:39 GMT
From: dave@mag-sol.com (Dave Cross)
Subject: Re: The Perl Institute?
Message-Id: <364b3228.1915681@news.demon.co.uk>


[email copy of usenet posting sent to cited author]

On Thu, 12 Nov 1998 17:53:39 GMT, Randal Schwartz
<merlyn@stonehenge.com> wrote:

>>>>>> "dave" == dave  <dave@mag-sol.com> writes:
>
>dave> Has anyone been able to connect to the TPI web page
>dave> <http://www.perl.org> recently? I've not been able to for a
>dave> couple of days and I've also recieved nothing from the daily TPI
>dave> News Mailing List since Tuesday.
>
>dave> Is something wrong?
>
>The ChipMeister told me that there was some sort of Denial-of-service
>attack against the perl.org host.  I'm getting intermittent
>connections to it right now.
>
>Sorry for that, but that's possible with any host on the net these
>days.  Someone's getting their jollies from doing this.
>
>print "Just another Perl Institute founder,"

Thanks for the info. I was thinking about some stuff you were saying
on #perl a couple of weeks ago about missing paperwork deadlines for
TPI and suspected the worst. Putting two and two together to make
about ten!

D'ya think you're under attack from Python programmers?

Dave...

dave@mag-sol.com
Sybase Contractors Resource Page: www.mag-sol.com/Sybase/
Agency Rating System: www.mag-sol.com/ARS/
London Perl M[ou]ngers: www.mag-sol.com/London.pm


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

Date: Thu, 12 Nov 1998 19:40:58 -0000
From: "Clinton Gormley" <cgormley@netcomuk.co.uk>
Subject: This is flocking tricky
Message-Id: <72fdjk$qrt$1@taliesin.netcom.net.uk>

Scenario : new information is appended to the end of a flatfile sitting on a
web server.  This file is regularly collected by FTP, then deleted and
recreated.

Problem : If somebody writes to the file after FTP commences but before file
is recreated, their data will be lost.

So, I thought of writing a script to run before FTP which did the following
(1) Locked File A (exclusive lock)
(2) Renamed File A to File B
(3) Created a new File A
(4) Unlocked this

Problem I see is this : If another script tries to exclusively lock File A
inbetween steps 1 + 2, it will wait for the file to become unlocked before
continuing.  Now File A suddenly becomes File B.  Does the second script
transfer it's lock to File B, or does it remain on File A?

Would a better solution (which I've just thought of) be to
(1) $^I='ftp';
(2) Open File A
(3) Exclusively lock File A
(4) Truncate File A
(5) Close File A;
(6) Unlock File A
(7) Download FileA.ftp

Would this work

Thanks for your help

Clint








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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 4206
**************************************

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