Results 1 to 6 of 6

Thread: [RESOLVED] Perl and data query

  1. #1
    Join Date
    Jun 2008

    resolved [RESOLVED] Perl and data query

    Hi, I don't know if what I would like to do is even possible.

    A Server Side Include (SSI) works fine on HTML pages, calling up a Perl script. However, they don't work from within a Perl script.

    For instance: an HTML file has an SSI to a script which reads a flat file database.
    <!--#include virtual="/cgi-bin/someting/ascript.pl?action=read&data=file&id=1" -->
    (This is handled by a Query String with special parser in script)
    The field in the record that it is reading, cannot have another SSI.

    I wish it could (some serious wishful thinking here)

    Or is there another way?
    Like in the content of what is read, something could be entered in my editor that would invoke another script or sub routine or ?

    I have thought of JavaScript, which could be entered in my editor, but would rather keep away from that.

    Any Ideas?

  2. #2
    Join Date
    Mar 2011
    It's certainly possible for a Perl script to call another Perl script that was originally designed to be accessed via SSI. The CPAN module LWP::UserAgent makes it pretty easy, and it's not outrageously difficult to parse out the <body> content of an HTML page. But it is more complicated to get two Perl scripts to work together than it is to simply insert a <!--#include--> command in an HTML file. Do you know Perl programming or are you using ready-made scripts?
    Rick Trethewey
    Rainbo Design

  3. #3
    Join Date
    Jun 2008
    Hi Rick, I write my own (not perfect, but they work).

    Let's say ascript.pl reads in the FFDB from SSI in HTML File:
    1|Calling script from data|Okay I have an entry and want to include something else from another script in the entry. How do I do that?<br><br><b>This is my B content</b><br><br><!--#include virtual="/cgi-bin/someting/bbb.pl" --><br><br>The C Content could say<br><br><!--#include virtual="/cgi-bin/someting/ccc.pl" --><br><br>So the actual SSIs are in the flat file database
    This returns:
    Calling script from data
    Okay I have an entry and want to include something else from another script in the entry. How do I do that?

    This is my B content

    The C Content could say:

    So the actual SSIs are in the flat file database
    I get the same with relative or full server path in the content SSI's. Both the little scripts just have a bit of text in for testing.

    See what I mean?

    Thinking about if further. Since I have already grabbed the field, it could be put in a hash and then a while loop looking for certain conditions (instead of the SSI - say **bbb**) and when the condition is met, a require for the bbb script is coded into the read portion of the main script or it returns empty. I'll see if that works.
    Last edited by edatz; 05-08-2012 at 03:51 AM.

  4. #4
    Join Date
    Jun 2008
    I'm going about this all wrong (that's me being half awake when I started)

    First off it has to be invisible, so a tag must be used.

    So - I have a block of text from my database and in it is a tag
    Text text text text text text text text
    More text more text more text more text more text more text
    .... so that it shows (including from the other sub routine) ....
    Text text text text text text text text
    Blah blah blah blah blah blah blah
    More text more text more text more text more text more text
    The object would be to replace that tag with a call to a sub routine which will have changeable content in it.

    The rest of the block of text will show as normal, with the sub call content in the middle of it

    Does that make more sense?

  5. #5
    Join Date
    Jun 2008
    I am getting somewhere on this....

    @td = "$fd[2]";
    foreach $line (@td) {      
    print qq ~$line~;
    if ( ~ m/<bbb>/ ) {
    ## need to something more with this
    } else {print qq ~$line~;}
    What happens is I see the results of the sub call, but after my block of text, instead of in the middle of it. I think something is needed in the if statement. Not sure how as this is new to me.

  6. #6
    Join Date
    Jun 2008
    I've scrapped the idea - it was just a side thought anyways.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.18581 seconds
  • Memory Usage 2,890KB
  • Queries Executed 15 (?)
More Information
Template Usage (34):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (4)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (6)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (72):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates