[10116] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3709 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 14 12:08:32 1998

Date: Mon, 14 Sep 98 09:00:29 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 14 Sep 1998     Volume: 8 Number: 3709

Today's topics:
        "symbolic" filehandles <jeffp@crusoe.net>
    Re: "symbolic" filehandles (Mark-Jason Dominus)
    Re: ??? if ($fr "$test" $threshold) ??? jack.haberle@bigfoot.com
    Re: ANN: Backwards.pm <uri@sysarch.com>
    Re: ANN: Backwards.pm (Leslie Mikesell)
    Re: ANN: Backwards.pm <uri@sysarch.com>
        BUG, seek and read function. <okcivil@soback.kornet.nm.kr>
    Re: BUG, seek and read function. <okcivil@soback.kornet.nm.kr>
        chat2.pl-"protocol not supported" <aravind@genome.wi.mit.edu>
    Re: COBOL and Perl (Nick Spalding)
    Re: Comments on my Code? <upsetter@ziplink.net>
        CORRECTION TO: "symbolic" filehandles <jeffp@crusoe.net>
        date -a in Perl (NT) <mcrobiej@ecid.cig.mot.com>
    Re: evaling user-supplied regexes (Cookbook 6.11) <garethr@cre.canon.co.uk>
        Freelance Web Developers with Perl needed <charles@a1assured.demon.co.uk>
    Re: Help me... (David A. Black)
    Re: Help me... <labrache@gaulois.cad.cea.fr>
    Re: Help me... (Bob Trieger)
        Help: How to embed ActivePerl 5.00502 in Visual C++ <zelig@innocent.com>
        How do you check if DB_FILE database exists (Vjekoslav Balas)
        How to check for existance of a variable whose name is  (Vjekoslav Balas)
    Re: Is it better to use one big script that can do 5 ta (I.J. Garlick)
    Re: Is it better to use one big script that can do 5 ta <zenin@bawdycaste.org>
        MIME and SMTP (John Kelly)
        mod_perl configuration marad@usa.net
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Mon, 14 Sep 1998 09:35:21 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: "symbolic" filehandles
Message-Id: <Pine.GSO.3.96.980914092435.12577A-100000@crusoe.crusoe.net>

Basically, when opening a file, you can do one of two things:
	open FH, ">file" or die "Can't make 'file': $!";
	print FH "...";
	close FH;

	- or -

	use FileHandle;
	$fh = FileHandle->new();
	$fh->open "> file" or die "Can't make 'file': $!";
	print $fh "...";
	$fh->close;


Now... although the following code WORKS, is it ACCEPTED?  Do people get
shunned from the Perl community for it?  I call it "Symbolic Filehandles",
because, like symbolic references, it takes a variable and converts it to
a string, and uses it as the variable name.

	$fh = "FH";
	open $fh, ">file" or die "Can't make 'file': $!";
	print $fh "...";
	close $fh;

I understand that the docs on open() say:

	=item open FILEHANDLE

	Opens the file whose filename is given by EXPR, and associates it
	with FILEHANDLE.  If FILEHANDLE is an expression, its value is
	used as the name of the real filehandle wanted.

So, apparently, EXPR could be the variable that holds the filehandle name.
But I don't see this practiced anywhere.  Is it becoming deprecated?

--
Jeff Pinyan (jeffp@crusoe.net)
www.crusoe.net/~jeffp

Crusoe Communications, Inc.
973-882-1022
www.crusoe.net




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

Date: 14 Sep 1998 10:53:47 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: "symbolic" filehandles
Message-Id: <6tjalr$hvn$1@monet.op.net>

In article <Pine.GSO.3.96.980914092435.12577A-100000@crusoe.crusoe.net>,
Jeff Pinyan  <jeffp@crusoe.net> wrote:
>I call it "Symbolic Filehandles",
>because, like symbolic references, it takes a variable and converts it to
>a string, and uses it as the variable name.
>
>	$fh = "FH";
>	open $fh, ">file" or die "Can't make 'file': $!";
>	print $fh "...";
>	close $fh;

