[21781] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3985 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 17 06:06:01 2002

Date: Thu, 17 Oct 2002 03:05:11 -0700 (PDT)
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, 17 Oct 2002     Volume: 10 Number: 3985

Today's topics:
    Re: [cgi] How to read user file <bernard.el-hagin@DODGE_THISlido-tech.net>
        Code behaves differently depending on surrounding code (Sean McAfee)
        convert array to a hash (Mary Wong)
    Re: convert array to a hash <Tassilo.Parseval@post.rwth-aachen.de>
    Re: convert array to a hash (Jay Tilton)
        How to write a wc utility in Perl? (Soon)
    Re: How to write a wc utility in Perl? rolf.schaufelberger@web.de
    Re: How to write a wc utility in Perl? <bernard.el-hagin@DODGE_THISlido-tech.net>
    Re: How to write a wc utility in Perl? <nobody@nowhere.com>
        idea to build an online game (kit)
    Re: idea to build an online game <bernard.el-hagin@DODGE_THISlido-tech.net>
    Re: idea to build an online game (Jay Tilton)
        loops i guess, among other things <stuff@nowhere.com>
    Re: loops i guess, among other things <krahnj@acm.org>
        Ok, so why does this one not work??? <cschoute@liacs.nl>
    Re: OLE Automation via Perl (Bryan Castillo)
    Re: Perl and DDE (Sam Holden)
        PROB: Using Perl for calc.. dates <ken_mahi@hotmail.com>
    Re: PROB: Using Perl for calc.. dates (Jay Tilton)
    Re: Problems with perl.org/perlmongers.org websites and <bart.lateur@pandora.be>
    Re: Problems with perl.org/perlmongers.org websites and <Tassilo.Parseval@post.rwth-aachen.de>
    Re: Read a single character from STDIN (W98) <bart.lateur@pandora.be>
    Re: regular expressions... really don't get it! <linux@dds.nl>
    Re: regular expressions... really don't get it! <linux@dds.nl>
    Re: regular expressions... really don't get it! <Tassilo.Parseval@post.rwth-aachen.de>
        Sending argument to perl <cakes@doentreply.com>
    Re: Sending argument to perl <bernard.el-hagin@DODGE_THISlido-tech.net>
    Re: Sleeping until another process finishes? <s_grazzini@hotmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 17 Oct 2002 05:27:41 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: [cgi] How to read user file
Message-Id: <slrnaqsiev.12b.bernard.el-hagin@gdndev25.lido-tech>

In article <2abb9911.0210160717.11155fce@posting.google.com>, edvjacek
wrote:
> Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net> wrote in
> message news:<slrnaqqcil.12b.bernard.el-hagin@gdndev25.lido-tech>...
>> In article <2abb9911.0210160129.48f22d8d@posting.google.com>,
>> edvjacek
>> wrote:
>> > Hallo,
>> > 
>> > I have to read normal user file in my cgi script. The directory has
>> > 0700 and the file 0600. How can I make?
>> 
>> 
>> What is your Perl question?
> 
> This script I write in Perl.


So?


Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'


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

Date: Thu, 17 Oct 2002 07:25:44 GMT
From: mcafee@artemis.transmeta.com (Sean McAfee)
Subject: Code behaves differently depending on surrounding code
Message-Id: <1034839549.587175@palladium.transmeta.com>

I have a Perl routine that counts the number of screen lines that a
given block of text (stored in $_) would take up, given a screen width.
Tab expansion is taken into account.  I've found that for a particular
large block of text, this counting routine takes a very long time.
However, when I remove it from its (huge) parent program in order to
test it, it performs its computations speedily, returning 14602 for the
text in question.

In the main program, I removed the guts of the routine's main loop,
having it return the hardcoded right answer.  This is the shortest version
of the routine that takes a very long time:

sub count_lines {
    while (/\n/g) {
        ;
    }
    return 14602;
}

This routine took almost 3.5 minutes to return the answer in the main
program.  But when I excised this routine exactly as shown, and stored it in
a file prepended only with this code:

open FILE, './MyHugeFile' or die;
read FILE, $_, -s FILE;
close FILE;

print count_lines();

 ...it printed the answer in less than half a second.  (MyHugeFile contains
the text that is fed to the routine in the larger program.)

Can anyone suggest a reason that the routine might behave differently
depending on the code which surrounds it?  No tying or other magic is going
on (intentionally, at least).  And the regex is very simple; it employs no
backtracking or other techniques that can potentially cause regex
evaluation to take a long time.

-- 
Sean McAfee                                            mcafee@transmeta.com
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!


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

Date: 16 Oct 2002 21:52:39 -0700
From: mary_wong1232002@yahoo.com (Mary Wong)
Subject: convert array to a hash
Message-Id: <5b85cd30.0210162052.3366d9c4@posting.google.com>

Hi,

I am new and learning perl.
My question is how to convert the arrays to a hash of hashes?


@isbn=(123, 456, 789);
@book=("C", "PERL", "Java");
@author("Richard", "Larry", "PETER");


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

Date: 17 Oct 2002 05:21:04 GMT
From: "Tassilo v. Parseval" <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: convert array to a hash
Message-Id: <aolhc0$4o6$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Mary Wong:

> I am new and learning perl.
> My question is how to convert the arrays to a hash of hashes?
> 
> 
> @isbn=(123, 456, 789);
> @book=("C", "PERL", "Java");
> @author("Richard", "Larry", "PETER");

You didn't say which should be the key of the first-level hash. This
uses the elements of @book:

    my %books;
    for (0 .. $#book) {
        $books{ $book[$_] } = {
            isbn => $isbn[$_],
            auth => $author[$_],
        }
    }

Or you could use map and a hash-slice:

    my %hash;
    @hash{@book} = map { {  isbn => shift @isbn, 
                            auth => $_, }        } @author;

Or perhaps even:

    my %hash;
    @hash{@book} = map { { isbn => shift @isbn,
                           auth => shift @author, } } 1 .. @book;
                           
Have you already read 'perldoc perldsc'?

Tassilo
-- 
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;


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

Date: Thu, 17 Oct 2002 05:28:03 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: convert array to a hash
Message-Id: <3dae480a.9120614@news.erols.com>

mary_wong1232002@yahoo.com (Mary Wong) wrote:

| My question is how to convert the arrays to a hash of hashes?
| 
| @isbn=(123, 456, 789);
| @book=("C", "PERL", "Java");
| @author("Richard", "Larry", "PETER");

What kind of structure do you want the resulting HoH to have?
It's not clear what the primary (secondary, tertiary...) keys should
be.

If an array of hashes suits the task, try this.

    #!perl
    use warnings;
    use strict;
    my @isbn=(123, 456, 789);
    my @book=("C", "PERL", "Java");
    my @author=("Richard", "Larry", "PETER");
    my @hashes;
    push @hashes,
        {
            isbn => shift @isbn,
            book => shift @book,
            author => shift @author,
        }
        while @isbn || @book || @author;



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

Date: 17 Oct 2002 00:53:51 -0700
From: scyeang@hotmail.com (Soon)
Subject: How to write a wc utility in Perl?
Message-Id: <1a7061d5.0210162353.555143bb@posting.google.com>

I would like to write a program in Perl that work like wc in UNIX with
option -l, -w, and -c


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

Date: Thu, 17 Oct 2002 09:56:04 +0200
From: rolf.schaufelberger@web.de
Subject: Re: How to write a wc utility in Perl?
Message-Id: <aolqc1$4ii$05$2@news.t-online.com>

Soon wrote:

> I would like to write a program in Perl that work like wc in UNIX with
> option -l, -w, and -c
Fine. Just write it. Where is the problem?

-- 
Rolf Schaufelberger
rolf.schaufelberger@web.de


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

Date: Thu, 17 Oct 2002 07:55:05 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: How to write a wc utility in Perl?
Message-Id: <slrnaqsr3b.12b.bernard.el-hagin@gdndev25.lido-tech>

