[10828] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4429 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 15 14:07:24 1998

Date: Tue, 15 Dec 98 11:00:24 -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           Tue, 15 Dec 1998     Volume: 8 Number: 4429

Today's topics:
    Re: ($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/) <uri@sysarch.com>
    Re: 3 perl cgi questions... <david@kasey.umkc.edu>
    Re: @$. (Tad McClellan)
        Complicated sorting problem (Bruce Z. Lysik)
    Re: Date validation (Steffen Beyer)
    Re: Decent Editor <uri@sysarch.com>
    Re: Getting error with "chomp" (Greg Ward)
    Re: Getting error with "chomp" mkahn@pro-vantage.com
    Re: How can I compare files? (Larry Rosler)
    Re: How to extract emails from HTML page <newsposter@cthulhu.demon.nl>
    Re: How to pass variable data to second CGI script ?? overfeind@my-dejanews.com
    Re: MAPLE V/Win32::OLE (Jan Dubois)
        Multithreading on Win32 asang@yahoo.com
    Re: OLE referencing problem: PerlScript, ASP and CDONTS (Jan Dubois)
    Re: OLE referencing problem: PerlScript, ASP and CDONTS (Jan Dubois)
    Re: Origin of 'local'? <david@kasey.umkc.edu>
    Re: perl + email + winnt = help? [SOLVED] <ghoti@telerama.lm.com>
    Re: Perl newbie question.. <Allan@due.net>
    Re: Perl newbie question.. <gwebbQ@Qreedtech.com>
    Re: Perl/Java cgi script with pws <pdchapin@unix.amherst.edu>
        previous page, perl vs asp <dan.albertsson@swipnet.se>
    Re: Probably a Stupid Question. dave@mag-sol.com
    Re: Q:Decimal precision ? <aqumsieh@matrox.com>
    Re: Question about NT (newbie) ixb9142@rit.edu
    Re: Scoping of sub declarations <aqumsieh@matrox.com>
    Re: Sending SMTP MAIL with Perl dave@mag-sol.com
    Re: shift. <aqumsieh@matrox.com>
    Re: STDIN and NT (Jeffrey Drumm)
    Re: the perl function split (Tad McClellan)
    Re: the perl function split dave@mag-sol.com
        Use of Modules was: Date validation) (Bill Moseley)
    Re: Using "fork" to avoid crashing script (Greg Ward)
    Re: uuencoded data in scripts failing to decode / unpac <uri@sysarch.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 15 Dec 1998 13:31:29 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: ($e_mail !~ /\w+[-\w]*\@\w+[-\w]*\.\w+/)
Message-Id: <x7btl5qmta.fsf@sysarch.com>

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

>>>>> "Uri" == Uri Guttman <uri@ibnets.com> writes:
  Uri> don't do that in public (or in certain movie houses) or you might get
  Uri> caught and convicted again! probably violate your parole too!

  Uri> :-)

  RS> And for the 72nd time... it's not *parole*, it's *probation*.
  RS> I've not been to "the big house".  I did not "get out early".

  RS> :-)

sorry, if i offended your criminal heart. and you only told me 43 times.
just don't spit on the sidewalk, just in uncle bill's face.

:-)

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: Tue, 15 Dec 1998 17:59:28 +0000
From: David L Nicol <david@kasey.umkc.edu>
Subject: Re: 3 perl cgi questions...
Message-Id: <3676A380.5DC5371F@kasey.umkc.edu>

Michael Budash wrote:

> Christian H. Knudsen wrote:

> >> $exists = -e "http://www.blah.com/images/image.gif";
> >> $size = -s "http://www.blah.com/images/image.gif";

> check out the LWP perl module. it'll do what you want, though it's a
> little more wordy to use than your example...

What would be required to extend letter file tests to handle URIs?
extending to recognize the double-slash and fire up LWP seems simpler
(and certainly more portable!) than adding URL support to the file
system -- which could cause all sorts of confusion.  Can a module extend
or override a builtin like -e or -s ?


______________________________________________________________________
 David Nicol 816.235.1187 UMKC Network Operations david@news.umkc.edu
                   92G5S="!A;F]T:&5R('!E<FP@<&%C:V5R"@``


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

Date: Tue, 15 Dec 1998 11:10:20 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: @$.
Message-Id: <s55657.88c.ln@magna.metronet.com>

om7@cyberdude.com wrote:

: I have a program which declares a variable, $file.


   Does it also give it a value?

   Declaring does not necesarily give the variable any value.

   We will be able to do a much better job of debugging your code
   if we can see your code.  ;-)


   Where is it?  (post a *small and complete* example that illustrates
                  the problem that you are having)


: Later on in the program, I have the following: push(@$file, $anothervariable).
: The program ends with the line: $file;.

: $file is not referenced anywhere else in the program.

: I'm confused as to what the @$ does above.


   It dereferences the reference in the $file variable, which won't
   work too well if $file does not contain a reference, but we
   don't know what $file contains because you did not show us.

   Show us.


: And what exactly is returned at the end.


   Nothing, likely.

   But we cannot tell without seeing the code (hint, hint)


: Any help would be much appreciated.


   Any code would be much appreciated.   ;-)


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 15 Dec 1998 13:48:23 -0500
From: eldrik@localhost.localdomain (Bruce Z. Lysik)
Subject: Complicated sorting problem
Message-Id: <m3vhjd9r7s.fsf@localhost.localdomain>

Hi Folks,

I have a sorting problem that's annoying me.

Basically I have an array of data looking like so:

esub06,some text,some more text,misc text
gsun23,some text,some more text,misc text
gsun102,some text,some more text,misc text
gsun55,some text,some more text,misc text
esub04,some text,some more text,misc text
etc...

(Each line being a member of the array). Now before I
was happy sorting on the first field normally, even
though the names wouldn't be in numerical order in the
list, just alphabetical.  (I actually used the unix
'sort' command to simplify this.) 

Unfortunately, now I have a picky person wanting them
grouped alphabetically and /then/ in nice ascending
numerical order.  Does anyone have an idea on how to
do this?  I have no idea how to go about doing it.

Thanks in advance for any help.

--
Bruce Z. Lysik  <eldrik@logrus.com>
http://www.logrus.com/~eldrik/index.cgi


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

Date: 15 Dec 1998 16:26:27 GMT
From: sb@engelschall.com (Steffen Beyer)
Subject: Re: Date validation
Message-Id: <7562jj$kge$1@en1.engelschall.com>

Clay Irving <clay@panix.com> wrote:

> In <36756a6a$0$203@nntp1.ba.best.com>,
moseley@best.com (Bill Moseley) writes:

>>Is there a 'common' way to validate input dates?
>>Is there a small module that will do this work for me?

> Date::Manip does it:

I wouldn't exactly call "Date::Manip" a "small" module, though... :-)

Cheers,
-- 
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/download/    (Free Perl and C Software
    http://www.perl.com/CPAN/authors/id/STBEY/         for Download)
    New: Build'n'Play 2.1.0 (all-purpose Unix batch installation tool)


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

Date: 15 Dec 1998 13:56:09 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Decent Editor
Message-Id: <x74sqxqlo6.fsf@sysarch.com>

>>>>> "TC" == Tom Christiansen <tchrist@mox.perl.com> writes:

  TC> nvi and vim are both fine, though.

  TC>     The more tools you bloat your main program with, the more this
  TC>     monolithic monstrosity will be loved by the masses yet disparaged
  TC>     by programmers.  See also `browser' and `emacs'.

  TC> Tools, gentlemen.  Remember your tools.

but who wants insert/edit modes in an editor? :-) i am not going to
start an emacs/vi war but you shouldn't disparage emacs so wantonly. it
is a tool too (albeit a large one). i know both editors and i choose
emacs over vi like i choose perl over tcl. i grok them better. it does
not mean they are better, but i choose them for me.

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: 15 Dec 1998 18:03:07 GMT
From: gward@thrak.cnri.reston.va.us (Greg Ward)
Subject: Re: Getting error with "chomp"
Message-Id: <75688r$fe0$2@news0-alterdial.uu.net>

