[30030] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1273 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 13 03:09:39 2008

Date: Wed, 13 Feb 2008 00:09:04 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 13 Feb 2008     Volume: 11 Number: 1273

Today's topics:
        Advice about cgi programming <banerjee.anirban@gmail.com>
    Re: Advice about cgi programming xhoster@gmail.com
    Re: Advice about cgi programming <banerjee.anirban@gmail.com>
    Re: LWP user agent grabs the intermediate wait page aft <tadmc@seesig.invalid>
        new CPAN modules on Wed Feb 13 2008 (Randal Schwartz)
        USENIX LISA '08 Call For Papers <lgj@usenix.org>
    Re: Using END and the die function <pgodfrin@gmail.com>
        Win32::MMF What's going on? <blaine@worldweb.com>
    Re: Win32::MMF What's going on? <someone@example.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 12 Feb 2008 18:52:30 -0800 (PST)
From: newbiegalore <banerjee.anirban@gmail.com>
Subject: Advice about cgi programming
Message-Id: <e748a974-5f40-44ee-b1c3-355b98dd299d@i7g2000prf.googlegroups.com>

Hello everyone :-) ,
                             I am a newbie to Perl, but have
experience with other scripting languages. I am putting up this post
to ask for advice regarding what skills I would need to get a task
done. This might not be the most appropriate group, but since Perl is
used a lot for server back-end scripts, I guess a lot of people have
experience with using it for building web applications.

My task: I have bought a domain and now want to set up a website on
it.

What will the site do: Accept a string from the user, like Google does
(A very simple design). Then the site will check this string for the
presence of a substring. The output will be displayed in a simple text
box on the main page (to begin with).

If I have a script that will do this operation, I need to link the
input string to this script in the background and return the result.
Is CGI programming used to make this "glue" ? I could ask someone to
access the script directly on my site like

http://www.mysite.com/myscript<params> .. but I want to separate the
interface from my programs. Any advice would be greatly appreciated. I
know how to code in C, C++,Awk, Bash and some more languages. Sorry if
my questions seems overly naive :D.

Thanks in advance,
-A


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

Date: 13 Feb 2008 05:08:27 GMT
From: xhoster@gmail.com
Subject: Re: Advice about cgi programming
Message-Id: <20080213000831.082$66@newsreader.com>

newbiegalore <banerjee.anirban@gmail.com> wrote:
> Hello everyone :-) ,
>                              I am a newbie to Perl, but have
> experience with other scripting languages. I am putting up this post
> to ask for advice regarding what skills I would need to get a task
> done. This might not be the most appropriate group, but since Perl is
> used a lot for server back-end scripts, I guess a lot of people have
> experience with using it for building web applications.

Isn't that kind of like parking illegally, then turning on your four-way
flashers to advertise "yes, I know it is illegal, but I am doing it
anyway"?  To be generous, I'll assume you have at least some vaguely
good-faith intention of considering Perl for your task.

>
> My task: I have bought a domain and now want to set up a website on
> it.
>
> What will the site do: Accept a string from the user, like Google does
> (A very simple design). Then the site will check this string for the
> presence of a substring. The output will be displayed in a simple text
> box on the main page (to begin with).

Every sting will have a substring present in it (the null string if
nothing else).  There is no need to check--it will be there.  Are you
looking for a *specific* substring?

> If I have a script that will do this operation, I need to link the
> input string to this script in the background and return the result.

What do you mean by "in the background"

> Is CGI programming used to make this "glue" ?

It certainly can be.

> I could ask someone to
> access the script directly on my site like
>
> http://www.mysite.com/myscript<params> .. but I want to separate the
> interface from my programs.

Your task is so simple I see no benefit to be had from such separation.
Of course, your task could evolve to be non-simple, but then it would
depend on what what way it becomes non-simple.  It is kind of like saying
"I want to drive to the capital of some state, but without knowing
which state it is can you tell me which direction to start driving?"

> Any advice would be greatly appreciated. I
> know how to code in C, C++,Awk, Bash and some more languages. Sorry if
> my questions seems overly naive :D.

If you know many other languages but not Perl, then you might want to
consider using one of them and learning only CGI, rather than learning
both Perl and CGI simultaneously.  I know of some Perl modules (CGI.pm,
mostly) that help do CGI from Perl.  I'm sure at least some of those other
languages have such helper libraries as well, but this being a Perl group
and all, I don't know of any specifically to recommend for those other
languages.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


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

Date: Tue, 12 Feb 2008 22:51:46 -0800 (PST)
From: newbiegalore <banerjee.anirban@gmail.com>
Subject: Re: Advice about cgi programming
Message-Id: <6d8ea372-4f6c-4afe-831a-709e10f7f14b@d4g2000prg.googlegroups.com>

On Feb 12, 9:08 pm, xhos...@gmail.com wrote:
> newbiegalore <banerjee.anir...@gmail.com> wrote:
> > Hello everyone :-) ,
> >                              I am a newbie to Perl, but have
> > experience with other scripting languages. I am putting up this post
> > to ask for advice regarding what skills I would need to get a task
> > done. This might not be the most appropriate group, but since Perl is
> > used a lot for server back-end scripts, I guess a lot of people have
> > experience with using it for building web applications.
>
> Isn't that kind of like parking illegally, then turning on your four-way
> flashers to advertise "yes, I know it is illegal, but I am doing it
> anyway"?  To be generous, I'll assume you have at least some vaguely
> good-faith intention of considering Perl for your task.
>
>
>
> > My task: I have bought a domain and now want to set up a website on
> > it.
>
> > What will the site do: Accept a string from the user, like Google does
> > (A very simple design). Then the site will check this string for the
> > presence of a substring. The output will be displayed in a simple text
> > box on the main page (to begin with).
>
> Every sting will have a substring present in it (the null string if
> nothing else).  There is no need to check--it will be there.  Are you
> looking for a *specific* substring?
>
> > If I have a script that will do this operation, I need to link the
> > input string to this script in the background and return the result.
>
> What do you mean by "in the background"
>
> > Is CGI programming used to make this "glue" ?
>
> It certainly can be.
>
> > I could ask someone to
> > access the script directly on my site like
>
> >http://www.mysite.com/myscript<params> .. but I want to separate the
> > interface from my programs.
>
> Your task is so simple I see no benefit to be had from such separation.
> Of course, your task could evolve to be non-simple, but then it would
> depend on what what way it becomes non-simple.  It is kind of like saying
> "I want to drive to the capital of some state, but without knowing
> which state it is can you tell me which direction to start driving?"
>
> > Any advice would be greatly appreciated. I
> > know how to code in C, C++,Awk, Bash and some more languages. Sorry if
> > my questions seems overly naive :D.
>
> If you know many other languages but not Perl, then you might want to
> consider using one of them and learning only CGI, rather than learning
> both Perl and CGI simultaneously.  I know of some Perl modules (CGI.pm,
> mostly) that help do CGI from Perl.  I'm sure at least some of those other
> languages have such helper libraries as well, but this being a Perl group
> and all, I don't know of any specifically to recommend for those other
> languages.
>
> Xho
>
> --
> --------------------http://NewsReader.Com/--------------------
> The costs of publication of this article were defrayed in part by the
> payment of page charges. This article must therefore be hereby marked
> advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
> this fact.

I got hold of a nice resource http://hoohoo.ncsa.uiuc.edu/cgi/ ...
don't really see the need for an illegal car parking analogy
though :D.. anyway thanks for the comments.


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

Date: Wed, 13 Feb 2008 01:55:41 GMT
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: LWP user agent grabs the intermediate wait page after POST intead of  the actual result page
Message-Id: <slrnfr3243.7en.tadmc@tadmc30.sbcglobal.net>

Christian Winter <thepoet_nospam@arcor.de> wrote:
> bhabs wrote:
>> I wrote a small LWP based perl program to search the air fare from a
>> travel website using POST.
>> 
> [...code snipped]
>> 
>> When I print the content, I see the "intermediate" wait page (where it
>> displays the progress bar using javascript.... =>  I matched the
>> content with the "view source" from IExplorer)
>> I am unable to capture the final air fare page. It takes time for the
>> website to do the search and then display the air fare result page.
>> How do I make my program wait for the actual result and not grab the
>> intermediate response.
>
> You have to simulate what the browser does, and from your
> description, this is most likely a repeated ajax request
> to the server. Analyze the behaviour of the javascript
> and see how it fetches the progress state and what it
> does once the result is calculated, then craft those
> actions yourself. You best chances to see exactly what is going
> on in the background is with a network sniffer like wireshark,


I like the Web Scraping Proxy for this, it logs the traffic in
the form of LWP Perl code:

    http://www.research.att.com/sw/tools/wsp/


> or a browser plugin like Firefox' Live HTTP Headers.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Wed, 13 Feb 2008 05:42:17 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Wed Feb 13 2008
Message-Id: <Jw5x6H.2Ep@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Algorithm-LBFGS-0.14
http://search.cpan.org/~laye/Algorithm-LBFGS-0.14/
Perl extension for L-BFGS 
----
Amazon-SQS-Simple-0.6
http://search.cpan.org/~swhitaker/Amazon-SQS-Simple-0.6/
OO API for accessing the Amazon Simple Queue Service 
----
Bundle-Music-Tag-0.01
http://search.cpan.org/~ealleniii/Bundle-Music-Tag-0.01/
Music::Tag bundle for quick installation 
----
CGI-Auth-Auto-1.20
http://search.cpan.org/~leocharre/CGI-Auth-Auto-1.20/
Automatic authentication maintenance and persistence for cgi scrips. 
----
CGI-List-0.04
http://search.cpan.org/~romdav/CGI-List-0.04/
Easily generate HTML Lists From a DataBase 
----
CGI-Scriptpaths-1.02
http://search.cpan.org/~leocharre/CGI-Scriptpaths-1.02/
----
CGI-Scriptpaths-1.03
http://search.cpan.org/~leocharre/CGI-Scriptpaths-1.03/
find web relevant paths even without ENV set 
----
Catalyst-View-PNGTTGraph-0.02
http://search.cpan.org/~terencemo/Catalyst-View-PNGTTGraph-0.02/
PNG Graph View Component for Catalyst 
----
Class-DBI-Pageset-0.11
http://search.cpan.org/~mgrimes/Class-DBI-Pageset-0.11/
A flexible pager utility for Class::DBI using Data::Pageset 
----
Config-Options-0.06
http://search.cpan.org/~ealleniii/Config-Options-0.06/
----
Config-Options-0.07
http://search.cpan.org/~ealleniii/Config-Options-0.07/
module to provide a configuration hash with option to read from file. 
----
DBIx-Class-Schema-Loader-0.04999_02
http://search.cpan.org/~ilmari/DBIx-Class-Schema-Loader-0.04999_02/
Dynamic definition of a DBIx::Class::Schema 
----
Data-Pageset-HTML-0.11
http://search.cpan.org/~mgrimes/Data-Pageset-HTML-0.11/
Subclass of Data::Pageset that generates html, text, etc. for page navigation 
----
Email-Public-0.03
http://search.cpan.org/~jeteve/Email-Public-0.03/
Quickly find if an email address is from a public email provider 
----
File-PathInfo-1.19
http://search.cpan.org/~leocharre/File-PathInfo-1.19/
access to path variables, stat data, misc info about a file 
----
GD-Map-Mercator-1.02
http://search.cpan.org/~darnold/GD-Map-Mercator-1.02/
Create Mercator projected map images using GD 
----
Geo-Point-0.07
http://search.cpan.org/~markov/Geo-Point-0.07/
a point on the globe 
----
Geo-WKT-0.02
http://search.cpan.org/~markov/Geo-WKT-0.02/
Well Known Text representation of geometry information 
----
GraphViz-DBI-FromSchema-0.02
http://search.cpan.org/~smylers/GraphViz-DBI-FromSchema-0.02/
Create a diagram of database tables, using the foreign key information in the schema 
----
HTML-FillInForm-Lite-0.03
http://search.cpan.org/~gfuji/HTML-FillInForm-Lite-0.03/
Fills in HTML forms with data 
----
HTML-FillInForm-Lite-0.031
http://search.cpan.org/~gfuji/HTML-FillInForm-Lite-0.031/
Fills in HTML forms with data 
----
HTML-Tabulate-0.27
http://search.cpan.org/~gavinc/HTML-Tabulate-0.27/
HTML table rendering class 
----
Hyper-0.02
http://search.cpan.org/~acid/Hyper-0.02/
The global Hyper Workflow Interface 
----
Hyper-Developer-0.02
http://search.cpan.org/~acid/Hyper-Developer-0.02/
----
Locale-Maketext-Lexicon-0.66
http://search.cpan.org/~audreyt/Locale-Maketext-Lexicon-0.66/
Use other catalog formats in Maketext 
----
Log-Handler-0.38_10
http://search.cpan.org/~bloonix/Log-Handler-0.38_10/
Log messages to one or more outputs. 
----
Lyrics-Fetcher-LeosLyrics-0.01
http://search.cpan.org/~ealleniii/Lyrics-Fetcher-LeosLyrics-0.01/
Get song lyrics from leoslyrics.com 
----
Music-Audioscrobbler-MPD-0.07
http://search.cpan.org/~ealleniii/Music-Audioscrobbler-MPD-0.07/
Module providing routines to submit songs to last.fm from MPD. 
----
Music-Tag-0.28
http://search.cpan.org/~ealleniii/Music-Tag-0.28/
Module for collecting information about music files. 
----
Music-Tag-0.29
http://search.cpan.org/~ealleniii/Music-Tag-0.29/
Module for collecting information about music files. 
----
Music-Tag-Amazon-0.28
http://search.cpan.org/~ealleniii/Music-Tag-Amazon-0.28/
Plugin module for Music::Tag to get information from Amazon.com 
----
Music-Tag-FLAC-0.28
http://search.cpan.org/~ealleniii/Music-Tag-FLAC-0.28/
----
Music-Tag-FLAC-0.29
http://search.cpan.org/~ealleniii/Music-Tag-FLAC-0.29/
----
Music-Tag-FLAC-0.3
http://search.cpan.org/~ealleniii/Music-Tag-FLAC-0.3/
Plugin module for Music::Tag to get information from flac headers. 
----
Music-Tag-File-0.28
http://search.cpan.org/~ealleniii/Music-Tag-File-0.28/
Plugin module for Music::Tag to get information from filename and directory entries. 
----
Music-Tag-Lyrics-0.28
http://search.cpan.org/~ealleniii/Music-Tag-Lyrics-0.28/
Screen Scraping plugin for downloading lyrics from the web. 
----
Music-Tag-LyricsFetcher-0.01
http://search.cpan.org/~ealleniii/Music-Tag-LyricsFetcher-0.01/
Music::Tag plugin to use Lyrics::Fetcher 
----
Music-Tag-M4A-0.28
http://search.cpan.org/~ealleniii/Music-Tag-M4A-0.28/
Plugin module for Music::Tag to get information from Apple QuickTime headers. 
----
Music-Tag-MP3-0.28
http://search.cpan.org/~ealleniii/Music-Tag-MP3-0.28/
Plugin module for Music::Tag to get information from id3 tags 
----
Music-Tag-MusicBrainz-0.28
http://search.cpan.org/~ealleniii/Music-Tag-MusicBrainz-0.28/
Plugin module for Music::Tag to get information from MusicBrainz database. 
----
Music-Tag-OGG-0.28
http://search.cpan.org/~ealleniii/Music-Tag-OGG-0.28/
Plugin module for Music::Tag to get information from ogg-vorbis headers. 
----
NL-File-Lock-0.3
http://search.cpan.org/~nickola/NL-File-Lock-0.3/
File locking (based on lockfiles) 
----
Net-DRI-0.85
http://search.cpan.org/~pmevzek/Net-DRI-0.85/
Interface to Domain Name Registries/Registrars/Resellers 
----
Net-LDAP-LDAPhash-1.0.0
http://search.cpan.org/~vvelox/Net-LDAP-LDAPhash-1.0.0/
Takes from a search and turns it into a hash. 
----
Net-LDAP-LDAPhash-1.0.1
http://search.cpan.org/~vvelox/Net-LDAP-LDAPhash-1.0.1/
Takes from a search and turns it into a hash. 
----
Net-Shoutcast-Admin-0.01
http://search.cpan.org/~bigpresh/Net-Shoutcast-Admin-0.01/
administration of Shoutcast servers 
----
Nmap-Parser-1.13
http://search.cpan.org/~apersaud/Nmap-Parser-1.13/
parse nmap scan data with perl 
----
Number-Phone-JP-0.11
http://search.cpan.org/~taniguchi/Number-Phone-JP-0.11/
Validate Japanese phone numbers 
----
POE-Component-IRC-PAUSE-RecentUploads-0.02
http://search.cpan.org/~zoffix/POE-Component-IRC-PAUSE-RecentUploads-0.02/
----
POE-Component-IRC-Plugin-Google-Calculator-0.01
http://search.cpan.org/~zoffix/POE-Component-IRC-Plugin-Google-Calculator-0.01/
non-blocking access to Google's calculator via IRC 
----
POE-Component-IRC-Plugin-Google-Calculator-0.02
http://search.cpan.org/~zoffix/POE-Component-IRC-Plugin-Google-Calculator-0.02/
non-blocking access to Google's calculator via IRC 
----
POE-Component-IRC-Plugin-PAUSE-RecentUploads-0.02
http://search.cpan.org/~zoffix/POE-Component-IRC-Plugin-PAUSE-RecentUploads-0.02/
PoCo::IRC plugin for reporting recent uploads to "/pause.perl.org" in http:: 
----
POE-Component-IRC-Plugin-Thanks-0.02
http://search.cpan.org/~zoffix/POE-Component-IRC-Plugin-Thanks-0.02/
make witty responses to "thank you"s 
----
POE-Component-IRC-Plugin-Validator-CSS-0.02
http://search.cpan.org/~zoffix/POE-Component-IRC-Plugin-Validator-CSS-0.02/
non-blocking CSS validator for IRC bots. 
----
POE-Component-IRC-Plugin-YouAreDoingItWrong-0.02
http://search.cpan.org/~zoffix/POE-Component-IRC-Plugin-YouAreDoingItWrong-0.02/
show people what they are doing wrong by giving links to http://doingitwrong.com images. 
----
POEIKCdaemon-0.00_07
http://search.cpan.org/~suzuki/POEIKCdaemon-0.00_07/
POE IKC daemon 
----
RT-Extension-TicketLocking-0.08
http://search.cpan.org/~ruz/RT-Extension-TicketLocking-0.08/
Enables users to place advisory locks on tickets 
----
Solr-0.03
http://search.cpan.org/~garafola/Solr-0.03/
Perl extension for interfacing with Solr, a lucene based search engine. 
----
Test-Environment-0.02
http://search.cpan.org/~jkutej/Test-Environment-0.02/
Base module for loading Test::Environment::Plugin::* 
----
Test-Environment-0.03
http://search.cpan.org/~jkutej/Test-Environment-0.03/
Base module for loading Test::Environment::Plugin::* 
----
Test-Group-0.12
http://search.cpan.org/~domq/Test-Group-0.12/
Group together related tests in a test suite 
----
URI-Template-0.13
http://search.cpan.org/~bricas/URI-Template-0.13/
Object for handling URI templates 
----
Verilog-Perl-3.023
http://search.cpan.org/~wsnyder/Verilog-Perl-3.023/
----
WikiText-0.05
http://search.cpan.org/~ingy/WikiText-0.05/
Wiki Text Conversion Tools 
----
XML-Compile-0.69
http://search.cpan.org/~markov/XML-Compile-0.69/
Compilation based XML processing 
----
aliased-0.22
http://search.cpan.org/~ovid/aliased-0.22/
Use shorter versions of class names. 


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Tue, 12 Feb 2008 13:52:18 -0800
From: Lionel Garth Jones <lgj@usenix.org>
Subject: USENIX LISA '08 Call For Papers
Message-Id: <76CdneNqMa-PiC_anZ2dnUVZ_uXinZ2d@lmi.net>