It's really the same thing as writing

	open FH, ...
	print FH, ...
	close FH;

because here FH is not a filehandle; it's just a string.

Lots of people do it.

One thing you can do that might be more interesting is:

	$file = '/home/mjd/public_html/index.html';
	open $file, $file or die ...;
	print while <$file>;
	close $file;

Then you get to make the filehandle name the same as the file name.

One benefit of that is that when you `die', it likes to print out the
name of the last filehandle it read from; in this case, the filehandle
name is the file name:

Too many vibrissae at nhconfig line 485, </etc/nh> chunk 11.




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

Date: Mon, 14 Sep 1998 12:37:56 GMT
From: jack.haberle@bigfoot.com
Subject: Re: ??? if ($fr "$test" $threshold) ???
Message-Id: <6tj2n4$m7k$1@nnrp1.dejanews.com>

In article <6t5vta$3et$1@nnrp1.dejanews.com>,
  jack.haberle@bigfoot.com wrote:
> I'm trying to apply a set of tests to some analysis results.  Info about the
> tests to be applied is stored in an Oracle DB.	For example, a test of
> whether a flowrate is greater than a threshold:  I am getting $test = '>' and
> $threshold = 500 correctly from the database, but as I have the brain of a
> turnip I can't seem to be able to figure out an if clause that will apply the
> test and tell me whether or not I pass.
>
> Is what I'm trying to do even possible?  If so, can anyone point me toward any
> relevant documentation and/or give me a hint?
>
> Thanks in advance!
>
> -jack

Thanks for the help; the "eval" statement is exactly what I was looking for.
Clearly I am too stupid to live, or I would have seen it for myself in the
doc. Oh well.

Tried emailing you individually but kept getting "host unknown" returns.

-jack
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum
>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 14 Sep 1998 10:34:39 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: ANN: Backwards.pm
Message-Id: <x7r9xeyd8g.fsf@sysarch.com>

>>>>> "LM" == Leslie Mikesell <les@MCS.COM> writes:


  LM> How does it compare speed-wise to reading 'tail -r' (bsd) or the
  LM> gnu 'tac' program on a pipe?

well, if you looked at the code, you can see it only works on a file as
it does seeks which don't work on pipes. it is solely meant for perl
programs to read a real file backwards by line. it does not replace any
tail type of operation.

its main virtues are that it does not read the entire file into memory
at one time and it only reads the file once.

uri




-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----------------------  Perl, Internet, UNIX Consulting
uri@sysarch.com  ------------------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: 14 Sep 1998 09:57:54 -0500
From: les@MCS.COM (Leslie Mikesell)
Subject: Re: ANN: Backwards.pm
Message-Id: <6tjati$528$1@Jupiter.Mcs.Net>

In article <x7r9xeyd8g.fsf@sysarch.com>, Uri Guttman  <uri@sysarch.com> wrote:
>>>>>> "LM" == Leslie Mikesell <les@MCS.COM> writes:
>
>
>  LM> How does it compare speed-wise to reading 'tail -r' (bsd) or the
>  LM> gnu 'tac' program on a pipe?
>
>well, if you looked at the code, you can see it only works on a file as
>it does seeks which don't work on pipes. it is solely meant for perl
>programs to read a real file backwards by line. it does not replace any
>tail type of operation.
>
>its main virtues are that it does not read the entire file into memory
>at one time and it only reads the file once.

Let me rephrase. Before this module, the handy way to read a file backwards
was:
        open(FH, "tail -r $filename |") 
	while (<FH>) {
		....
        }
On BSD systems 'tail -r' does indeed read a file line-by-line backwards, and
at least on freeBSD doesn't appear to have any built in limits.  Substitute
gnu 'tac' for 'tail -r' on non-bsd systems.  Doing it in native perl trades
the overhead of forking another process for doing the seek offset computation
in perl vs. C code.  I was just wondering if anyone had done any timing to
see if the perl module normally wins.

I'm particularly interested in this because I have a web news display program
that reads a growing file of headlines backwards to extract a screenful of
the most recent items on the selected topics and the machine is busy enough
that I would like to save the fork/exec on each run.

  Les Mikesell
   les@mcs.com


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

Date: 14 Sep 1998 11:45:33 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: ANN: Backwards.pm
Message-Id: <x7pvcyy9ya.fsf@sysarch.com>

>>>>> "LM" == Leslie Mikesell <les@MCS.COM> writes:

  LM> In article <x7r9xeyd8g.fsf@sysarch.com>, Uri Guttman
  LM> <uri@sysarch.com> wrote:

  LM> Let me rephrase. Before this module, the handy way to read a file
  LM> backwards was: open(FH, "tail -r $filename |") while (<FH>) { ....
  LM> } On BSD systems 'tail -r' does indeed read a file line-by-line
  LM> backwards, and at least on freeBSD doesn't appear to have any
  LM> built in limits.  Substitute gnu 'tac' for 'tail -r' on non-bsd
  LM> systems.  Doing it in native perl trades the overhead of forking
  LM> another process for doing the seek offset computation in perl
  LM> vs. C code.  I was just wondering if anyone had done any timing to
  LM> see if the perl module normally wins.

this was clearer. and i didn't know that was the "standard" way to read
a file backwards. the cookbook didn't mention it. :-) and we get so many
requests for this to be pure perl (for portability to POB boxes), that i
decide to write a perl version. i wasn't overly concerned with absolute
speed but as i have written it can be optimized some. hell, an XS module
could be written to be much faster!

  LM> I'm particularly interested in this because I have a web news
  LM> display program that reads a growing file of headlines backwards
  LM> to extract a screenful of the most recent items on the selected
  LM> topics and the machine is busy enough that I would like to save
  LM> the fork/exec on each run.

well, benchmark it for us! your tradeoff is forks vs. C speed. XS does
both but i am not up for writing that no. let's get this module CPANed
and used, and then a XS version can be written.

uri


-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----------------------  Perl, Internet, UNIX Consulting
uri@sysarch.com  ------------------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: 14 Sep 1998 14:45:42 GMT
From: Park <okcivil@soback.kornet.nm.kr>
Subject: BUG, seek and read function.
Message-Id: <6tja6m$o8$1@news.kornet.nm.kr>

I test two file format. one is dos, other is unix.

DOS FILE:
111:111:111
111:111:111
111:111:111

UNIX FILE:
111:111:111
111:111:111
111:111:111

It is only different "\n" code. You know, dos format is '0x0D0A'
unix is '0x0A'.

open (DATA, file);
sysseek (DATA, 0, 0);
sysread (DATA, $line, 12);  # 111:111:111
print $line, "==\n";

if use dos format datafile. it's result is...
111:111:111
==

unix is....
111:111:111
==

Next is strange..

sysseek (DATA, 12, 0);
sysread (DATA, $line, 12);  # 111:111:111
print $line, "==\n";

dos is..
111:111:111==

unix is
111:111:111
==

I think first test MUST be same as next test.
Because dos have two byte nextline code. but. it was to work like unix.

Sorry my ugly and broken English. I don't know why it work different.



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

Date: 14 Sep 1998 15:38:22 GMT
From: Park <okcivil@soback.kornet.nm.kr>
Subject: Re: BUG, seek and read function.
Message-Id: <6tjd9e$808$1@news.kornet.nm.kr>

I found a strange works about seek function.

	sysseek (DATAFILE, 0, 0);
	sysread (DATAFILE, $dbline, 36, 0);
	$dbline =~ /\x0A$/ ? print "0D0A\n" : print "none\n";
	$aaa = length $dbline;
	print "$dbline==$aaa\n";

Two print results is same through DOS format and Unix.
DATAFILE have 35 bytes text, 1 byte return code on unix,
2 bytes return code on dos. But. It was same work.

When I use 'sysseek (DATAFILE, 36, 0);', Unix format
will print with return code. But dos will not.
Because DOS have 2 bytes return code(x0D0A). So sysread
may be read 37 bytes.






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

Date: Mon, 14 Sep 1998 11:30:42 -0400
From: Aravind Subramanian <aravind@genome.wi.mit.edu>
Subject: chat2.pl-"protocol not supported"
Message-Id: <35FD36A2.BEE349A2@genome.wi.mit.edu>

Scripts that require chat2.pl produce a "protocol not supported" mesage
on my solaris 2.5 machine, with perl5.00404

Though the c header files were converted by running h2ph I've read that
this is unreliable.

Someone mentioned that a solution is to use the version of chat2.pl that
uses Socket.pm (that uses the c header files directly thus eliminating
the uncertainity associated with the h2ph conversion ?)

I'd appreciate any suggestions / hints.

Thanks,

aravind





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

Date: Mon, 14 Sep 1998 11:28:26 +0100
From: spalding@iol.ie (Nick Spalding)
Subject: Re: COBOL and Perl
Message-Id: <3603eebb.60098343@news.iol.ie>

Craig Berry wrote:
 
> That's actually a lot uglier than it needs to be.
> 
>   s/(\w+)/\u\L$1/g;
> 
> does the same thing more readably (at least IMO).  (And actually, this
> version will go from any mix of capitalization into initial-capital,
> trailing-lowercase form, though of course that's an unneeded 'feature' for
> your spec.) 
> 
> : Yes, I do realize how ugly this is.
> 
> As a general rule, when something easily expressible like "initial-cap,
> trailing-lowercase all words" ends up looking ugly as a Perl expression,
> it should indicate you've not found the best way to write the Perl
> expression.  "Making easy things easy," as the saying goes.

The fun with 'proper casing' begins when you deal with personal names,
MacAdam, FitzWilliam, O'Reilly etc.


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

Date: Mon, 14 Sep 1998 15:08:45 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Comments on my Code?
Message-Id: <1kaL1.50$7C3.811412@news.shore.net>

Ronald J Kimball <rjk@coos.dartmouth.edu> wrote:
: Scratchie <upsetter@ziplink.net> wrote:

:> I recently wrote a command-line mass-mailing utility. I would like to post
:> the code here and invite (contructive) comments and criticism. Anyone who
:> assumes that this is going to be used for spam will be roundly ignored.

: Pray tell, what is it going to be used for?

Mass mailings.

--Art

--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: Mon, 14 Sep 1998 09:37:53 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: CORRECTION TO: "symbolic" filehandles
Message-Id: <Pine.GSO.3.96.980914093641.12814A-100000@crusoe.crusoe.net>

Basically, when opening a file, you can do one of two things:
	open FH, ">file" or die "Can't make 'file': $!";
	print FH "...";
	close FH;

	- or -

	use FileHandle;
	$fh = FileHandle->new();
	$fh->open "> file" or die "Can't make 'file': $!";
	print $fh "...";
	$fh->close;

Now... although the following code WORKS, is it ACCEPTED?  Do people get
shunned from the Perl community for it?  I call it "Symbolic Filehandles",
because, like symbolic references, it takes a variable and converts it to
a string, and uses it as the variable name.

	$fh = "FH";
	open $fh, ">file" or die "Can't make 'file': $!";
	print $fh "...";
	close $fh;

I understand that the docs on open() say:

	=item open FILEHANDLE

	=item open FILEHANDLE, EXPR

	Opens the file whose filename is given by EXPR, and associates it
	with FILEHANDLE.  If FILEHANDLE is an expression, its value is
	used as the name of the real filehandle wanted.

So, apparently, FILEHANDLE could be the variable that holds the filehandle
name. But I don't see this practiced anywhere.  Is it becoming deprecated?

--
Jeff Pinyan (jeffp@crusoe.net)
www.crusoe.net/~jeffp

Crusoe Communications, Inc.
973-882-1022
www.crusoe.net



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

Date: Mon, 14 Sep 1998 14:50:21 +0100
From: Jamie McRobie <mcrobiej@ecid.cig.mot.com>
Subject: date -a in Perl (NT)
Message-Id: <35FD1F1D.4F833A71@ecid.cig.mot.com>

Does anyone know how to adjust the system time on NT (using Perl32 -
Reskit) to perfrom the same functinallity as date -a?
i.e. adjust the time from 10.30 to 10.34 by speeding up the syetm clock
by a set ammount , until the 4 minutes is reclaimed?

 ta J.


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

Date: Mon, 14 Sep 1998 10:37:06 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: evaling user-supplied regexes (Cookbook 6.11)
Message-Id: <si7lz7kmjx.fsf@cre.canon.co.uk>

Carl Brock Sides <opus@magibox.net> wrote:
> Why is this safe:
>
>   eval { "" =~ /$pattern/ };
>
> when this is dangerous?
>
>   eval "/$pattern/";
>
> The dangerous example from the Perl Cookbook is:
>
>   $pattern = "@{[system('rm -rf *')]}";

The first expression performs interpolation of variables only, when the
regular expression is evaluated.

The second expression performs interpolation of variables twice: once
when the string is evaluated and a second time when the regular
expression is evaluated.

The following program demonstrates the effect:

  #!perl -w
  
  $a = '$b';
  $b = 'foo';
  print eval { 'foo' =~ /$a/ } ? "yes" : "no", "\n";
  print eval "'foo' =~ /$a/" ? "yes" : "no", "\n";

-- 
Gareth Rees


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

Date: Mon, 14 Sep 1998 16:51:30 +0100
From: "Charles Goodall" <charles@a1assured.demon.co.uk>
Subject: Freelance Web Developers with Perl needed
Message-Id: <905788034.20368.0.nnrp-01.c2ded930@news.demon.co.uk>

One of our clients, based in London, is currently looking for Freelance /
Contract Web Developers.
Our client is one of Europe's most successful New Media agencies, working
for clients such as Hewlett-Packard, Saatchi & Saatchi and The National
Lottery. They are seeking considerable demand for their services and
currently need to recruit high calibre individuals to join their team.
Our client is always interested in hearing from talented freelance Web
Developers. They offer contracts that range from a few weeks to a number of
months. You will have the opportunity of working in a lively environment in
the heart of the UK's creative hub.
You will have a degree in Computer Science or another science / engineering
/ numerate discipline. You should be passionate about New Media and have
strong views about its future direction. You will already have commercial
experience building web sites. A good team player, you should be a self
starter familiar with working in a commercial environment and have a strong
eye for detail.
Job/Skills Description:
Excellent knowledge of web development and design issues.
Very strong programming skills in some of the following are required:
- JavaScript
- Perl
- Active Server Pages,
- CGI (under UNIX)
- Expert HTML
Technical skills in some or all of the following areas are highly desirable:
- Java, VBScript, DHTML, etc.
- Database integration - SQL, ODBC, etc.
- UNIX (especially IRIX 5.3)
- Microsoft Internet Information Server
- Web server administration
- C, C++ or similar procedural or object-orientated languages
- Skills in Director and Lingo (versions 5.0/6.0) would be an advantage.
Background Information
Our client is a rapidly growing new media agency. The projects they
undertake pose many and various challenges and they pride themselves in
producing innovative yet appropriate technical solutions.
There are currently 15 full time staff members and you will have the
opportunity of working on a wide variety of projects  The current set-up
means that you will work closely with other technical staff, account
managers and project managers.
If you are interested in this vacancy please send your resume to Charles
Goodall at charles@a1assured.demon.co.uk




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

Date: Mon, 14 Sep 1998 05:58:53 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: Help me...
Message-Id: <6tipct$hda$1@earth.superlink.net>

Hello -

Your program is extremely difficult to read, thanks to the lack
of indentation.  However, I can read enough to see that you don't
use CGI.pm, but rather write your own CGI data processing code.
The first thing you should do is rewrite the program using CGI.pm,
which will make it shorter, clearer, more robust, and easier to
debug.

David Black
dblack@saturn.superlink.net


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

Date: Mon, 14 Sep 1998 16:13:54 +0100
From: Laurent LABRACHERIE <labrache@gaulois.cad.cea.fr>
Subject: Re: Help me...
Message-Id: <35FD32B2.F4F1C508@gaulois.cad.cea.fr>

I've tested your script  :

and then:


syntax error at test.cgi line 61, near "print"
Unmatched right bracket at test.cgi line 62, at end of line
syntax error at test.cgi line 62, near "; }"
Execution of test.cgi aborted due to compilation errors.


YOU MISS A BRACKET
}
else
# here after the bracket
{
print "Content-type: text/html\n\n";
print "You have allready voted!<br>"; }




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

Date: Mon, 14 Sep 1998 15:23:20 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Help me...
Message-Id: <6tjccr$88a$1@strato.ultra.net>

[ posted to usenet and courtesy e-mail sent ]

"Mattias Kristoffersen" <mattias@mjolby.nu> wrote:
-> Soon im going nuts!
-> Whats wrong, this scrip doesn4t work as it should.
-> The allready voted function dosent work...
-> 
-> Mattias
-> 
-> #!/usr/bin/perl
-> #
-> $ip = $ENV{REMOTE_ADDR};
-> $filen = "resultat.dat";
-> if ($ENV{'REQUEST_METHOD'} eq 'GET') {

-->> SNIPOLA <<--

You have 7 problems:
1. You aren't using the -w operator.
2. You aren't using strict.
3. You aren't checking the status of your opens.
4. You aren't indenting your code for readability.
5. You aren't using cgi.pm.
6. You missed a bracket.
7. You didn't look at your error log which would have pointed out #6.


HTH

Bob Trieger              | `Sparks International' is spamming and 
sowmaster@juicepigs.com  | trying to help us lose weight. Let's do 
                           them a favor. Call to let the know that
                           spamming is evil and do it on their dime.

                           Call 1-888-689-3097


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