In article <1a7061d5.0210162353.555143bb@posting.google.com>, Soon
wrote:
> I would like to write a program in Perl that work like wc in UNIX with
> option -l, -w, and -c


What have you tried so far?


Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'


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

Date: Thu, 17 Oct 2002 20:03:45 +1000
From: "Gregory Toomey" <nobody@nowhere.com>
Subject: Re: How to write a wc utility in Perl?
Message-Id: <GNvr9.54841$g9.159125@newsfeeds.bigpond.com>

Soon wrote in message <1a7061d5.0210162353.555143bb@posting.google.com>...
>I would like to write a program in Perl that work like wc in UNIX with
>option -l, -w, and -c

Congratulations.

gtoomey




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

Date: 16 Oct 2002 23:46:21 -0700
From: manutd_kit@yahoo.com (kit)
Subject: idea to build an online game
Message-Id: <1751b2b5.0210162246.742f5fc7@posting.google.com>

Could any of you please show me how to run a game on one computer and
then it should to connect to another game player's machine?

Are there any open source example that I can learn from making this
kind of online game?

Please give me some suggestions.

Thanks for your help.
Kit


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

Date: Thu, 17 Oct 2002 06:50:50 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: idea to build an online game
Message-Id: <slrnaqsnas.12b.bernard.el-hagin@gdndev25.lido-tech>

In article <1751b2b5.0210162246.742f5fc7@posting.google.com>, kit wrote:
> Could any of you please show me how to run a game on one computer and
> then it should to connect to another game player's machine?


Why, why, why do they keep coming to clpm? What is it about clpm that
attracts them so much?


Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'


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

Date: Thu, 17 Oct 2002 07:51:21 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: idea to build an online game
Message-Id: <3dae6b1c.18099179@news.erols.com>

manutd_kit@yahoo.com (kit) wrote:

| Could any of you please show me how to run a game on one computer and
| then it should to connect to another game player's machine?

Why should an online game be different from online anything-else?
1. Decide what data needs to be shared among machines
2. Choose a way to shuffle the data around to the machines that need
it.
 
| Are there any open source example that I can learn from making this
| kind of online game?

Examples of ways to pump data around a network?  Too many to count.



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

Date: Thu, 17 Oct 2002 14:52:19 +1000
From: "mostuff" <stuff@nowhere.com>
Subject: loops i guess, among other things
Message-Id: <Qmrr9.58$P5.5718@nasal.pacific.net.au>

if have update files for a few catalogues sitting on an ftp server. each
different type of file will have the update type as the first 2 characters
and then the date. what i'm trying to do is download each different type of
update that is newer than the last downloaded update. so i started with
something like this:

@FileTypes = ("ud","vs","eq");

if (my $Ftp = Net::FTP->new("ftp.mms.com.au",Debug => 1)) { #Connect to the
ftp site
    $Ftp->login("arianet","charts") or &DieError($Ftp->message()); #Login
    my @UpdateFiles = $Ftp->ls("$_\*"); #Lists remote files
  OUTER: foreach my $UpdateFile(@UpdateFiles) {
      my $RemoteTime = $Ftp->mdtm($UpdateFile); #Get the modification time
of the file
    INNER: foreach my $Type(@FileTypes) {
 if ($UpdateFile =~ /^$Type/) {
     my $LocalTime = $Config->val("Catalogue","Last$Type");
     print "remotetime: ",$RemoteTime, "\n";
     if ($RemoteTime > $LocalTime) { #If the remote file is newer than to
local one
  print "downloading $UpdateFile\n";
  $Ftp->get($UpdateFile,$UpdateFile); #Download it
  $Config->setval("Catalogue","Last$Type",$RemoteTime); #Set the LastUpdate
option in config.ini to the modification time of the file just downloaded
  next OUTER;
     }
 }
    }
  }
} else {
    die "$@\n";
}

it keeps track of the mtime of the last downloaded update in an ini file.
problem is it doesn't download anything and i know there's something wrong
but my brain fried about 10 minutes ago. can something please tell me what
i'm doing wrong, or is there an easier way of doing this?