--------------------------------------------------------------------
Call for Papers
LISA '08: 22nd Large Installation System Administration Conference
November 9-14, 2008, San Diego CA, USA
http://www.usenix.org/lisa08/cfpa
Extended abstract and paper submissions due: May 8, 2008
Sponsored by USENIX and SAGE
--------------------------------------------------------------------

Dear Colleague,

The LISA '08 organizers invite you to contribute proposals for refereed
papers, invited talks, and workshops, plus any ideas you have for Guru
Is In sessions, the Hit the Ground Running track, Work-in-Progress
Reports, posters, and training sessions.

The theme for LISA '08 is "Real World System Administration."

The Call for Participation with submission guidelines and sample topics
can be found on the USENIX Web site at http://www.usenix.org/lisa08/cfpa

Since 1987, the annual LISA conference has become the premier meeting
place for professional system and network administrators. System
administrators of all ranks, from novice to veteran, and of all
specialties meet to exchange ideas, sharpen skills, learn new
techniques, debate current issues, and mingle with colleagues and
friends.

The conference's diverse group of participants is matched by an equally
broad spectrum of activities:

* A training program for both beginners and experienced attendees covers
many administrative topics, ranging from basic administrative procedures
to using cutting-edge technologies.

* Refereed papers present the latest developments and ideas related to
system and network administration.