Date: Mon, 14 Sep 1998 11:54:28 +0200
From: Zelig <zelig@innocent.com>
Subject: Help: How to embed ActivePerl 5.00502 in Visual C++
Message-Id: <35FCE7D4.A0F5B885@innocent.com>

Hi all,

The Goal:
I've ActivePerl 5.00502 (self extracting APi502e.exe 5,045KB) installed
on my machine and I want to embed a Perl interpreter inside C++ code
using Visual C++ 5.0.

The Problem:
I tried the procedure described in perlembed documentation, the
following:

    "You may wish to use a more robust environment such as the MS
Developer stdio. In this case, to generate perlxsi.c run:
   perl -MExtUtils::Embed -e xsinit
Create a new project, Insert -> Files into Project: perlxsi.c, perl.lib,
and your own source files, e.g. interp.c. Typically you'll find perl.lib
in C:\perl\lib\CORE, if not, you should see the CORE directory relative
to perl -V:archlib. The studio will also need this path so it knows
where to find Perl include files. This path can be added via the Tools->
Options-> Directories menu. Finnally, select Build -> Build interp.exe
and you're ready to go!"

but it doesn't work. perl.lib is (should be) perlcore.lib in
ActiveState's Perl (perl -V:archlib outputs
archlib='C:\Perl\5.00502\lib\MSWin32-x86-object').
I get errors when building; here they are:
 ...
interp.obj : error LNK2001: unresolved external symbol _perl_free
interp.obj : error LNK2001: unresolved external symbol _perl_destruct
interp.obj : error LNK2001: unresolved external symbol _perl_run
interp.obj : error LNK2001: unresolved external symbol _perl_parse
interp.obj : error LNK2001: unresolved external symbol _perl_construct
perlxsi.obj : error LNK2001: unresolved external symbol _Perl_newXS
perlxsi.obj : error LNK2001: unresolved external symbol _boot_DynaLoader

LINK : error LNK2001: unresolved external symbol _mainCRTStartup
 ...

I was told that it is because with ActivePerl I get a DLL file with only
one exported function in it which should returns a pointer to a C++
class; the perl funtionalities can then be accessed by calling member
functions of this class.
The problem is that I did not find any info about such a function and
about the C++ class. Could someone write me the procedure to get
started? I'd much appreciate a copy of a simple Visual C++ workspace
with all the stuff inside and ready to be built.

Many thanks.

Ugo Di Profio




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

Date: 14 Sep 1998 15:27:35 GMT
From: eedvab@eed.ericsson.se (Vjekoslav Balas)
Subject: How do you check if DB_FILE database exists
Message-Id: <6tjcl7$7lk5@aken.eed.ericsson.se>