Jeff Lansink <lansink@mindspring.com> wrote:
> I'm using the standard "Learning Perl" (llama) book and am only on page
> 6 and already have a problem.  I'm getting an error at the "chomp" line
> in the following code.  The script works fine when this line is
> commented out (aside from the embedded \n that chomp is supposed to
> remove!

Usually when you post questions like this, your wasting your time if you
don't explicitly state the error message you encountered.  However, in
this case I have a sneaking suspicion that you're running (gasp!) Perl 4
(because 'chomp' was added in Perl 5).  Perl 4 was rendered obsolete
roughly four years ago; apart from calling in the computer archaelogists
to document what other wildly out-of-date software you might have on
your system, you should upgrade.  Visit http://www.perl.com/ to find a
recent release for your system -- 5.00502 is the latest and greatest,
last I checked.

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: Tue, 15 Dec 1998 18:09:22 GMT
From: mkahn@pro-vantage.com
Subject: Re: Getting error with "chomp"
Message-Id: <7568ke$jlg$1@nnrp1.dejanews.com>

My guess is that you're using an older version of Perl (V4.?) that does not
support chomp.	If that's the case you should consider upgrading to the
latest release.  In the meantime use chop (read the docs on the differences
between the two).

HTH,

Mark Kahn

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


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

Date: Tue, 15 Dec 1998 09:54:06 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How can I compare files?
Message-Id: <MPG.10e042192a86911298995d@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <750on5$m57$3@csnews.cs.colorado.edu> on 13 Dec 1998 16:07:01 
GMT, Tom Christiansen <tchrist@mox.perl.com> says...
> In comp.lang.perl.misc, Pep Mico <pep_mico@hp.com> writes:
> :I'm using Perl under Windows NT. How can I compare two files? I haven't
> :found this file function in Perl Manuals. I just only need to know if
> :files are Equals or differents.
> :
> :Should I invoke COMP command from Windows NT?
> 
> If you were on a real system, you'd just call the cmp program,
> possibly only after checking that the respective st_size fields differ.
> Since you're not, you get to have much more fun.
> 
> It is distressing to see how many people who, abused by Microsoft and
> deprived of proper tools, feel compelled to recreate the wheel in Perl.
> If you want Unix (read: a programmer-friendly environment), you know
> where you find it.  If you don't want a programmer-friendly environment,
> well, then you are welcome to pay as much money as you'd like not to 
> get your job done easily.

Though two days old, evidently, your two tools-related submissions just 
hit my newsreader simultaneously.

This submission muddles the clear distinction between the Unix operating 
system and a set of programs ('commands', 'utilities', 'tools') that 
portably implement functionality independent of the operating system.  
These Unix/POSIX tools are available with commercial support (MKS 
Toolkit) or as freeware (Cygnus, GNU).  Included in MKS is an acceptable 
command interpreter (ksh) which obviates the use of the dain-bramaged 
Micro$oft cmd.exe and command.exe.  The serious deficiencies of the 
Micros..t operating systems compared to Unix are masked by these robust 
tools.

>From your other submission:

<QUOTE>
    The more tools you bloat your main program with, the more this
    monolithic monstrosity will be loved by the masses yet disparaged
    by programmers.  See also `browser' and `emacs'.

Tools, gentlemen.  Remember your tools.
</QUOTE>

You and I are both professional toolmakers, and part of our 
responsibility is to be objective about the capabilities and 
deficiencies of the tools that we make, use and recommend.  Maligning 
the POSIX (Portable Operating System [resembling] unIX) tools because of 
the horrible deficiencies of the Windows/DOS operating systems is 
inappropriate.

And portable Perl is there to glue the commands together, instead of 
bloating the main program with code that reproduces 'cmp'.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 15 Dec 1998 13:47:06 -0500
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: How to extract emails from HTML page
Message-Id: <3676AEA9.85913F5@cthulhu.demon.nl>

Matt Schuette wrote:
> 
>     How do you know he's spamming?  Maybe he happens to have a lot of
> friends whose email addresses happen to be randomly spread across the
  ^^^^^^^  Yeah, very often spam starts with 'Dear friend'

> web in various HTML documents.  And maybe his email program is not
> capable of creating an address book, so he needs to create a list of all
> of them.  Then again, he may just be trying to spam them all....

Erik


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

Date: Tue, 15 Dec 1998 16:55:49 GMT
From: overfeind@my-dejanews.com
Subject: Re: How to pass variable data to second CGI script ??
Message-Id: <7564aj$fgu$1@nnrp1.dejanews.com>


> I want to pass the data from several variables of one script.
> To a new processing script in a CGI set up.
>
> Any easy way to send
>
> $totals
>

If you are using system() or exec(), you could just add the input to the
command line: system("script2.cgi $totals");

Then in script2.cgi:
$totals = $ARGV[0];

Or you could pack your data, if you have multiple pieces of data, into a
format like the QUERY_STRING, and change QUERY_STRING to the newly packed
data. $NEW_QUERY = join("Totals","=",$totals); $ENV{'QUERY_STRING'} =
$NEW_QUERY; Then inside the second script you can access the data as usual.

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


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

Date: Tue, 15 Dec 1998 19:10:52 +0100
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: MAPLE V/Win32::OLE
Message-Id: <367a9fee.42684376@news3.ibm.net>

Guido Steiner <str@zhwin.ch> wrote:

>Is there anybody who can tell me, how I have to call the MAPLE command
>window.
>
>I already tried with several names like Win32::OLE
>->new('WMAPLE.Application') || die ... or Win32::OLE
>->new('MapleV.Application) ...blabla
>but I still have not succeeded.

Are you sure Maple V is an Automation Server? You should be able to look
up the program id from the documentation of the server.

-Jan


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

Date: Tue, 15 Dec 1998 17:15:00 GMT
From: asang@yahoo.com
Subject: Multithreading on Win32
Message-Id: <7565eh$gki$1@nnrp1.dejanews.com>

hi,
   I have looked at previous postings related to multithreading, but couldn't
get the answer. I am using Activeperl build 507 on Windows NT. It doesn't have
Thread package. Is it possible to create multiple threads from perl on WinNT ?
Does 'Thread' package come as a seperate extension?

thanks in advance

asang
--
Asang Dani

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


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

Date: Tue, 15 Dec 1998 19:10:54 +0100
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: OLE referencing problem: PerlScript, ASP and CDONTS.NewMail object
Message-Id: <367ba120.42990487@news3.ibm.net>

Matt Sergeant <matt@teamamiga.org_NOSPAM> wrote:

>bdavis@mediaphex.com wrote:
>> 
>>   matt@teamamiga.org wrote:
>> > You can only do this on AS perl build 504 and above (so make sure you
>> > upgrade), and the syntax would be:
>> >
>> > $obj->Value->SetProperty('Item', 'header', 'headervalue');
>> >
>> > (I think)...
>> 
>> The format above dies with the message:
>>     Can't call method "SetProperty" on an undefined value
>
>Oh God - not that.
>
>/me runs screaming.

No, I don't think it's *that* problem. Here the "$obj->Value" part just
doesn't return anything because value seems to expect a parameter. Calling
SetProperty on "undef" gives the error message above.

Please stop screaming! :-)

-Jan


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

Date: Tue, 15 Dec 1998 19:10:55 +0100
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: OLE referencing problem: PerlScript, ASP and CDONTS.NewMail object
Message-Id: <367ca1a8.43126602@news3.ibm.net>

[mailed & posted]

bdavis@mediaphex.com wrote:

>  jan.dubois@ibm.net (Jan Dubois) wrote:
>> >This is using the SetProperty with multiple values system. It's a
>> >horrible horrible thing. Unfortunately MS think it's useful, so you're
>> >stuck with it.
>>
>> What he said. :-(
>
>I'm definitely willing to agree that this method signature is ugly.

It's not only the signature, it's the concept of properties with
parameters that makes me shudder.

>> You need Win32::OLE version 0.10 or later.
>
>I have Win32::OLE version 0.1003, Perl 5.005_02 (ActiveState Build 507)

That should be fine.

>> I think the following is more likely:
>> $obj->SetProperty('Value', 'header', 'headervalue');
>
>Your version does not generate an error, but the headers are still not getting
>set. Is it of any help to point out that this is the default property of the
>object?

Are you running your script with "perl -w"? This is necessary to get the
full OLE error message. Alternatively, please display the value of
Win32::OLE->LastError() after the SetProperty call to check if there was
an error.

>I'm trying to pickup all of this OLE "stuff" in a hurry, but it doesn't seem
>to be working out too well for me. If I could only convince all of my clients
>that Linux was the one true answer to their problems.
>
>I'm still confused by the method's signature not containing an [in] specifier
>for the bstrHeader argument. Could someone with more OLE insight explain how
>that's supposed to work for me?

I think the [in] thing is not really important. I would hope OLE would
marshal data as [in] by default if nothing else is specified. But then
again, maybe you are right and it is a bug in the type library. One
wouldn't believe it, but the type libraries delivered with Office 97 for
Word 97 were also broken (in US and international versions) and only fixed
by SR1.


Just as a desperate measure you could try to insert the following call
just after your "use Win32::OLE;" statement:

    Win32::OLE->Initialize(Win32::OLE::COINIT_OLEINITIALIZE);

This at least seems to be necessary for MAPI.Session objects; they don't
like to run in the multithreaded apartment Win32::OLE is creating
nowadays. But I don't think you can do this in PerlScript, because the OLE
subsystem is already initialized before even the Perl interpreter starts.



One other idea: Did you try to write your code in VB? Could you please
test it with:

    Dim objNewMail As Object 

instead of

    Dim objNewMail As CDONTS.NewMail 

before calling

    Set objNewMail = CreateObject("CDONTS.NewMail")  

This forces VB to use the IDispatch interface (the one Win32::OLE uses)
and not the native VTBL one.

-Jan



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

Date: Tue, 15 Dec 1998 17:48:17 +0000
From: David L Nicol <david@kasey.umkc.edu>
Subject: Re: Origin of 'local'?
Message-Id: <3676A0E1.1B36EC14@kasey.umkc.edu>

Steven Morlock wrote:
> 
> I have had an opportunity to develop in several different
> languages and I never encountered anything quite like 'local'.

Really?  Ever "develop" in Pascal?  Local implements scoping so that
references to non-declared variables in called routines get the variable
with that name from the calling function rather than the global
namespace,
just like Pascal variables.

This is a feature which is completely absent from C/C++/Java/Basic
but is present in Pascal.  Don't know about *ol, not that old.




______________________________________________________________________
 David Nicol 816.235.1187 UMKC Network Operations david@news.umkc.edu
                   92G5S="!A;F]T:&5R('!E<FP@<&%C:V5R"@``


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

Date: Tue, 15 Dec 1998 13:47:39 -0500
From: "Adam Stoller" <ghoti@telerama.lm.com>
Subject: Re: perl + email + winnt = help? [SOLVED]
Message-Id: <3676ae5b.0@news.nauticom.net>

My winnt mail problems were solved thanks to Ken Hamer's pointer to
Christian Mallwitz's

http://www.geocities.com/SiliconValley/Park/8312/mail1a_pl.txt

Thanks to all who responded!

--fish




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

Date: Tue, 15 Dec 1998 12:55:09 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Perl newbie question..
Message-Id: <7567g5$sp8$1@camel19.mindspring.com>

bryanb@walls-media.com wrote in message <756257$dbn$1@nnrp1.dejanews.com>...
>Hello All,
>
>Is there a way to delete an entire line in a text file if perl finds a
>specific string?



   You could take a look in part 5 of the Perl FAQ which discusses:

   "How do I change one line in a file/
    delete a line in a file/
    insert a line in the middle of a file/
    append to the beginning of a file?"


AmD






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

Date: Tue, 15 Dec 1998 13:38:19 -0500
From: Garth Webb <gwebbQ@Qreedtech.com>
Subject: Re: Perl newbie question..
Message-Id: <3676AC9B.BA3D6C92@Qreedtech.com>

Hi Bryan,

You can find the information you need in the 'perlre' man page.  The
answer to your example is:

$phrase = "This is really cool";
$phrase =~ s/really cool//g;

Garth

bryanb@walls-media.com wrote:

> Hello All,
>
> Is there a way to delete an entire line in a text file if perl finds a
> specific string?
>
> Say I have a phrase "This is really cool" and anytime I find the phrase
> "really cool" I want that line deleted from the file.
>
> Thanks for the help.
>
> Bryan
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own

----------------------
Garth Webb
Software Developer
Reed Technology and Information Services
gwebbQ@Qreedtech.com

(To reply to me, please remove the 'Q's from my email address.  Thanks.)





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

Date: Tue, 15 Dec 1998 13:45:35 -0500
From: "Paul Chapin" <pdchapin@unix.amherst.edu>
Subject: Re: Perl/Java cgi script with pws
Message-Id: <3676ae5a.0@amhnt2.amherst.edu>

>Just guess, Did you setup PWS to run Perl scripts as CGI properly?


Yes.  I can write a simple perl script and have it execute properly.

I've been wondering if it's having problem with the CLASSPATH variable
making it unable to find the class file.  I originally tried including a
path in the class name inside of the java invocation, but eventually it came
to me that the result was that it was looking for a class of that name - one
that included the path.  That didn't even work on the Unix box.  I suppose I
should go back and see that the CLASSPATH in the autoexec file doesn't have
a typo.

BTW, is having the server throw up a DOS window when trying to execute the
script an expected behavior?  Seems pretty kludgy to me.

-----
Paul Chapin
UNIX Manager
Amherst College
413 542-2144
http://www.amherst.edu/~pdchapin




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

Date: 15 Dec 98 18:08:42 GMT
From: "Dan Albertsson" <dan.albertsson@swipnet.se>
Subject: previous page, perl vs asp
Message-Id: <01be2855$f663f630$5701a8c0@dan>

I have seen on different shopping websites, written in ASP, that if you
update a page (for instance your shopping cart) and then press your
browsers Back button, the browser does not show how the page look like
before you updated it.

Is that possible to do with cgi-scripts written in Perl. Because otherwise
it messes up my shopping application when visitors starts to move back in
history (goes to previous webpages my cgi-script has produced). Is it
possible to perhaps instruct the browser not to remember the page that was
shown before or realy replace it with the new one so you can't go back to
the previous one.

Thanks
/dan



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

Date: Tue, 15 Dec 1998 17:36:41 GMT
From: dave@mag-sol.com
Subject: Re: Probably a Stupid Question.
Message-Id: <7566na$hrk$1@nnrp1.dejanews.com>

[Probably a Stupid Subject - please choose a more descriptive one in future!]

In article <36765C0F.BEC2CCDC@q-net.net.au>,
  Design-A-Web Australia <trilogy@q-net.net.au> wrote:
> Hi all.
>
> I have just started into the wonderful world of adding and using Perl to
> enhance the websites that I develop.
>
> Well I have been tasked to create a very simple 'shopping cart' for
> about 12 items where the visitor selects an item and is then displayed
> at the order page.
>
> Question 1. Can anyone direct me to a set of scripts or Modules (I think
> that is what they are called) to allow me to set up the shopping cart.

Try places like <http://www.cgi-resources.com>. Avoid anything written by Matt
Wright.

> Question 2. I use a dial-up connection to my ISP and they allow the
> running of scripts and the placing of them into a cgi-bin on the
> account Can I just upload the scripts to their server and they would
> work?. They do support Perl.

There will probably be some configuration necessary. The script (or scripts)
should come with instructions of the things to change.

> Question 3. I run windows 95 and I am pretty sure I installed the
> correct version of Perl onto my System. I did this so I could test the
> scripts I use in the webpages with the 'Shopping Cart" stuff..
> If I put the same scripts I use in the C:/Perl/bin on my system that I
> would upload to my ISP will they work the same eventhough I run Win 95
> and my ISP is a Unix based system..

To test CGI you'll need a web server running on your PC. Apache is the one
that most people use and the PC version is pretty stable now. Get it from
<http://www.apache.org>.

> I am pretty sure I can incorperate the scripts quite easily in the pages
> but it is knowing what scripts and how to configure them that is the
> hard bit..
>
> I am really sorry to ask these questions but I am really new to all this
> CGI stuff and I really need some help to set up a shopping cart on a
> site that I am creating..

Hope this helps. Please note in future that you should be careful where you
post any followup questions. There are separate groups for the discussion of
CGI programming and web servers. Try to make sure you post questions to the
appropriate groups.

Dave...

--
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>

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


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

Date: Tue, 15 Dec 1998 11:25:01 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Q:Decimal precision ?
Message-Id: <x3yk8zt74pu.fsf@tigre.matrox.com>


Margarit Nickolov <man@digsys.bg> writes:

> I get the next result:
> a=-6.93889390390723e-18
> 
> I think the precision is not too high, but result is too bugous.
> I neeed a precision of 2-3 digits after the decimal point.
> my email: man@digsys.bg

Read perldoc4:

     Why am I getting long decimals (eg, 19.9499999999999)
     instead of the numbers I should be getting (eg, 19.95)?



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

Date: Tue, 15 Dec 1998 17:52:59 GMT
From: ixb9142@rit.edu
Subject: Re: Question about NT (newbie)
Message-Id: <3676a17d.337318298@news.kodak.com>

Okay,

I now just noticed that if I use the string comparison operator 'cmp'
and the two strings are identical, then it really does return a zero,
but all other comparison operators I've used both numeric and string
don't seem to be returning zeros when they should.

Ian Blake
ixb9142@rit.edu

On Tue, 15 Dec 1998 16:16:56 GMT, ixb9142@rit.edu wrote:

>Hi,
>I just started to teach myself PERL yesterday.  I am using a book that
>was designed for Unix but I am on NT.  For the most part things have
>been the same with a few minor differences.  One thing I am wondering
>about though.  It seems that If you compare two values and the result
>is false, then instead of returning a zero, NT will return a null
>character.  Is this true?  Will this really affect anything I am
>trying to do in the future.  Does a null character mean false in NT?
>Any info would be certainly helpful.  This is also my first time
>posting to this group.  Could people please e-mail because I'm not
>sure how often I'll be checking here, although I could become a
>regular reader.  Thanks
>
>Ian Blake
>ixb9142@rit.edu



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

Date: Tue, 15 Dec 1998 11:34:24 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Scoping of sub declarations
Message-Id: <x3yiufd74a7.fsf@tigre.matrox.com>


"Clinton Gormley" <cgormley@netcomuk.co.uk> writes:

> So would formatlines be local to form1 or form2, or would it be available to
> the whole of the main:: package?  Will redeclaring it within a different
> block always work?  or is my program likely to get confused.

It will be available to the whole package .. witness:

% perl -w
sub tt {
        sub gg {
                print "YEAH.\n";
        }
        gg();
        print "OK.\n";
}
 
tt(); gg();
__END__
YEAH.
OK.
YEAH.

If you would like to redeclare a function, then I suggest you create a
reference to it instead, and dereference it whenever you want to call
the sub.

my $r_sub = sub {
		blah;
		blah;
		};

	        ^^^
	don't forget the semicolon there

Now, $r_sub is just a scalar that magically disappears when its scopes
ends. It is also not related to any other variables $r_sub declared in
a different scope.

Side note: you might want to experiment with the idea of closures. I
find them intriguing and extremely useful sometimes.

Hope this helps,

Ala



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

Date: Tue, 15 Dec 1998 17:41:48 GMT
From: dave@mag-sol.com
Subject: Re: Sending SMTP MAIL with Perl
Message-Id: <75670s$i1j$1@nnrp1.dejanews.com>

In article <36765F3A.7C710E5A@inrfasoft-civil.com>,
  Yoann Le Corvic <yoann.lecorvic@inrfasoft-civil.com> wrote:
> I have a scrip to send SMTP Mail with perl, but, I would like to modify
> it so that I can send an attachement with it. This attachment would be
> an html file.
> Is there a way to attach a file to an E-Mail sent with perl.

Get MIMETools or MIME:Lite from CPAN, <http://www.perl.com/CPAN/>.

Dave...

--
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>

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


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

Date: Tue, 15 Dec 1998 11:37:00 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: shift.
Message-Id: <x3yhfux745v.fsf@tigre.matrox.com>


om7@cyberdude.com writes:

> 
> Can someone please tell me what the following does
> 
> my $variablename = shift;
> 
> It's being called inside a sub routine.

I believe it elevates the variable into a higher level in the
subroutine's stack.

Why don't you RTFM?



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

Date: Tue, 15 Dec 1998 17:48:11 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: STDIN and NT
Message-Id: <36779c7a.80876249@news.mmc.org>

[posted and mailed]

On Tue, 15 Dec 1998 16:40:59 GMT, ksimpson@my-dejanews.com wrote:

>I'm new to NT, but if I have the following in a Perl script,
>
>while (<STDIN>) {
>  print $_;
>}
>
>why would echo a block of test | script.pl
>
>yield no output? I also tried putting the text in a file
>and used script.pl < file.dat.

>From someone who has spent some time in both Unix and NT, my observation is
that NT just doesn't deal properly with piping/redirection on "associated"
files. However, if you invoke your script as an argument to the perl
executable as below:

C:\> perl script.pl <file.dat
     ^^^^
or

C:\> echo a block of text | perl script.pl
                            ^^^^

You should see more reasonable results. Also, you can use the pl2bat script
to turn your programs into "batch" files, with which redirection is
reported to work.

-- 
                           Jeffrey R. Drumm, Systems Integration Specialist
                                  Maine Medical Center Information Services
                                     420 Cumberland Ave, Portland, ME 04101
                                                        drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me


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

Date: Tue, 15 Dec 1998 11:15:33 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: the perl function split
Message-Id: <lf5657.88c.ln@magna.metronet.com>

Marco Vlemmings (marcov@ctrl-v.nl) wrote:

: Here is the piece of code.
: @rows = split (/\|\n/,$chunks[0]);
: In the array rows will be split by the two caracters pipe and carrage
: return, 


   You mean newline (line feed, ASCII 10 decimal), 
   not carriage return (ASCII 13).

   Carriage return is denoted \r in regexen.


: but it does not split at all.


   Are you _certain_ that $chunks[0] contains multiple lines?


: How can i split on a carrage
: return?


   @rows = split /\r/, $chunks[0];

   But now you have changed to a question different from your
   original, leaving us wondering which one it is that you want
   answered   ;-)


-------------------------
#!/usr/bin/perl -w

$chunks[0] = 'foo|
bar|
baz';

@rows = split (/\|\n/,$chunks[0]);

foreach (@rows) {
   print "$_\n";
}
-------------------------


   Works fine for me...


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 15 Dec 1998 17:45:03 GMT
From: dave@mag-sol.com
Subject: Re: the perl function split
Message-Id: <75676u$ich$1@nnrp1.dejanews.com>

In article <367673C8.F41F6F27@ctrl-v.nl>,
  Marco Vlemmings <marcov@ctrl-v.nl> wrote:
> Hi,
>
> I have a problem with the function 'split'.
> I want to split a ascii file.
> Here is the piece of code.
> @rows = split (/\|\n/,$chunks[0]);
> In the array rows will be split by the two caracters pipe and carrage
> return, but it does not split at all.How can i split on a carrage
> return?

Your code is splitting on '|' followed by a newline, not '|' or a newline. You
need to reread perldoc perlre.

Dave...

--
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>

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


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

Date: 15 Dec 1998 18:16:58 GMT
From: moseley@best.com (Bill Moseley)
Subject: Use of Modules was: Date validation)
Message-Id: <3676a79a$0$228@nntp1.ba.best.com>


> I wrote:
>> Is there a 'common' way to validate input dates?
>

In article <754ubb$85k$1@en1.engelschall.com>, sb@engelschall.com says...

>Perl modules are you friend.
>
>You might want to check out Date::Calc or Date::Manip from CPAN

I'm developing on a Win95 machine, and the scripts will live on
a number of different unix systems when done.  

I added Date::Manip to my ActiveState installation -- 
Manip.pm is 250K in size.

Clearly, I'm new at most of this.  I'm wondering how people decide 
when to use modules:

Adding a 250K module to my 30K script seems like a lot of baggage
to just verify a date.

And then there's the issue of Date::Manip not being available on the target
machines.  How do programs gracefully deal with missing modules, if, for
example, the script gets moved to a new machine w/o the module?

$happy = install_CPAN_mod('Date::Manip') if missing_module('Date::Manip');

Any wisdom from the experienced?


P.S.: Are the full man pages for the CPAN modules available via the web or
do I have to download and install to view them?


As always, Thanks,


--------------
Bill Moseley
moseley@best.com



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

Date: 15 Dec 1998 17:55:14 GMT
From: gward@thrak.cnri.reston.va.us (Greg Ward)
Subject: Re: Using "fork" to avoid crashing script
Message-Id: <7567q2$fe0$1@news0-alterdial.uu.net>