* Workshops, invited talks, and panels discuss important and timely
topics in depth and typically include lively and/or controversial
debates and audience interaction.

* Work-in-Progress Reports (WiPs) and poster sessions provide brief
looks ahead to next year's innovations.

GET INVOLVED!
* Submit a draft paper or extended abstract proposal for a refereed
paper.
* Propose a tutorial topic.
* Suggest an invited talk or panel discussion.
* Share your experience by leading a Guru Is In session.
* Create and lead a workshop.
* Propose a short Hit the Ground Running presentation.
* Present a Work-in-Progress Report (WiP) or submit a poster.
* Organize a Birds-of-a-Feather (BoF) session.
* Email an idea to the program chair: lisa08ideas@usenix.org

We look forward to hearing from you!

On behalf of the LISA '08 Organizers,

Mario Obejas, Raytheon
LISA '08 Program Chair
lisa08chair@usenix.org

------------------------------------------------------------
IMPORTANT DATES
Extended abstract and paper submissions due: May 8, 2008
Invited talk and workshop proposals due: May 20, 2008
Guru Is In & Hit the Ground Running proposals due: May 31, 2008
Notification to authors: Mid-June 2008
Poster proposals due, first round: July 16, 2008
Notification to poster presenters, first round: July 23, 2008
Final papers due: August 20, 2008
Poster proposals due, second round: Oct. 22, 2008
Notification to poster presenters, second round: Oct. 29, 2008
Submission guidelines and more information can be found at
http://www.usenix.org/lisa08/cfpa
-------------------------------------------------------------


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