thanx in advance




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

Date: Thu, 17 Oct 2002 06:34:48 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: loops i guess, among other things
Message-Id: <3DAE59D0.51F5C432@acm.org>

mostuff wrote:
> 
> if have update files for a few catalogues sitting on an ftp server. each
> different type of file will have the update type as the first 2 characters
> and then the date. what i'm trying to do is download each different type of
> update that is newer than the last downloaded update. so i started with
> something like this:
> 
> @FileTypes = ("ud","vs","eq");
> 
> if (my $Ftp = Net::FTP->new("ftp.mms.com.au",Debug => 1)) { #Connect to the
> ftp site
>     $Ftp->login("arianet","charts") or &DieError($Ftp->message()); #Login
>     my @UpdateFiles = $Ftp->ls("$_\*"); #Lists remote files
                                  ^^^^
This fills the array with a list of files in the current remote
directory that start with the value of $_.  Since the value of $_ cannot
be 'ud' and 'vs' and 'eq' at the same time, and is probably not equal to
any of those values, the array is not getting anything.


>   OUTER: foreach my $UpdateFile(@UpdateFiles) {
>       my $RemoteTime = $Ftp->mdtm($UpdateFile); #Get the modification time
> of the file
>     INNER: foreach my $Type(@FileTypes) {
>  if ($UpdateFile =~ /^$Type/) {
>      my $LocalTime = $Config->val("Catalogue","Last$Type");
>      print "remotetime: ",$RemoteTime, "\n";
>      if ($RemoteTime > $LocalTime) { #If the remote file is newer than to
> local one
>   print "downloading $UpdateFile\n";
>   $Ftp->get($UpdateFile,$UpdateFile); #Download it
>   $Config->setval("Catalogue","Last$Type",$RemoteTime); #Set the LastUpdate
> option in config.ini to the modification time of the file just downloaded
>   next OUTER;
>      }
>  }
>     }
>   }
> } else {
>     die "$@\n";
> }


John
-- 
use Perl;
program
fulfillment


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

Date: Thu, 17 Oct 2002 10:04:25 +0200
From: Christian C Schouten <cschoute@liacs.nl>
Subject: Ok, so why does this one not work???
Message-Id: <Pine.LNX.4.05.10210170948140.11534-100000@krypton.wi.leidenuniv.nl>

Hi,

Sorry for my extremely rudimentary perl, but here goes.

I have written a script that is supposed to present a HTML fillout form
using CGI. The results will be stored by this script into a text based
(CSV) file.
So far so good, I can get either the web fillout working fine, knowing all
answers, or I can get a script modifying a file. It just doesn't seem to
work to use either open or sysopen when having use CGI. In other words, as
soon as use CGI is present, the file will not be altered.
The same code does work when I comment out all CGI crap. Also, it is
probably not a file ownership problem, as the mode may be set to anything
(including 777) but still won't be altered (and 777 should do this :-)

So, does anyone have any ideas???

PS: Excuse the Dutch in there, but I don't think it's really necessary to
translate the questions. They're not the important bit here. And anyways,
you'll get the idea, it's asking if the user would like more ICT
training...

--
#define me "Christian C. Schouten <cschoute@liacs.nl>"

-----------------
:r survey_ICT.cgi
-----------------
#!/usr/bin/perl -wT

# Author: Christian C. Schouten - cschoute<AT>liacs.nl
# Perl/CGI script that presents a survey and stores it into a CSV file.

use CGI qw /:standard/;
use Fcntl qw(:DEFAULT :flock);

# Allow HTML tags.
autoEscape(undef);

my $DatabaseFile = "survey_ICT.csv";