Hi,
I use DB_FILE with syntax of following form depending if
reading or writing:

   tie %contents, DB_File, $sys_improv_database, O_RDONLY, 0640 || &io_error();
OR
   tie %contents, DB_File, $sys_improv_database, O_RDWR|O_CREAT, 0664 || &io_error();

Now, I'm not clear on what "|| &io_error()" is for - initially I thought this 
subroutine would be executed if the $sys_improv_database does not exist,
but that is not the case. 

My questions:
(a)Under what conditions is subroutine  io_error executed in statement
above ?
(b)How does one check existance of the database - is the only way by
just checking existance of the database file $sys_improv_database ?
OR is there some other inbuilt (DB_FILE) function which is used to do that ?

Thanks,
Vjeko

eedvab@eed.ericsson.se



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

Date: 14 Sep 1998 15:38:15 GMT
From: eedvab@eed.ericsson.se (Vjekoslav Balas)
Subject: How to check for existance of a variable whose name is generated on the fly
Message-Id: <6tjd97$7lk6@aken.eed.ericsson.se>

Hi,
(some of the info is cgi/form related, but problem is perl related)
I generate a form whose contents is a list of checkboxes whose name/value
are record numbers in a database - this way user can select the records he/she
wishes. Once the form data is processed by a perl script, all form data
enters as a hash of the form : Formdata{name}