Date: Tue, 12 Feb 2008 18:12:59 -0800 (PST)
From: pgodfrin <pgodfrin@gmail.com>
Subject: Re: Using END and the die function
Message-Id: <f53ca7c0-4b03-428a-8e66-fb052bf1bf74@l16g2000hsh.googlegroups.com>

On Feb 11, 3:47 pm, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth pgodfrin <pgodf...@gmail.com>:
>
> > Well - over twenty years in this business and I still find ways to be
> > an idiot. What I did not include in my previous posts was that in my
> > END subroutine I had an extra call - I didn't think it was important
> > (duh!). Of course it is. So by 'trapping' the $? before processing my
> > END code, things actually work as intended:
>
> >    mkdir($tgt_dir) or die "Mkdir ($tgt_dir) command failed.\n";
> >    END
> >    {
> >    $rc=$? ; # trap $? 'child error'
> >    print `date`,"Script ended. RC=$rc \n";
> >    $?=$rc;
> >    }
>
> A better way to do this is
>
>     END {
>         my $rc = $?;
>         local $?;
>         print `date`, "Script ended. RC=$rc\n";
>     }
>
> as then perl will restore $? for you. Also, you *really* don't need to
> call date(1) just to print the date. If you just want the default
> ctime(3) output, you can use
>
>     print scalar localtime, "...";
>
> otherwise, use POSIX::strftime to format the date as you like.
>
> Ben

cool! I'll give it a try...
tanx,
pg


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