print header,
    start_html(-title=>'Wensen over ICT cursussen',
        -meta=>{'author'=>'Christian C. Schouten - cschoute<AT>liacs.nl'}),
    h1("<CENTER>Wensen over ICT cursussen</CENTER>"),
    hr,

    start_form,
        p({-align=>'right'}, "Voer eerst hier uw loginnaam (emailadres zonder '\@let.leidenuniv.nl') in: ",
	textfield('Username','',15)), p,
	
        b("DEEL A - Algemene ICT toepassingen"), br,
	"Hieronder vindt u een lijst van ICT-toepassingen die u waarschijnlijk al gebruikt voor uw onderwijs of onderzoek, maar wellicht wilt u een bepaalde functionaliteit (effectiever) leren gebruiken. Geef aan op welke gebieden u graag meer zou willen weten.", p,

	b("1. Werken met Windows en bestandsbeheer"), br,
	checkbox_group('Windows',
	    ['Gebruik van sneltoetsen', 'Bestanden bewaren op de facultaire computers', 'Snelkoppelingen maken', 'Mappen maken', 'Bestanden zoeken', 'Toepassingen openen', 'Minimaliseren/maximaliseren', 'Eigenschappen', 'Werkbalken', 'Anders, nl.'],
	    [], 'true', \%labels), textfield('Windows_Anders','',25), p,
	
	b("2. Word"), br,
        checkbox_group('Word',
	    ['Voetnoten/eindnoten aanmaken/veranderen', 'Automatische inhoudsopgaves', 'Kop- en voetteksten', 'enz', 'etc'],
	    [], 'true', \%labels), p,
	
	b("3. Internet"), p,
	b("4. Outlook"), p,
	b("5. Powerpoint"), p,
	b("6. Frontpage"), p,
	b("7. Access"), p,
	b("8. Excel"), p,
	b("9. Beeldbewerking"), p,
	b("10. Anderen"), p,
	b("Blackboard"), p,
	
        submit('Versturen'),
    end_form,
    hr;

if (param()) {
    my $Username = param('Username');
      my $Windows = join(", ", param('Windows'),param('Windows_Anders'));
      my $Word = join(", ", param('Word'));
      my $Internet = "Internet";#join(", ", param('Internet'));
      my $Outlook = "Outlook";#join(", ", param('Outlook'));
      my $Powerpoint = "Powerpoint";#join(", ", param('Powerpoint'));
      my $Frontpage = "Frontpage";#join(", ", param('Frontpage'));
      my $Access = "Access";#join(", ", param('Access'));
      my $Excel = "Excel";#join(", ", param('Excel'));
      my $Beeldbewerking = "Beeldbewerking";#join(", ", param('Beeldbewerking'));
      my $Anderen = "Anderen";#join(", ", param('Anderen'));
      my $Blackboard = "Blackboard";#join(", ", param('Blackboard'));
    my $DeelA = join(";", $Windows,$Word,$Internet,$Outlook,$Powerpoint,$Frontpage);
    my $DeelB = join(";", $Access,$Excel,$Beeldbewerking,$Anderen);
    my $DeelC = join(";", $Blackboard);
    my $Values = join(";", $DeelA,$DeelB,$DeelC);
    
    # Open results file, lock it, read it.
    sysopen(DATABASE, $DatabaseFile, O_RDWR|O_CREAT) or die "Can't open database: $!";
    flock(DATABASE, LOCK_EX);
    my @CSV_List = <DATABASE>;
    
    # Append new item to array
    push @CSV_List, "$Username;$Values";
    
    # Clear contents, close file up again.
    seek(DATABASE, 0, 0) or die "Can't clear database: $!";
    truncate(DATABASE, 0) or die "Can't clear database: $!";
    print DATABASE @CSV_List, "\n";
    flock(DATABASE, LOCK_UN);
    close DATABASE;
    
    print b("Debugging results view: "), p;
    print "my \$Username: $Username", br;
    print "my \$CSV_String: $Username;$Values", br;
    print "my \@CSV_List: @CSV_List", br;
}

#EOF



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

Date: 16 Oct 2002 21:40:26 -0700
From: rook_5150@yahoo.com (Bryan Castillo)
Subject: Re: OLE Automation via Perl
Message-Id: <1bff1830.0210162040.5862bbc8@posting.google.com>