Question - if one knows the form of the name (eg a pure record number
or a comination of a specific string concatenated with the record number),
is there a way that one can check if any one or more of the names 
have been received ?

At the moment, I can only think of a way to check for each of the possibilities
and come to a conclusion from this eg

names are : record1, record5,record7
then, knowing max record no, do a (if defined) check for each.
Any other ideas ?

Thanks,
Vjeko

eedvab@eed.ericsson.se




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

Date: Mon, 14 Sep 1998 09:23:01 GMT
From: ijg@csc.liv.ac.uk (I.J. Garlick)
Subject: Re: Is it better to use one big script that can do 5 tasks or 5 smaller scripts for each task?
Message-Id: <Ez9oqD.3q1@csc.liv.ac.uk>

In article <35fc08e5.579185@news.iaehv.nl>,
Free-4-All@Cryogen.com (Serial # 0) writes:
> Hello,
> 
[snipped]
> I was thinking, if someone want to log in they will have to load this
> huge script while they are only using a small part of it. Won't it be
> better to make 5 little scripts for each of the task described
> above???

This is a damned good question and one I am continually asking myself.

I seem to be asking it when ever I use CGI.pm. Why you may be asking?

Well I read somewhere (here I think) that it is faster to load CGI.pm than
to use and load CGI::Form and it's bretheren. It will probably help to put
things into perspective CGI.pm is approx 184K while CGI::Form.pm is approx
54K. As far as I can tell everything in Form.pm is available in CGI.pm plus
a lot more. I then started asking myself why CGI.pm should be loaded faster
and eventually came to the following conclusion, which may be way of base,
which I offer here to be flamed.

I think Form.pm pulls in (uses) other modules that are built in to CGI.pm,
since each new package needs to be interpreted and then compiled, this takes
longer as each file/package must be found and read in. CGI.pm however is
found once and read in.

I have never bothered to look in either package to prove this nor am I that
interested really it was just puzzeling at the time. Again this is probably
asking to be flamed.

In your case five smaller scripts are probably what is needed, or better
still 6. The sixth contains the bits of code that are common to all scripts,
this way they should never get out of sync and you are not including the same
code in each script.

If you intend to use mod_perl in the future however I would put them in one
script as once it is loaded by apache it stays there so there is no
performance gain or loss doing it this way.


Hope this rambling planted some seeds/answers to your question.



-- 
--
Ian J. Garlick
ijg@csc.liv.ac.uk

"It's men like him that give the Y chromosome a bad name."



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

Date: 14 Sep 1998 14:44:44 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Is it better to use one big script that can do 5 tasks or 5 smaller scripts for each task?
Message-Id: <905783991.17802@thrush.omix.com>

I.J. Garlick <ijg@csc.liv.ac.uk> wrote:
: Well I read somewhere (here I think) that it is faster to load CGI.pm than
: to use and load CGI::Form and it's bretheren.

        Yep.

        >snip<
: I think Form.pm pulls in (uses) other modules that are built in to CGI.pm,
: since each new package needs to be interpreted and then compiled, this takes
: longer as each file/package must be found and read in. CGI.pm however is
: found once and read in.

        It's more magical then that.  CGI.pm uses a non-standard, but very
        quick, autoload system.  Very little is actually compiled unless you
        use it.  Unlike the more standard systems, CGI.pm's autoloader never
        requires multiple file reads or the "all or nothing" __END__ system.
        It's pretty slick, if funky to look at. :-)

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Mon, 14 Sep 1998 15:50:32 GMT
From: john.kelly@citicorp.com (John Kelly)
Subject: MIME and SMTP
Message-Id: <35fe3b05.10703370@news.citicorp.com>

Hi,

	 Can anyone point me in the right direction.
I written an application that generates a mime message using 
MIME::Entity.
It sends this mime message by opening a pipe to sendmail.

I also have several application that use NET::SMTP and generate 
mail messages using this interface.

My question is can I somehow use the two together, meaning generate 
a mime body parts and send it through the SMTP interface?
I have tried several different ways of doing this and it appears 
that I need to set up the mail header to contain several mime header
information
(i.e. Content-Type: multipart/mexed; boundary="..."
Mime-version: x.x 
X-Mailer: ....)
where the last two are probably optional.
Without these headers the body parts become part of the text.
There doesn't seem to be a way in the NET::SMTP to add headers.

I would like to run these scripts on several systems that don't run a
local sendmail (NT is one of them.)

I noticed that there is a sendmail module that seems to allow me to do
some of the things that I want to.
Is this the way to go, or did a miss something and I am creating a
huge problem?

Thanks
	John


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

Date: Mon, 14 Sep 1998 15:18:57 GMT
From: marad@usa.net
Subject: mod_perl configuration
Message-Id: <6tjc51$ukk$1@nnrp1.dejanews.com>

Well, I said I would post here when my problem was solved, and now it is!
First, I must in particular thank Mark Anderson, who provided enough advice
to keep me trying different things until it worked. Thanks to the others who
also provided useful information. I learned a whole lot about how Apache and
mod_perl work together in the process. This is what I did to fix the problem:

1. Mark had me recompile Apache and mod_perl using the APACI static all-in-one
method. I might have done this the first time, but it was a good idea anyway,
because apparently the DSO method has some problems. I still received the same
errors after doing this.

2. I modified my srm.conf. These are the cgi and perl related entries:

ScriptAlias /cgi-bin/ /usr/apache/share/cgi-bin/
AddHandler cgi-script .cgi
AddHandler perl-script .pl

3. I modified my access.conf. These are the cgi and perl related entries:

<Directory /usr/apache/share/cgi-bin>
AllowOverride None
Options ExecCGI
</Directory>

Alias /perl /usr/apache/share/perl
<Location /perl>
SetHandler perl-script
PerlHandler Apache::Registry
Options ExecCGI
allow from all
PerlSendHeader On
</Location>

#I probably don't need the stuff below, but I haven't tried without it yet
<Files *.pl>
SetHandler perl-script
PerlHandler Apache::Registry
Option ExecCGI
</Files>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

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 3709
**************************************

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