Date: Tue, 12 Feb 2008 15:28:39 -0800 (PST)
From: "blaine@worldweb.com" <blaine@worldweb.com>
Subject: Win32::MMF What's going on?
Message-Id: <23cfcabf-f54c-43db-a772-8745cd700531@q77g2000hsh.googlegroups.com>

Hi,

I'm trying to write perl in windows environment and need to use the
package win32::mmf. Anyhow, I've got some test code below that will
write to the windows namespace but will not retrieve from it. Please
note it's just an example in production I would be writing to the ns
in one script and grabbing from the ns in another.

For some reason the second instance of mmf is not accessing the same
namespace. Any ideas?


	my $mmf = Win32::MMF->new( -swapfile => "data.swp",
                             -namespace => "MyDataShare",
                             -size => 1024 * 1024 )
       or die "\n\n\n\nCan not create namespace";

	$mmf->setvar($tokenKey, $hashRef);
	print "\n\n " . $mmf->debug();

	print "\n\n<BR>--------------";

	undef $mmf;
	my $mmf = Win32::MMF->new( -swapfile => "data.swp",
                             -namespace => "MyDataShare",
                             -size => 1024 * 1024 ,

		)
       or die "\n\n\n\nCan not create namespace";

	print Data::Dumper->Dump(  [ $mmf->getvar($tokenKey)     ]  );


----
Resulting Output
=== MMF DESCRIPTOR (MMFD) =====================
| MMF size: 1048576 bytes
| No. of variables held in MMF: 1
| MMF Heap: top 	  1048532
|			watermark 89
|			bottom	  20
+== HEAP STRUCTURE ============================
| blk       36:     53 bytes used
+----------------------------------------------
| blks:       1 used,      0 free,      1 total
| bytes:     53 used,      0 free,     53 total
+== VARIABLE DEFINITIONS ======================
| Var_id               Address      Size   Type
| ccTokenIDValue       36           53     C
=== END OF REPORT =============================

=== MMF DESCRIPTOR (MMFD) =====================
| MMF size: 1048576 bytes
| No. of variables held in MMF: 0
| MMF Heap: top 	  0
|			watermark 0
|			bottom	  0
+== HEAP STRUCTURE ============================
+----------------------------------------------
| blks:       0 used,      0 free,      0 total
| bytes:      0 used,      0 free,      0 total
+== VARIABLE DEFINITIONS ======================
| Var_id               Address      Size   Type
=== END OF REPORT =============================






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

Date: Wed, 13 Feb 2008 07:10:42 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Win32::MMF What's going on?
Message-Id: <SJwsj.20225$C61.5726@edtnps89>

blaine@worldweb.com wrote:
> 
> I'm trying to write perl in windows environment and need to use the
> package win32::mmf. Anyhow, I've got some test code below that will
> write to the windows namespace but will not retrieve from it. Please
> note it's just an example in production I would be writing to the ns
> in one script and grabbing from the ns in another.
> 
> For some reason the second instance of mmf is not accessing the same
> namespace. Any ideas?
> 
> 
> 	my $mmf = Win32::MMF->new( -swapfile => "data.swp",
>                              -namespace => "MyDataShare",
>                              -size => 1024 * 1024 )
>        or die "\n\n\n\nCan not create namespace";
> 
> 	$mmf->setvar($tokenKey, $hashRef);
> 	print "\n\n " . $mmf->debug();
> 
> 	print "\n\n<BR>--------------";
> 
> 	undef $mmf;

perldoc Win32::MMF
[ SNIP ]
Note that there is no need to explicitly unmap the view, close the 
namespace and close the swap file in object-oriented mode, the view, 
namespace and swap file handles are automatically closed-off and 
disposed of when the Win32::MMF object falls out of scope.

"undef $mmf" effectively closes and disposes of the MMF.  Opening a new 
MMF will open a new clean disk file.


> 	my $mmf = Win32::MMF->new( -swapfile => "data.swp",
>                              -namespace => "MyDataShare",
>                              -size => 1024 * 1024 ,
> 
> 		)
>        or die "\n\n\n\nCan not create namespace";
> 
> 	print Data::Dumper->Dump(  [ $mmf->getvar($tokenKey)     ]  );



John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 1273
***************************************


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