JT <jett1not@homedot.com> wrote:
> 	I have a mass-mail script which I've successfully modified to
> accomodate my client, the problem is my server only allows 64
> processes to be forked simultaneously. We need to mail a list of 2500
> addresses at a time. I'm running this on  BSDI 3.1 running Apache and
> Perl v.5.004_04

Since you write coherently and don't sound like a scam artist, I'll
assume you're not doing this for spamming.  If you *are* a spammer,
please don't read any of the replies to your post -- we don't want you
learning any more about Perl.  ;-)

I think there are a couple of ways to approach this problem:
   * invoke sendmail once per recipient: will take a *long* time, and
     could heavily load the system (I believe sendmail forks before 
     it's finished processing, but after it has spent some time: this
     gives you the worst of both worlds, in that your script has to
     wait for the original sendmail process to finish, *and* the forked
     children can build up and bog your system down)
   * fork your own process, invoking sendmail in each child: I think
     you've already figured out why this is a good idea
   * invoke sendmail once, with all the recipient addresses on 
     the command line: works great for a few dozen (maybe even a few
     hundred) addresses, but won't work for a really long list

Like every other budding Perl hacker, I once wrote a mass mail script
(wearing a white hat!) myself, and the way I solved this problem is to
split the list of recipients up into chunks that can fit on a sendmail
command line.  That is, I go for the last approach, but with a hack to
workaround command line overflows.  It works great -- most of the time,
sendmail is only invoked once, and even if it's invoked a couple of
times, it doesn't load the system heavily (I suspect sendmail processes
all the recipients serially in the background -- so it will take a long
time to clear the queue, but it doesn't bog things down).