> So is OLE Automation not a simple task? Or is it complicated enough
> that someone relatively inexperienced in the Windows world shouldn't
> be attempting it?

If you haven't already, check out Win32::OLE.  If you have ActiveState
installed there is a web page installed with the html documentation
that is alot of help for ole.  It is an OLE browser.  On my system it
is C:\Perl\html\site\lib\Win32\OLE\Browser\Browser.html.  If you have
a strong heart, read the code for it, it uses perlscript an javascript
together inside the wscript cr**p engine to write html dynamically to
the inner_html attributes of various elements.  OLE automation in perl
is pretty easy, the hardest thing about it is finding the
documentation for the OLE object you are looking for.  I've never done
well searching through msdn.  (I've often found C code that wouldn't
compile and used non-existent functions, I finally found one function
for ACL's that was used on msdn, inside source code for chown on
win32, that was an application defined function, msdn used their
example, but didn't print the definitions of all the functions used. 
As far as I'm concerned, msdn is about the biggest joke for
documentation in the world.  **sorry for ranting**)


One thing you might think about which should be easy, is to use the
explorer command with system.  i.e.  system("explorer file.pdf")  It
will open the application in a Explorer/IExplorer (whatever) window
using some ActiveX cr**p plugin.  You may not have to distinguish the
file type to open it, as you probably would with OLE.


Any way here is an example opening a word doc with Win32::OLE



use strict;
use warnings;
use Win32::OLE;
use Win32::OLE::Const;