Send me email if you want the source to my bulkmail script -- I'm *not*
going to post it to USENET!

In a completely non-Perl vein, if you're doing a lot of mail processing
you might consider one of the replacement MTAs that have come along
recently.  smail, Zmailer, Qmail, and a few others that I can't remember
off the top of my head all claim to be more secure, faster, and easier
to configure that sendmail.  I can vouch for Qmail as being pretty easy
to install and configure, but I have no performance-related experience
with any of them.

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: 15 Dec 1998 13:43:32 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: uuencoded data in scripts failing to decode / unpack ?
Message-Id: <x790g9qm97.fsf@sysarch.com>

>>>>> "JB" == Jihad Battikha <jbattikha@highsynth.com> writes:

hi jihad,

never seen you post here!

  JB> @gifuue = (<DATA>);

no need for the (), @gifuue provides a list context.

  JB> $gifbin = join ('', @gifuue);
      ^^^^^^^
and since you are just joining DATA to a big string, you could do it a
couple of other ways. just assign it using a here doc or undef $/ and
read it in one slurp:

	$/ = undef ;
	$gifuue = <DATA>


  JB> if ($ARGV[0]) {
  JB>   # binmode (STDOUT); # same result, with/without
  JB>   $gifbin = unpack ("u", $gifuue);
                               ^^^^^^^

it helps if you use the correct variable names! you are unpacking an
empty variable. a tip is not to use the same names for scalars and
arrays even though it is allowed. it can get confusing.

  JB> @gifuue = (<DATA>);
  JB> $gifuue = join ('', @gifuue);
  JB> if ($ARGV[0]) {
  JB>   # binmode (STDOUT); # same result, with/without
  JB>   $gifbin = uudecode ($gifuue);

this one seems to have the right variables so i don't know what is
wrong. but my previous comments still hold.

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: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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