my $wd = Win32::OLE::Const->Load("Microsoft Word 8\\.0 Object
Library");

my $app = Win32::OLE->new("Word.Application");
my $doc = $app->Documents->Open("thedoc.html");

$app->{Visible} = 1;
$doc->SaveAs("C:\\thedoc.doc", $wd->{wdFormatDocument});

$doc->CheckSpelling();
<STDIN>;

$app->Quit;



If you notice, the document opened is HTML, you can generally write
html and have word or excel convert it to their own formats.  Perhaps
like me, you generate reports on Unix and have users who don't know
what to do with anything that doesn't work with Mic**** Office.


Some pitfalls you might have with OLE and perl:


  - Some operations on OLE objects are asynchronous
     For example I was driving IE with perl and sending 
     it to various URL's for automated testing of IE 
     with websites.  One thing you can do is once the 
     web page is loaded, is access the HTML DOM.  However, 
     you can't do this until the page loads and the send_to 
     (I forget the real method name) returns before that.  
     To do much with these asynchronous methods, you need 
     to look into the OLE events, last I read it was 
     supported at an Alpha level.


  - Sometimes you will get pop-ups needing user input, you 
    didn't expect.  I don't know of a way to catch and 
    respond to these.  If you know there will be pop-ups 
    you want to send keys to look at the WScript.Shell
    object.

  - Some variables for OLE objects need manipulation 
    through the Variant object Win32::OLE::Variant (Which 
    I really don't know anything about).


Anyway, you should also read "perlwin32faq12 - Using OLE with Perl"  
C:\Perl\html\faq\Windows\ActivePerl-Winfaq12.html

I'm not an expert, but I did suffer quite a bit of pain with OLE and
perl and I hope some of this helps.

Of course, I consider the pain associated closely to OLE not perl.


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

Date: 17 Oct 2002 04:43:59 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: Perl and DDE
Message-Id: <slrnaqsg0f.1ee.sholden@flexal.cs.usyd.edu.au>

On 17 Oct 2002 04:03:11 GMT, Ct60 <ct60@aol.com> wrote:
> Hello again -
> 
> I am wondering if anyone can point me toward documentation that shows how to
> use DDE links (such as Reuters and Bloomberg market links) with Perl.  Frankly,
> it seems hard to beat Excel when it comes to ease of use with these types of
> DDE links - but there is an awful lot of flukiness and even instability with
> Excel - especially with the kinds of huge spreadsheets we use.
> Maybe it's a pipe dream, but it would be such a pleasure to use Perl to create
> a nice lightweight app that is fast and processes the data without crashing.
> Someone make my day, Please.

A google search for "perl dde" returns some stuff.

Such as:
http://ww2.edgewebhosting.net/activeperl/site/lib/Win32/DDE.html

I don't know anything about DDE, and I don't have a windows
machine handy to see what it is...

Couldn't you do a google search yourself:
http://www.google.com/search?q=perl+DDE

-- 
Sam Holden



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

Date: Thu, 17 Oct 2002 00:44:07 -0700
From: KM <ken_mahi@hotmail.com>
Subject: PROB: Using Perl for calc.. dates
Message-Id: <3DAE6A47.68D75D14@hotmail.com>

Write a program to prompt the user for a year between 1900 and 2099, and

produce the dates that Eastern Orthodox Easter falls on in both the
Julian and Gregorian calendars. Gauss's Algorithm should be used as
described ( http://www.smart.net/~mmontes/ortheast.html ) and provide
the following functions to implement the program:

      instruct( )   instructs the user
        prompt( )   supplies the prompt;gets/checks data
            rc( )   calculates rc using algorithm and returns it's value

      prJulian( )   uses rc to print Julian calendar day
   prGregorian( )   uses rc to print Gregorian calendar day

Create an appropriate parameter list for the print functions. These
functions need to print the month, day, and year.

The program is to be designed and implemented only once per invocation.


For additional details on the Orthodox Easter, please check ..
http://www.smart.net/~mmontes/ortheast.html



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

Date: Thu, 17 Oct 2002 07:57:06 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: PROB: Using Perl for calc.. dates
Message-Id: <3dae6cb6.18510059@news.erols.com>

<ken_mahi@hotmail.com> wrote:

| Write a program to prompt the user for a year between 1900 and 2099, and

[ do some stuff, adhering to a rigid list of naming/algorithm
requirements ]
 
How many homework problems are you going to dump on the group?


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

Date: Thu, 17 Oct 2002 07:09:59 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Problems with perl.org/perlmongers.org websites and email addresses
Message-Id: <kaosqu0f53gcn5ifh1usv6ucv7krbuo8hj@4ax.com>

brian d foy wrote:

>> The website <http://lists.perl.org> is offline, gining me a 500 "could
>> not connect to server" error. I tried to warn the webmaster via
>> <lists@perlmongers.org> but my SMTP server refuses to send mail to that
>> address:
>
>why are you using that domain?

See this page, reachable from the link "contact us" on
<http://www.perl.org>

	<http://www.perl.org/contact.shtml>

At the bottom, you can find 3 links:

	Technical issues

	Read the FAQ first!

	    * DNS - dns@perlmongers.org
	    * Web site - web@perlmongers.org
	    * Mailing lists - lists@perlmongers.org 


>> I'm posting this here hoping somebody who can do something about it will
>> pick it up
>
>i think Elaine Ashton was the one taking care of lists.perl.org.  

So how am I supposed to know that, if there's nothing mentioned on the
home page?

-- 
	Bart.


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

Date: 17 Oct 2002 07:48:01 GMT
From: "Tassilo v. Parseval" <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Problems with perl.org/perlmongers.org websites and email addresses
Message-Id: <aolpvh$ba8$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Bart Lateur:

> brian d foy wrote:

>>i think Elaine Ashton was the one taking care of lists.perl.org.  
> 
> So how am I supposed to know that, if there's nothing mentioned on the
> home page?

I vaguely remember this being mentioned on the lists.perl.org website.
Also googled a little and found an old Perl-newsletter according to
which she was the creator of the site.

I just sent an email to the address that I believe belongs to her and
hoping that it's still in use.

Tassilo
-- 
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;


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

Date: Thu, 17 Oct 2002 07:03:30 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Read a single character from STDIN (W98)
Message-Id: <tqnsquoaas2vspr139vcsfijg1anig8snn@4ax.com>

Nemo Oudeheis wrote:

>  require Win32::Console;
>  $CONSOLE =  Win32::Console->new();
>  $CONSOLE->Select(STD_INPUT_HANDLE);
>  print "Y/N?\n";
>  $c =  $CONSOLE->InputChar(1);
>  printf( "You typed <%s> (i.e., 0x%0x)\n", $c, ord $c );
>
>
>This looks promising, but doubtless there is just something I have
>overlooked. 

You have: you're printing to STDOUT, which may or may not be attached to
the console. Don't ask me how to fix this, I have no experience with
this module, and from the docs it looks non-intuitive to me. But I'm
sure it somehow involves use of STD_OUTPUT_HANDLE.

-- 
	Bart.


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

Date: Thu, 17 Oct 2002 07:44:50 +0200
From: "Evert" <linux@dds.nl>
Subject: Re: regular expressions... really don't get it!
Message-Id: <3dae4e38$0$46001$8fcfb86b@news.wanadoo.nl>


> > while (my $line = <FH>) {
> >      print $1 if /cuout d (\d+)/;
> > }
>
> Your regex is bound to $_ which isn't being changed because you are
> reading the current line into $line.


if ($content =~ /cuout d (\d+)/)
{
        print "$1 B/s\n";
} else {
        print "Parse error...";
}

this is working though... thanx!
Evert





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

Date: Thu, 17 Oct 2002 07:47:15 +0200
From: "Evert" <linux@dds.nl>
Subject: Re: regular expressions... really don't get it!
Message-Id: <3dae4ec9$0$46001$8fcfb86b@news.wanadoo.nl>


> Did you read
> perldoc perlretut

so that is where the perl documentation is hidden!!
there are a few good examples there... if i knew that
before......

Evert





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

Date: 17 Oct 2002 05:55:16 GMT
From: "Tassilo v. Parseval" <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: regular expressions... really don't get it!
Message-Id: <aoljc4$641$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Evert:

>> Did you read
>> perldoc perlretut
> 
> so that is where the perl documentation is hidden!!
> there are a few good examples there... if i knew that
> before......

In order to not let that happen again, please see 'perldoc perl' for a
list of manpages that comes with your Perl-distribution. Once in a while
I even discover one I previously didn't know about. :-)

Tassilo
-- 
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;


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

Date: Thu, 17 Oct 2002 02:10:51 -0400
From: "cakes99" <cakes@doentreply.com>
Subject: Sending argument to perl
Message-Id: <3dae5475_2@nopics.sjc>

How would I go about sending arguments to perl using the shell command.

For instance: perl somescript.pl argument

Perl takes the argument as a file.  Is it possible to pass the argument to
the script in a line command without it being passed as a file???

Thanks,

Matt




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

Date: Thu, 17 Oct 2002 06:23:40 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: Sending argument to perl
Message-Id: <slrnaqslnv.12b.bernard.el-hagin@gdndev25.lido-tech>

In article <3dae5475_2@nopics.sjc>, cakes99 wrote:
> How would I go about sending arguments to perl using the shell command.
> 
> For instance: perl somescript.pl argument
> 
> Perl takes the argument as a file.


No it doesn't.


> Is it possible to pass the argument to
> the script in a line command without it being passed as a file???


% cat perl.pl
print @ARGV;

% perl perl.pl aaa bbb
aaabbb


Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'


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

Date: 16 Oct 2002 17:43:22 -0600
From: Steve Grazzini <s_grazzini@hotmail.com>
Subject: Re: Sleeping until another process finishes?
Message-Id: <3dadf99a@news.mhogaming.com>

D. Alvarado <laredotornado@zipmail.com> wrote:
> I know the $pid of another process, and I want my perl 
> script to sleep until the other process (denoted by $pid) 
> is done.  Any ideas?

If you started the other process with fork() or 
open() just use waitpid.

  $ perldoc -f waitpid

If you got the pid from a lockfile you probably
want to sleep until you get the lock -- not just 
until the other process terminates.

  $ perldoc -f flock

And both of these calls block, so you don't have 
to write the poll loop yourself.

-- 
Steve

perldoc -qa.j | perl -lpe '($_)=m("(.*)")'


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 3985
***************************************


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